Permutations and Combinations
Introduction
Permutations and combinations are fundamental in combinatorics. A permutation refers to selecting a specified number of elements from a given set and arranging them in a specific order; a combination refers to merely selecting a specified number of elements from a given set, without considering the order. The central problem of permutations and combinations is to study the total number of possible arrangements and selections under given conditions. Permutations and combinations are closely related to classical probability theory.
In elementary high school mathematics, permutations and combinations are often solved using methods like listing and enumeration.
Addition & Multiplication Principles
Addition Principle
If a task can be completed in \(n\) different ways, and \(a_i(1 \le i \le n)\) represents the number of methods in the \(i\)-th category, then the total number of different ways to complete the task is \(S=a_1+a_2+\cdots +a_n\).
Multiplication Principle
If a task requires \(n\) steps to complete, and \(a_i(1 \le i \le n)\) represents the number of different methods for the \(i\)-th step, then the total number of different ways to complete the task is \(S = a_1 \times a_2 \times \cdots \times a_n\).
Basics of Permutations and Combinations
Number of Permutations
From \(n\) distinct elements, taking \(m\) (\(m\leq n\), where \(m\) and \(n\) are natural numbers, same below) elements and arranging them in a specific order is called a permutation of taking \(m\) elements from \(n\) distinct elements. The total number of all such permutations is called the number of permutations of taking \(m\) elements from \(n\) distinct elements, denoted by the symbol \(\mathrm A_n^m\) (or \(\mathrm P_n^m\)).
The formula for calculating permutations is as follows:
Here, \(n!\) represents the factorial of \(n\), i.e., \(6! = 1 \times 2 \times 3 \times 4 \times 5 \times 6\).
The formula can be understood as follows: \(n\) people choose \(m\) to line up (\(m \le n\)). The first position can be chosen from \(n\) people, the second from \(n-1\), and so on, the \(m\)-th (last) position can be chosen from \(n-m+1\) people, yielding:
Full permutation: all \(n\) people line up, the line length is \(n\). The first position can be chosen from \(n\) people, the second from \(n-1\), and so on:
Full permutation is a special case of the permutation number.
Number of Combinations
From \(n\) distinct elements, taking \(m \leq n\) elements to form a set is called a combination of taking \(m\) elements from \(n\) distinct elements. The total number of all such combinations is called the number of combinations of taking \(m\) elements from \(n\) distinct elements, denoted by the symbol \(\dbinom{n}{m}\), read as "\(n\) choose \(m\)".
The formula for calculating combinations is:
How to understand the above formula? Consider \(n\) people choosing \(m\) (\(m \le n\)) without lining up, i.e., order does not matter. If order mattered, it would be \(\mathrm A_n^m\). Since order does not matter, we must divide out the duplicates. How many duplicates? The same \(m\) chosen people can be arranged in \(m!\) ways, so:
The combination number is also commonly denoted as \(\mathrm C_n^m\), i.e., \(\displaystyle \mathrm C_n^m=\binom{n}{m}\). Currently, the mathematical community generally adopts the notation \(\dbinom{n}{m}\) rather than \(\mathrm C_n^m\).
The combination number is also known as the "binomial coefficient", and its connection will be explained in the binomial theorem below.
Specifically, it is defined that when \(m>n\), \(\mathrm A_n^m=\dbinom{n}{m}=0\).
Stars and Bars
Stars and bars is a technique used to find the number of ways to group identical elements, and can also be used to find the number of solutions to a certain type of linear indeterminate equations.
Number of Positive Integer Sums
Problem 1: Given \(n\) identical elements, divide them into \(k\) groups, ensuring each group has at least one element. How many ways are there?
Consider inserting \(k - 1\) dividers into the \(n - 1\) gaps between the \(n\) elements.
Since the elements are identical, the answer is \(\dbinom{n - 1}{k - 1}\).
Essentially, it is finding the number of positive integer solutions to \(x_1+x_2+\cdots+x_k=n\).
Number of Non-Negative Integer Sums
Problem 2: What if each group is allowed to be empty?
Clearly, we cannot directly apply stars and bars now, because many dividers might be inserted into the same gap, making calculation difficult.
We consider transforming the problem into a restricted version like Problem 1 by borrowing \(k\) elements first. Insert dividers into the \(n + k - 1\) gaps among these \(n + k\) elements, yielding the answer:
Although this is not directly the original problem, this expression gives the answer to the original problem. It can be understood as follows:
We borrowed \(k\) elements at the beginning to ensure each group has at least one element. After inserting the dividers, we remove these \(k\) borrowed elements from the \(k\) groups. Since the elements are identical, there is a one-to-one correspondence between the transformed case and the original case, so the answers are equal.
Thus, we can derive the stars and bars formula: \(\dbinom{n + k - 1}{n}\).
Essentially, it is finding the number of non-negative integer solutions to \(x_1+x_2+\cdots+x_k=n\) (i.e., requiring \(x_i \ge 0\)).
Number of Integer Sums with Different Lower Bounds
Problem 3: Extending further, if for the \(i\)-th group, at least \(a_i\) elements must be allocated, with \(\sum a_i \le n\)?
Essentially, it is finding the number of solutions to \(x_1+x_2+\cdots+x_k=n\), where \(x_i \ge a_i\).
Analogous to the unrestricted case, we borrow \(\sum a_i\) elements to ensure the \(i\)-th group gets at least \(a_i\) elements. That is, let
We obtain the new equation:
where
Then Problem 3 transforms into Problem 2, and directly applying the stars and bars formula gives the answer:
Non-Adjacent Selections
From the natural numbers \(1 \sim n\), choose \(k\) numbers such that no two of them are adjacent. The number of such combinations is \(\dbinom {n-k+1}{k}\).
Binomial Theorem
Before moving to the advanced section of permutations and combinations, we introduce a theorem closely related to combination numbers—the binomial theorem.
The binomial theorem clarifies the coefficients of an expansion:
Proof can be done by mathematical induction, using \(\dbinom{n}{k}+\dbinom{n}{k-1}=\dbinom{n+1}{k}\).
The binomial theorem can also be easily extended to the polynomial form:
Let \(n\) be a positive integer, \(x_i\) be real numbers,
Here, \(\dbinom{n}{n_1,n_2,\cdots,n_t}\) is the multinomial coefficient, and its properties are similar:
Advanced Permutations and Combinations
Next, we introduce some variants of permutations and combinations.
Permutations of Multisets | Multinomial Coefficients
Please be sure to distinguish between multinomial coefficients and combinations of multisets! They are completely different concepts!
A multiset is a generalized set containing repeated elements. Let \(S=\{n_1\cdot a_1,n_2\cdot a_2,\cdots,n_k\cdot a_k\}\) denote a multiset consisting of \(n_1\) copies of \(a_1\), \(n_2\) copies of \(a_2\), …, \(n_k\) copies of \(a_k\). The number of full permutations of \(S\) is
This essentially divides out the permutations of identical elements. Specifically, you can think of having \(k\) different types of balls, with counts \(n_1,n_2,\cdots,n_k\) respectively, and \(n=n_1+n_2+\ldots+n_k\). The number of full permutations of these \(n\) balls is the permutation number of the multiset. The permutation number of a multiset is often called the multinomial coefficient. We can denote the above expression using the multinomial coefficient symbol:
It can be seen that \(\dbinom{n}{m}\) is equivalent to \(\dbinom{n}{m,n-m}\), but the latter is more cumbersome and thus not commonly used.
Combinations of Multisets 1
Let \(S=\{n_1\cdot a_1,n_2\cdot a_2,\cdots,n_k\cdot a_k\}\) denote a multiset consisting of \(n_1\) copies of \(a_1\), \(n_2\) copies of \(a_2\), …, \(n_k\) copies of \(a_k\). Then for an integer \(r(r<n_i,\forall i\in[1,k])\), the number of ways to select \(r\) elements from \(S\) to form a multiset is the combination number of the multiset. This problem is equivalent to finding the number of non-negative integer solutions to \(x_1+x_2+\cdots+x_k=r\), which can be solved using stars and bars, yielding the answer:
Combinations of Multisets 2
Consider this problem: Let \(S=\{n_1\cdot a_1,n_2\cdot a_2,\cdots,n_k\cdot a_k,\}\) denote a multiset consisting of \(n_1\) copies of \(a_1\), \(n_2\) copies of \(a_2\), …, \(n_k\) copies of \(a_k\). Then for a positive integer \(r\), find the number of ways to select \(r\) elements from \(S\) to form a multiset.
This restricts the number of each type of element taken. Similarly, we can transform this problem into solving a linear equation with restrictions:
Naturally, we think of the inclusion-exclusion principle. The inclusion-exclusion model is as follows:
- Universal set: Non-negative integer solutions to \(\displaystyle \sum_{i=1}^kx_i=r\).
- Properties: \(x_i\le n_i\).
Let \(S_i\) be the set satisfying property \(i\), and \(\overline{S_i}\) be the set not satisfying property \(i\), i.e., satisfying \(x_i\ge n_i+1\) (transformed into Problem 3 of stars and bars). Then the answer is
By the inclusion-exclusion principle:
Subtracting the above from the universal set \(\displaystyle |U|=\binom{k+r-1}{k-1}\) gives the combination number for the multiset:
where \(A\) serves to enumerate subsets, satisfying \(|A|=p,\ A_i<A_{i+1}\).
Circular Permutations
All \(n\) people stand in a circle, the total number of arrangements is denoted as \(\mathrm Q_n^n\). Consider an already arranged circle; breaking it at different positions yields different queues. Thus,
From this, we obtain the formula for partial circular permutations:
Combination Number Properties | Binomial Inferences
Since combination numbers are very important in OI, we introduce some properties of combination numbers here.
This is equivalent to taking the complement of the selected set with respect to the universal set, so the value remains unchanged. (Symmetry)
Derived from the definition.
Recurrence relation for combination numbers (expressed by Pascal's triangle formula). We can use this formula to derive combination numbers with \(O(n^2)\) complexity.
This is a special case of the binomial theorem. Setting \(a=b=1\) yields the above.
Another special case of the binomial theorem, taking \(a=1, b=-1\). A special case of the formula is when \(n=0\), the answer is \(1\).
A formula splitting combination numbers, useful when dealing with certain data structure problems. Known as Vandermonde's Identity.
This is a special case of \((6)\), taking \(n=k=m\).
A formula involving weighted sums, provable by differentiating the polynomial function corresponding to \((4)\).
Similar to the above, provable by differentiating the polynomial function.
Can be proven by combinatorial analysis considering the \((k+1)\)-subsets of \(S=\{a_1, a_2, \cdots, a_{n+1}\}\), commonly used in identity proofs. Known as the Hockey-stick Identity.
Provable by definition.
where \(F\) is the Fibonacci sequence.
Provable using \((6)\). Known as Li Shanlan's Identity.
Binomial Inversion
Let \(f_n\) denote the number of ways to form a specific structure using exactly \(n\) distinct elements, and \(g_n\) denote the total number of ways to select \(i \geq 0\) elements from \(n\) distinct elements to form the specific structure.
If \(f_n\) is known and we want \(g_n\), then obviously:
If \(g_n\) is known and we want \(f_n\), then:
The process of obtaining \(f_n\) from known \(g_n\) is called binomial inversion.
Proof
Expand \(g_i\) in the inversion formula:
First sum over \(j\), then over \(i\):
Using formula (11) from 「Combination Number Properties | Binomial Inferences」:
Let \(k = i - j\). Then \(i = k + j\), and the above becomes:
Using formula (5) from 「Combination Number Properties | Binomial Inferences」:
Q.E.D.
本页面最近更新:,更新历史
发现错误?想一起完善? 在 GitHub 上编辑此页!
本页面贡献者:OI-wiki
本页面的全部内容在 CC BY-SA 4.0 和 SATA 协议之条款下提供,附加条款亦可能应用