Counting & Combinations
Introduction
For some of this topic, it might be helpful to look back at the previous Set Theory topic.
Set product rule
The number of elements in a cartesian product, the number of ordered pairs, is equal to the cardinality of the two crossed sets multiplied.
We can also generalise this to crossed sets.
Bit strings
Suppose we want to generate some bit strings. These are strings containing only 1s and 0s. How many bit strings could we generate with length ?
Since each bit can only be either a 1 or a 0, the total number possible of length is .
Suppose now we make this scenario more complicated by trying to generate car license plates. Let these be comprised of three uppercase English letters followed by four digits.
For this, we have to look at the number of possible options for each character in each position.
Counting subsets
A finite set, , has distinct subsets. There is a one-to-one correspondence (bijection), between subsets of and bit strings of length . Imagine each element of as a character in the bit string; let each bit string have a 1 in that position if it contains that element and a 0 in that position if it does not.
For all finite sets and , the number of distinct functions, , is given by . There is a one-to-one correspondence between functions and strings of length over an alphabet of size . By the product rule, there are such strings of length .
Set sum rule
If and are disjoint finite sets, then the cardinality of their union is equal to the sum of their individual cardinalities.
We can also generalise this to disjoint sets.
This is a simplification of the subtraction rule, also known as the inclusion-exclusion principle. This states that, for any finite sets and , the cardinality of their union is equal to the sum of their individual cardinalities minus the cardinality of their intersection.
The pigeonhole principle
For any positive integer , if objects are placed in boxes, then at least one box contains two or more objects.
More formally, if a function maps a finite set with to a finite set , with , then is not injective.
This can be calculated by saying that if objects are placed in boxes, then at least one box contains at least objects.
Stirling’s approximation
It is often more useful to have explicit lower and upper bounds on
For all :
This theorem can also be applied to binomial coefficients:
Vandermonde’s identity is also meant to be helpful:
As well as Pascal’s identity, for all integers , and all integers :
Permutations
A permutation of a set is an ordered arrangement of the elements of . In other words, it is a sequence containing every element of exactly once.
Another way of explaining a permutation of a set is as a bijection.
Note that is a bijection if and only if the sequence on the right contains every element of exactly once.
r-Permutations
A r-permutation of a set , is an ordered arrangement of distinct elements of S. There is only one 0-permutation of any set: the empty sequence.
Another way of explaining a r-permutation of a set is as an injection.
So, for a set with , the number of r-permutions of , is equal to the number of one-to-one functions:
Let denote the number of r-permutations of an n-element set.
There are different choices for the first element of the sequence. For each of those choices, there are remaining choices for the second element. For every combination of the first two choices, there are choices for the third element, and so forth.
The binomial theorem
This is the method of working out the coefficients of terms in multiplied out polynomail.
For all :
Combinations
An r-combination of a set is an unordered collection of elements of . In other words, it is simply a subset of of size .
Let denote the number of r-combinations of an n-element set. These are called ‘binomial coefficients’ and are read as " choose ". It can also be written as:
Indistinguishable objects
This type of question is often presented as a word with repeated letters where you are asked how many anagrams can be made. However, bare in mind that if a word contains two As then we have to account for the case where those two As are swapped but all other letters are the same. We have to compensate for that case being double-counted.
The number of permutations of objects, with indistinguishable objects of type and indistinuishable objects of type , is: