Introduction
Permutations and combinations are fundamental topics in combinatorics. A permutation selects a specified number of elements from a given set and arranges them; a combination selects a specified number of elements without considering their order. The central problem of permutations and combinations is to study the total number of possible arrangements and selections under given requirements. Permutations and combinations are closely related to classical probability theory.
In elementary high-school mathematics, permutations and combinations are often solved by methods such as listing and enumeration.
Addition and Multiplication Principles
Addition Principle
Suppose a task can be completed in categories of ways, and is the number of ways in category . Then there are different ways to complete the task.
Multiplication Principle
Suppose a task consists of steps, and is the number of different ways to complete step . Then there are different ways to complete the task.
Basics of Permutations and Combinations
Permutations
From distinct elements, taking any (, where and are natural numbers, as below) and arranging them in a specified order is called a permutation obtained from distinct elements by taking elements. The number of all permutations obtained from distinct elements by taking elements () is called the number of permutations obtained from distinct elements by taking elements, denoted by (or ).
The formula for permutations is
denotes the factorial of , that is, .
The formula can be understood as follows: choose people and select of them (), then line them up. There are choices for the first position, choices for the second position, and so on; for the -th (last) position, there are choices. Thus,
A full permutation: all people line up, so the length of the line is . There are choices for the first position, choices for the second position, and so on, giving
A full permutation is a special case of permutations.
Combinations
Given distinct elements, with , a set formed from elements by selecting of them is called a combination. The number of all such combinations of distinct elements with selected is called the number of combinations formed from distinct elements by selecting elements, denoted by and read as “ choose ”.
The formula for combinations is
How should we understand this formula? Consider choosing people and selecting of them (), without lining them up and without caring about their order. If order matters, the number is ; if order does not matter, we must divide out the duplicates. How many duplicates are there? The same people can be arranged in a “full permutation” in ways, so
Combinations are also commonly denoted by , namely . Modern mathematics generally uses the notation rather than .
Combinations are also called “binomial coefficients”; the binomial theorem below will explain the connection.
In particular, when , define .
Stars and Bars
Stars and bars is a technique for counting the ways to divide identical elements into groups; it can also be used to count the solutions of a class of linear Diophantine equations.
Number of Sums of Positive Integers
Problem 1: there are identical elements. Divide them into groups, with at least one element in each group. How many divisions are there?
Consider inserting bars into the gaps formed between the elements; there are such gaps.
Because the elements are identical, the answer is .
In essence, this counts the positive-integer solutions of .
Number of Sums of Nonnegative Integers
Problem 2: what if the problem is changed so that each group may be empty?
Clearly, stars and bars cannot be applied directly, because many bars may be inserted into one gap, which is very difficult to count.
We create a condition to transform this into the constrained Problem 1. First borrow elements, then insert bars into the gaps formed by the elements; there are such gaps. The answer is
Although this does not directly count the original problem, this expression is its answer. The interpretation is as follows:
At the beginning, we borrow elements to ensure that each group has at least one element. After inserting the bars, remove the borrowed elements from the groups. Since the elements are identical, the transformed cases and the original cases correspond one-to-one, so their answers are equal.
This gives the stars-and-bars formula: .
In essence, this counts the nonnegative-integer solutions of (that is, subject to ).
Number of Integer Sums with Different Lower Bounds
Problem 3: extend the problem one step further. Require group to receive at least elements. How many divisions are there?
In essence, this counts the solutions of with .
By analogy with the unrestricted case, borrow elements to ensure that group can receive at least elements. In other words, let
This gives the new equation:
where
Problem 3 is now transformed into Problem 2, so the stars-and-bars formula gives the answer
Non-Adjacent Selections
Among the natural numbers , there are numbers in total. The number of ways to choose of them so that these numbers contain no adjacent pair is .
Binomial Theorem
Before moving on to advanced permutations and combinations, we first introduce a theorem closely related to combinations: the binomial theorem.
The binomial theorem gives the coefficients in an expansion:
It can be proved by mathematical induction, using for the induction.
The binomial theorem can also be readily extended to the multinomial form:
Let be a positive integer and let be real numbers. Then
Here is a multinomial coefficient, whose properties are quite similar:
Advanced Permutations and Combinations
Next we introduce several variants of permutations and combinations.
Multiset Permutations | Multiset Combinations
Be sure to distinguish multiset combinations from combinations of a multiset! They are entirely different concepts!
A multiset is a generalization of a set that may contain repeated elements. Let denote the multiset consisting of copies of , copies of , …, and copies of . The number of full permutations of is
This is equivalent to dividing by the permutations of identical elements. More concretely, imagine that you have types of distinct balls, with balls of each type and . The number of full permutations of these balls is the number of permutations of a multiset. This is often called a multiset combination. We can write the above formula using the notation for multiset combinations:
It can be seen that is equivalent to , but the latter is more cumbersome and is therefore not used.
Combinations of a Multiset 1
Let denote the multiset consisting of copies of , copies of , …, and copies of . For an integer , from select elements to form a multiset; the number of such ways is called a combination of a multiset. This problem is equivalent to counting the nonnegative-integer solutions of , which can be solved by stars and bars. The answer is
Combinations of a Multiset 2
Consider the following problem: let denote the multiset consisting of copies of , copies of , …, and copies of . For a positive integer , how many ways are there, from , to select elements to form a multiset?
This restricts how many copies of each element may be selected. Similarly, we can transform the problem into solving a linear equation with constraints:
This naturally suggests the inclusion-exclusion principle. Its model is:
- Universal set: the nonnegative-integer solutions of .
- Property: .
For property , let the satisfying set be ; is the set not satisfying property , namely the set satisfying (which transforms into Problem 3 of stars and bars). The answer is therefore
By the inclusion-exclusion principle,
Subtracting the above expression from the universal-set size gives the number of combinations of a multiset:
Here A serves as the enumerated subset, satisfying .
Circular Permutations
Arrange all people around a circle; denote the number of all permutations by . Consider a fixed circular arrangement. Breaking the circle at different positions produces different queues. Therefore,
This gives the formula for partial circular permutations:
Properties of Binomial Coefficients | Binomial Corollaries
Because binomial coefficients are extremely important in OI, we introduce several of their properties here.
This is equivalent to taking the complement of the selected set in the universal set, so the value does not change. (Symmetry)
A recurrence derived from the definition.
The recurrence for binomial coefficients (the formula for Pascal's triangle). We can use this formula to derive binomial coefficients in time.
This is a special case of the binomial theorem. Taking gives the formula above.
Another special case of the binomial theorem, obtained by taking . In the special case , the answer is .
An identity for decomposing binomial coefficients, useful in some data-structure problems. It is called Vandermonde's identity.
This is a special case of , obtained by taking .
An identity for a weighted sum, which can be proved by differentiating the polynomial corresponding to .
Similarly, this can be proved by differentiating the polynomial.
This can be proved by combinatorial analysis: consider and count its -element subsets one by one. It is often used in identity proofs. It is called the hockey-stick identity.
This follows directly from the definition.
Here is the Fibonacci sequence.
This can be proved using . It is called Li Shanlan's identity.
Binomial Inversion
Let denote the number of ways to form a specified structure using exactly distinct elements, and let denote the total number of ways to form a specified structure by selecting elements from distinct elements, with selected.
If is known and we seek , then clearly
If is known and we seek , then
The process of using known above to find is called binomial inversion.
Proof
Expanding in the inversion formula gives
Enumerate first and then :
Using formula (11) from “Properties of Binomial Coefficients | Binomial Corollaries”, we obtain
Let . Then , and the expression becomes
Using formula (5) from “Properties of Binomial Coefficients | Binomial Corollaries”, we obtain
This completes the proof.