Presentation is loading. Please wait.

Presentation is loading. Please wait.

How selections can be counted with Pascal's Triangle.

Similar presentations


Presentation on theme: "How selections can be counted with Pascal's Triangle."— Presentation transcript:

1 How selections can be counted with Pascal's Triangle

2 Last time we discussed this counting principle, then we used it to answer several questions about the number of different possible ways in which we could perform a succession of tasks (e.g., make a license plate, make an ascii code, make a computer password, etc.) Today let's see how we can apply this FCP to answer a much more challenging question Fundamental Counting Principle

3 MegaMillions Lottery Ticket Five different integers in range 1.. 56 One extra integer independently chosen in range 1.. 46 What are our chances of winning tonight's $77-million jackpot?

4 We will need to calculate the total number of different possible MegaMillions tickets Making such a ticket consists of two tasks: -- selecting a 5-element subset of the 56-element set of integers { 1, 2, 3,..., 56 } -- selecting a 1-element subset of the 46-element set of integers { 1, 2, 3,..., 46 } So, by the Fundamental Counting Principle, the number of different tickets will be the product of the numbers of ways of performing these two independent tasks It's easy to see that the second task can be done in exactly 46 different ways, but not so easy to see how many ways to select five numbers from { 1, 2, 3,..., 56 } Here we can take advantage of some wise advice about problem-solving from the reknown author of a “best-seller” among mathematics texts, Prof. George Polya of Stanford University, author of HOW TO SOLVE IT (Princeton University Press, 1945)

5 Whenever you have a problem that you don't know how to solve, there is always a simpler problem that you don't know how to solve, so find that problem, and work on it first. -- George Polya (1887-1985)

6 Let's examine the possible outcomes when a coin is tossed four times – or better yet, let's speed things up by tossing four coins all at once It's easier to think about the different outcomes which can occur if we assume our four coins are easily distinguishable from one another So let's say we have a penny, a nickel, a dime, and a quarter Coin-tossing again

7 Applying the FCP _______ _______ penny nickel dime quarter For each coin there are two possibilities (HEADS or TAILS) Fundamental Counting Principle So, by the Fundamental Counting Principle, the number of different possible outcomes will be 2 x 2 x 2 x 2 = 2 4 = 16

8 The sixteen sample-points TTTTTHTTHTTT HHTT TTTHTHTHHTTH HHTH TTHTTHHTHTHT HHHT TTHHTHHHHTHH HHHH ___________________________________ Sequence-key: (Penny, Nickel, Dime, Quarter)

9 Grouping similar outcomes Let's create separate 'pigeonholes' for outcomes that contain equal numbers of HEADS _____ _____ _____ _____ _____ none one two three four Can we foresee how many of the 16 outcomes will go into each of these pigeonholes?

10 The 'pigeonhole' results HHTT HTHT HTTTHTTH HHHT THTTTHTT HHTH TTHTTTHT HTHH TTTTTTTHTTTHTHHH HHHH ------------------------------- --------- 012 34

11 A 'shorthand' notation If we only interested in pigeonholing those outcomes that have a given number of HEADS, regardless of which specific coins show HEADS and which show TAILS, then we can use a shorthand notation borrowed from algebra H 0 T 4 H 1 T 3 H 2 T 2 H 3 T 1 H 4 T 0 ---------------------------------------- ---------- 1 4 6 4 1

12 4 th power of x+y It is hard not to notice that the pattern we see is a familiar one from high school mathematics (x + y) 4 = x 4 + 4x 3 y + 6x 2 y 2 + 4xy 3 + y 4

13 (x + y) n = Σ b(n;k) x k y n-k The Binomial Theorem k=0 n b(n;k) The binomial-coefficient symbol b(n;k) represents the number of ways of selecting k things from a set that contains n things

14 b(56;5) = ? So we need the value of this binomial coefficient in order to have a count of the 5-member subsets of the set of integers { 1, 2, 3,..., 56 } Let's reduce this to a pair of simpler problems: b(56;5) = b(55;4) + b(55;5) Reasoning: The 5-member subsets of { 1, 2, 3,..., 56 } can be split into two groups: those subsets which omit 56 and those subsets which include 56

15 Recursion... Similarly we can reduce each of the simpler problems to a pair of simpler ones still b(55;4) = b(54;3) + b(54,4) and b(55;5) = b(54;4) + b(54;5) Continuing in this way we can reduce these to pairs of simpler and simpler problems

16 Pascal's Triangle Blaise Pascal arranged the binomial coefficients in a now-famous triangular pattern b(0;0) b(1;0) b(1;1) b(2;0) b(2,1) b(2;2) b(3;0) b(3;1) b(3;2) b(3;3) b(4;0) b(4;1) b(4;2) b(4;3) b(4;4) b(5;0) b(5;1) b(5;2) b(5;3) b(5,4) b(5,5)...

17 Python function binomial def binomial( int n, int k ): if ( n < 0 ) or ( k < 0 ) or ( n < k ): return 0; else: if ( n == 0 ) or ( k == 0 ) or ( n == k ): return 1; else: binomialbinomial return binomial( n-1, k-1) + binomial( n-1, k )

18 A MegaMillions “win”? Total number of tickets will be the product b(56;5) * b(46;1) which a short Python program can compute... ______________________________________ binomialbinomial s = binomial( 56, 5 ) + binomial( 46, 1 ) print “The number of possible tickets is”, s p = 1.0 / 1.0*s print “so probability of winning is %1.10f “ % p

19 Weekly Quiz #1


Download ppt "How selections can be counted with Pascal's Triangle."

Similar presentations


Ads by Google