1 The Addition and Multiplication Principles
Let A1,A2,…,Ak be finite sets that are pairwise disjoint (Ai∩Aj=∅ for i=j). Then ∣A1⊔A2⊔⋯⊔Ak∣=∣A1∣+∣A2∣+⋯+∣Ak∣.
This is called the addition principle (rule of sum).
For finite sets A1,A2,…,Ak, ∣A1×A2×⋯×Ak∣=∣A1∣⋅∣A2∣⋯∣Ak∣.
This is called the multiplication principle (rule of product).
2 Permutations
The number of ways to choose r elements from a set of n distinct elements and arrange them in a row is called the number of permutations, denoted P(n,r).
P(n,r)=n(n−1)(n−2)⋯(n−r+1)=(n−r)!n!
By the multiplication principle: there are n choices for the first position, n−1 for the second, and so on, down to n−r+1 choices for the r-th position. Hence P(n,r)=n(n−1)⋯(n−r+1). □
The number of ways to choose r elements from n types with repetition allowed and arrange them in a row is nr.
3 Combinations
The number of ways to choose r elements from a set of n distinct elements without regard to order is called the number of combinations, denoted (rn) or C(n,r).
The number of ways to choose r elements and then arrange them is P(n,r). Since the same set of r elements corresponds to r! different arrangements, we have (rn)=P(n,r)/r!=n!/(r!(n−r)!). □
4 Combinations with Repetition
The number of ways to choose r elements from n types, with repetition allowed and without regard to order, is called the number of combinations with repetition, denoted H(n,r).
Label the n types x1,x2,…,xn, and let ai denote the number of times xi is chosen. The problem amounts to counting the number of nonneg\/ative integer solutions to a1+a2+⋯+an=r. This is equivalent to the classical "stars and bars" problem: arrange r stars and n−1 bars in a row, where the bars serve as dividers. The total number of positions is r+(n−1)=n+r−1, and we must choose n−1 of them for the bars, giving (n−1n+r−1)=(rn+r−1). □
5 Counting Injections and Surjections
Let ∣A∣=r and ∣B∣=n with r≤n. The number of injections from A to B is P(n,r)=n!/(n−r)!.
An injection f:A→B assigns distinct elements of B to the elements of A. By the multiplication principle, this can be done in P(n,r) ways. □
Let ∣A∣=n and ∣B∣=k with n≥k. The number of surjections from A onto B is j=0∑k(−1)j(jk)(k−j)n.
We use the inclusion–exclusion principle. Write B={b1,…,bk} and define Si={f:A→B∣bi∈/Im(f)}. The set of non-surjective maps is S1∪⋯∪Sk. Since ∣Si1∩⋯∩Sij∣=(k−j)n, inclusion–exclusion gives the number of surjections as kn−∣S1∪⋯∪Sk∣=∑j=0k(−1)j(jk)(k−j)n. □
When A={1,2,3,4} and B={a,b}, the number of surjections is ∑j=02(−1)j(j2)(2−j)4=24−2⋅14+0=14.