Counting Techniques
Multiplication Principle
- If procedure A A A has a a a distinct outcomes, and another procedue B B B has b b b distinct outcomes (by “another”, we essentially mean these two procedure are not related in any ways), then the procedure A B AB AB (do A A A, then B B B, or vice versa as A , B A,B A,B are not related) has a b ( = b a ) ab(=ba) ab(=ba) distinct outcomes.
- Generally, a procedure A = A 1 . . . . A n A=A_1....A_n A=A1....An, composed by a series of sub-procedures A 1 , . . . , A n A_1,...,A_n A1,...,An with a 1 , . . . , a n a_1,...,a_n a1,...,an outcomes respectively, has ∏ i = 1 n a i \prod_{i=1}^n a_i ∏i=1nai outcomes.
Coin Toss
- Toss a fair coin for 4 4 4 times, how many possible outcomes?
- Sol
- 2 4 2^4 24 because each tossing has 2 2 2 outcomes, and we repeat it for 4 4 4 times.
n P n nPn nPn
- Fill n n n positions (their “physical locations” are fixed) with n n n distinct objects; each position must take one and only one object. How many possible ways? (This is abbreviated as n P n nPn nPn)
- Sol
- The procedure of filling these
n
n
n positions can be decomposed into the following series of sub-procedures:
- The first position can be filled in n n n distinct ways.
- The second position thus can be filled in n − 1 n-1 n−1 distinct ways.
- …
- The last position has only 1 1 1 way to be filled, given the previous n − 1 n-1 n−1 positions being filled already.
- Thus, by multiplication principle, we get n ! n! n! many ways to fill the positions.
- The procedure of filling these
n
n
n positions can be decomposed into the following series of sub-procedures:
n P r nPr nPr
- Fill r r r positions with n n n distinct objects; r ≤ n r≤n r≤n (This is abbreviated as n P r nPr nPr).
- Sol
- The procedure of filling these
r
r
r positions can be decomposed into the following series of sub-procedures:
- The first position can be filled in n n n distinct ways.
- The second position thus can be filled in n − 1 n-1 n−1 distinct ways.
- …
- The last position has n − ( r − 1 ) n-(r-1) n−(r−1) ways to be filled, given the previous ( r − 1 ) (r-1) (r−1) positions being filled already.
- Thus, Thus, by multiplication principle, we get n ! ( n − r ) ! \frac{n!}{(n-r)!} (n−r)!n! many ways to fill the positions.
- The procedure of filling these
r
r
r positions can be decomposed into the following series of sub-procedures:
n C r nCr nCr
- Choose r r r objects from n n n distinct objects, r ≤ n r≤n r≤n.
- Sol:
- For each combination of r r r objects in n C r nCr nCr, it corresponds to r ! r! r! different permutations by the multiplication principle.
- Therefore, KaTeX parse error: Undefined control sequence: \codot at position 7: nPr=r!\̲c̲o̲d̲o̲t̲ ̲nCr.
- Thus, n C r = n ! ( n − r ) ! r ! nCr=\frac{n!}{(n-r)!r!} nCr=(n−r)!r!n!
n C r = n C n − r nCr=nCn-r nCr=nCn−r
- Out of n n n objects, whenever we choose r r r objects, we are also choosing the rest n − r n-r n−r objects, so this identity holds.
More Coin Toss Problem
- Toss a coin 5 5 5 times. What is the number of situations where exactly 2 2 2 heads and 3 3 3 tails appear?
- Sol
- Choose 2 2 2 to be head, and the rest are automatically tails because that’s the only other possibility. Thus, we have 5 C 2 = 5 ! 2 ! 3 ! = 10 5C2=\frac{5!}{2!3!}=10 5C2=2!3!5!=10.
Permutation With Repetation
- We have 5 5 5 different letters, and with repetation of letters allowed, how many distinct words of length 3 3 3 can we write? What if repetation is not allowed? What if we just choose 3 3 3 letters with repetation allowed, how many distinct combinations will we get?
- Sol
- 5 ⋅ 5 ⋅ 5 5\cdot 5 \cdot 5 5⋅5⋅5 with repetation (this works in the same way tossing a coin 3 3 3 times works, but instead of head and tail, which are two different objects, we now have 5 5 5 different objects)
- 5 P 3 5P3 5P3 because repetation is now forbidden.
- The last situation:
- three distinct letters: 5 C 3 5C3 5C3
- two repeated letters (so two distinct letters are picked into forming the word): 5 C 2 5C2 5C2
- three repeated letters: 5 C 1 5C1 5C1
- The sum will be the answer.
Multiplication principle of probability
- This is essentially the exact definition of multiple events being mutually independent.
- Suppose there are two events: A A A and B B B. The probability that A A A happens is p A p_A pA; the probability that B B B happens is p B p_B pB.
- Then if A A A and B B B are independent events; that is, by the defintion of two events being independnent, P ( A ∩ B ) = P ( A ) ⋅ P ( B ) P(A\cap B)=P(A)\cdot P(B) P(A∩B)=P(A)⋅P(B) (intuitively, independence means the occurence of one event does not affect the likelyhood of the other, which means P ( A ∣ B ) = P ( A ∩ B ) B = P ( A ) ⟹ P ( A ∩ B ) = P ( A ) P ( B ) P(A|B)=\frac{P(A\cap B)}{B}=P(A)\implies P(A\cap B)=P(A)P(B) P(A∣B)=BP(A∩B)=P(A)⟹P(A∩B)=P(A)P(B)). This is the multiplication principle for probability.
- It actually fits the notion of the multiplication principle in counting pretty well: A ∩ B A\cap B A∩B just means that A A A happens first and then B B B happens (or vice versa, as they are independent events), so we essentially have to achieve the event A ∩ B A\cap B A∩B using a sequence of events: A , B A,B A,B.
- If A 1 , . . . , A n A_1,...,A_n A1,...,An are mutually independent events (that is, they are pairwise independent, and P ( A 1 ∩ . . . ∩ A N ) = ∏ i P ( A i ) P(A_1\cap ...\cap A_N)=\prod_i P(A_i) P(A1∩...∩AN)=∏iP(Ai)), then P ( A 1 ∩ . . . ∩ A N ) = ∏ i P ( A i ) P(A_1\cap ...\cap A_N)=\prod_i P(A_i) P(A1∩...∩AN)=∏iP(Ai).
Addition Principle
- If we have A A A number of ways of doing something and B B B number of ways of doing another thing and we can not do both at the same time, then there are A + B A + B A+B ways to choose one of the actions
Inclusion-Exclusion Principle
- ∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ |A\cup B|=|A|+|B|-|A\cap B| ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣