1.5 Counting and Combinatorics

Basic Principles


Addition Principle


If a task can be done in either of two disjoint ways, then the total ways are summed: |A∪B|=|A|+|B| the absolute value of A union B equals the absolute value of A plus the absolute value of B when A∩B=∅ A intersection B equals empty set.

Multiplication Principle


If a task consists of two steps with m m ways for step 1 1 and n n ways for step 2 2, then m×n m times n total ways.

Permutations and Combinations


Permutations


Distinct: Number of ways to arrange n n distinct items: n! n factorial.

Partial: Number of ways to choose and order k k from n n: P(n,k)=n!(n-k) P of open paren n comma k close paren equals the fraction with numerator n factorial and denominator open paren n minus k close paren.

With Repetition: nk n to the k-th power sequences of length k k from n n types.

Combinations


Without Repetition: Number of ways to choose k k from n n: (nk)=n!k!⁢(n-k)! the 2 by 1 column matrix n k equals the fraction with numerator n factorial and denominator k factorial open paren n minus k close paren factorial.

With Repetition: Number of multisets of size k k from n n types: (n+k-1k) the 2 by 1 column matrix Row 1: n plus k minus 1 Row 2: k.

Binomial Theorem


For any integer n≧0 n is greater than over equals 0:

(x+y)n=∑k=0n((nk)⁢xn-k⁢yk) open paren x plus y close paren to the n-th power equals the sum from k equals 0 to n of open paren the 2 by 1 column matrix n k times x raised to the n minus k power y to the k-th power close paren

Pigeonhole Principle


If n n pigeons are placed into m m holes and n>m n is greater than m, then some hole contains at least two pigeons. More generally: at least one hole has at least ⌈n/m⌉ ceiling of n divided by m pigeons.