DOC PREVIEW
Duke CPS 102 - Lecture 9

This preview shows page 1-2-3-4-5-34-35-36-37-68-69-70-71-72 out of 72 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 72 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Slide 66Slide 67Slide 68Slide 69Slide 70Slide 71Slide 72COMPSCI 102Introduction to Discrete MathematicsX1 X2 + + X3Lecture 8 (September 21, 2007)Counting IIIHow many ways to How many ways to rearrange the letters in rearrange the letters in the word the word “SYSTEMS”??SYSTEMS7 places to put the Y, 6 places to put the T, 5 places to put the E, 4 places to put the M, and the S’s are forced7 X 6 X 5 X 4 = 840SYSTEMSLet’s pretend that the S’s are distinct:S1YS2TEMS3There are 7! permutations of S1YS2TEMS3But when we stop pretending we see that we have counted each arrangement of SYSTEMS 3! times, once for each of 3! rearrangements of S1S2S37!3!= 840Arrange n symbols: r1 of type 1, r2 of type 2, …, rk of type knr1n-r1r2…n - r1 - r2 - … - rk-1rk(n-r1)!(n-r1-r2)!r2!n!(n-r1)!r1!=…=n!r1!r2! … rk!14!2!3!2!= 3,632,428,800CARNEGIEMELLONRemember:The number of ways to arrange n symbols with r1 of type 1, r2 of type 2, …, rk of type k is:n!r1!r2! … rk!5 distinct pirates want to divide 20 identical, indivisible bars of gold. How many different ways can they divide up the loot?Sequences with 20 G’s and 4 /’sGG/G//GGGGGGGGGGGGGGGGG/represents the following division among the pirates: 2, 1, 0, 17, 0In general, the ith pirate gets the number of G’s after the (i-1)st / and before the ith /This gives a correspondence (bijection) between divisions of the gold and sequences with 20 G’s and 4 /’sSequences with 20 G’s and 4 /’sHow many different ways to divide up the loot?244How many different ways can n distinct pirates divide k identical, indivisible bars of gold?n + k - 1n - 1n + k - 1k=How many integer solutions to the following equations?x1 + x2 + x3 + x4 + x5 = 20x1, x2, x3, x4, x5 ≥ 0Think of xk are being the number of gold bars that are allotted to pirate k244How many integer solutions to the following equations?x1 + x2 + x3 + … + xn = kx1, x2, x3, …, xn ≥ 0n + k - 1n - 1n + k - 1k=Identical/Distinct DiceSuppose that we roll seven diceHow many different outcomes are there, if order matters?67What if order doesn’t matter?(E.g., Yahtzee)127(Corresponds to 6 pirates and 7 bars of gold)MultisetsA multiset is a set of elements, each of which has a multiplicityThe size of the multiset is the sum of the multiplicities of all the elementsExample: {X, Y, Z} with m(X)=0 m(Y)=3, m(Z)=2Unary visualization: {Y, Y, Y, Z, Z}Counting Multisets=n + k - 1n - 1n + k - 1kThere number of ways to choose a multiset of size k from n types of elements is:+ +( )+( ) =++ + + +Polynomials Express Choices and OutcomesProducts of Sum = Sums of Productsb2b3b1t1t2t1t2t1t2b1t1b1t2b2t1b2t2b3t1b3t2(b1+b2+b3)(t1+t2) = b1t1b1t2b2t1b2t2b3t1b3t2+ + + + +There is a correspondence between paths in a choice tree and the cross terms of the product of polynomials!1 X 1 X1 X 1 X1 X1 X1 X1XXX2XX2X2X3Choice Tree for Terms of (1+X)3Combine like terms to get 1 + 3X + 3X2 + X3What is a Closed Form Expression For ck?(1+X)n = c0 + c1X + c2X2 + … + cnXn(1+X)(1+X)(1+X)(1+X)…(1+X)After multiplying things out, but before combining like terms, we get 2n cross terms, each corresponding to a path in the choice treeck, the coefficient of Xk, is the number of paths with exactly k X’snkck =binomial expressionBinomial CoefficientsThe Binomial Formulan1(1+X)n =n0X0+ X1+…+nnXnThe Binomial Formula(1+X)0 =(1+X)1 =(1+X)2 =(1+X)3 =(1+X)4 =11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X31 + 4X + 6X2 + 4X3 + 1X45!What is the coefficient of EMSTY in the expansion of(E + M + S + T + Y)5?What is the coefficient of EMS3TY in the expansion of(E + M + S + T + Y)7?The number of ways to rearrange the letters in the word SYSTEMSWhat is the coefficient of BA3N2 in the expansion of(B + A + N)6?The number of ways to rearrange the letters in the word BANANAWhat is the coefficient of (X1r1X2r2…Xkrk)in the expansion of(X1+X2+X3+…+Xk)n?n!r1!r2!...rk!There is much, much more to be said about how polynomials encode counting questions!Power Series Representation(1+X)n =nkXkk = 0nnkXkk = 0=“Product form” or“Generating form”“Power Series” or “Taylor Series” ExpansionFor k>n,nk= 0By playing these two representations against each other we obtain a new representation of a previous insight:(1+X)n =nkXkk = 0nLet x = 1,nkk = 0n2n =The number of subsets of an n-element setBy varying x, we can discover new identities:(1+X)n =nkXkk = 0nLet x = -1,nkk = 0n0 =(-1)kEquivalently,nkk evennnkk oddn=The number of subsets with even size is the same as the number of subsets with odd sizeProofs that work by manipulating algebraic forms are called “algebraic” arguments. Proofs that build a bijection are called “combinatorial” arguments(1+X)n =nkXkk = 0nLet On be the set of binary strings of length n with an odd number of ones.Let En be the set of binary strings of length n with an even number of ones.We gave an algebraic proof that On  =  En nkk evennnkk oddn=A Combinatorial ProofLet On be the set of binary strings of length n with an odd number of onesLet En be the set of binary strings of length n with an even number of onesA combinatorial proof must construct a bijection between On and EnAn Attempt at a BijectionLet fn be the function that takes an n-bit string and flips all its bitsfn is clearly a one-to-one and onto function...but do even n work? In f6 we havefor odd n. E.g. in f7 we have:110011  001100101010  0101010010011  11011001001101  0110010Uh oh. Complementing maps evens to evens!A Correspondence That Works for all nLet fn be the function that takes an n-bit string and flips only the first bit. For example,0010011  10100111001101  0001101110011  010011101010  001010The binomial coefficients have so many representations that many fundamental mathematical identities emerge…(1+X)n =nkXkk = 0nThe Binomial Formula(1+X)0 =(1+X)1 =(1+X)2 =(1+X)3 =(1+X)4 =11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X31 + 4X + 6X2 + 4X3 + 1X4Pascal’s Triangle: kth


View Full Document

Duke CPS 102 - Lecture 9

Documents in this Course
Lecture

Lecture

34 pages

Lecture

Lecture

42 pages

Lecture

Lecture

46 pages

Lecture

Lecture

77 pages

Notes

Notes

17 pages

Notes

Notes

52 pages

Lecture

Lecture

7 pages

Lecture

Lecture

11 pages

Lecture

Lecture

28 pages

Lecture

Lecture

25 pages

Forbes

Forbes

9 pages

Lecture

Lecture

53 pages

Lecture

Lecture

21 pages

Lecture 4

Lecture 4

54 pages

Lecture

Lecture

24 pages

Lecture

Lecture

46 pages

Lecture

Lecture

16 pages

Lecture

Lecture

7 pages

Lecture

Lecture

46 pages

Graphs II

Graphs II

34 pages

Lecture

Lecture

81 pages

Lecture

Lecture

46 pages

Load more
Download Lecture 9
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 9 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 9 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?