Last Week We are going to count: The Art of Combinatorics Thus far: multiplying events adding events inclusion – exclusion principle Today: Permutations and Combinations Binomials, Pascal’s Triangle
Permutations / Combinations How many ways can you order n elements? Answer: n(n–1)(n–2)…1 = n! (say “n factorial”) Note: 0!=1, 1!=1, 2!=2, 3!=6, 4!=24, … How many ways can you order r out of n elements? Answer: n(n–1)(n–2)…(n–r+1) = n! / (n–r)! Sometimes denoted by P(n,r)
Example: Let there be 15 different people, in how many ways can you line up 10 of them? Answer: 1514…6 = P(15,10) = 10,897,286,400 Note how fast n! grows: n! = (2n)
Binomial How many ways can you select r elements out of n? (without concern for the order of selection) Answer: You can order the r elements in n!/(n–r)! ways Dividing out the r! orderings, gives you Say: “n choose r”, or “the binomial of n over r”
Examples: Let there be 15 different people, in how many ways can you select 10 of them? Answer: C(15,10) = 15! / (10!5!) = 3003 I’m flipping a coin 20 times, in how many ways can I have the outcome “heads” 10 times? Answer: C(20,10) = 20! / (10!10!) = 184 756 … the outcome “heads” k times? Answer: C(20,k) = 20! / ((20–k)!k!)
Properties of Binomials Because: we have Also: For constant c and variable n:
Binomial Theorem Consider the n-fold product (a+b)n: (a+b)(a+b)…(a+b) = an + nan–1b + n(n–1)/2an–2b2 +…+ bn Binomial Theorem (8.39): Example: (a+b)4 = a4+4a3b+6a2b2+4ab3+b4 Immediate consequence:
Bit Strings Consider all bit strings of length n (all 2n of them). The number of strings with k “ones” is C(n,k). Hence indeed C(n,0)+C(n,1)+C(n,2)+…+C(n,n) = 2n. We expect that ‘most’ strings will have n/2 ones. Indeed, when we plot C(20,k) for k=0,…,20, we get the bell shaped binomial distribution:
Binomial Identity Theorem 8.43: For all n,kN: ÷ ø ö ç è æ - + = k 1 n Theorem 8.43: For all n,kN: Proof by interpretation: “How can we pick k out of n? …consider n–1…” et cetera (see book). Algebraic Proof:
Triangle of Binomials Because of the relation C(n,k) = C(n–1,k–1)+C(n–1,k), we can write the binomials in a triangle: Where on the ‘outside edges’ we have C(n,0)=C(n,n)=1 On the ‘inside’ we have This gives…
Pascal’s Triangle By filling in the triangle of binomial values, we get Pascal’s Triangle: For large n, the values on a row (like 1,4,6,4,1) behave like a smooth bell curve: the Gaussian
Binomials and Bits Consider a random n bit string x1,…,xn with xj{0,1}. The probability of this string is 2–n, the probability of k “ones” in the string is C(n,k)/2n The binomial distribution for large n teaches us that, although we expect half of the n bits to be “one”, the probability of k=½ n will be: Instead, we can expect the number of “ones” to be between k = ½ n – n and ½ n + n