Permutations with Repetition and Multisets
In Sections 03 and 05, every object was distinct from every other object. In real counting problems, however, identical copies of objects often appear—such as repeated letters in a word, identical coins in a pocket, or digits reused in an access code.
When some objects are indistinguishable, swapping two identical objects does not create a new arrangement, so the total number of distinct permutations shrinks. In this section we study three regimes of permutations with repetition:
- Full permutations when each object repeats a fixed number of times (multisets).
- Partial (\(r\)-) permutations of a finite multiset.
- Permutations when repetition is allowed any number of times (unlimited supply).
Permutations of a Multiset (Fixed Multiplicities)
Start with a small example: how many distinct permutations of the letters \(a, a, b\) exist?
Listing all possibilities gives only three arrangements:
If all three letters had been distinct (\(a_1, a_2, b\)), there would have been \(3! = 6\) permutations. Because the two \(a\)'s are identical, interchanging them produces no new word, cutting the count in half.
Now consider a larger word: MISSISSIPPI. It has \(11\) letters, with several repetitions. To record both the distinct types of objects and how many times each occurs, we write a multiset:
To count all distinct \(11\)-letter arrangements of MISSISSIPPI, picture \(11\) distinct numbered slots in a row and place one letter type at a time:
- Place the \(1\)
M: Choose \(1\) of the \(11\) slots in \(\binom{11}{1}\) ways. Now \(10\) slots remain. - Place the \(4\) identical
I's: Choose \(4\) of the remaining \(10\) slots in \(\binom{10}{4}\) ways. Notice that we use combinations (not permutations) because all fourI's are identical—rearranging them among their \(4\) chosen slots produces the exact same word. Now \(6\) slots remain. - Place the \(4\) identical
S's: Choose \(4\) of the remaining \(6\) slots in \(\binom{6}{4}\) ways. Now \(2\) slots remain. - Place the \(2\) identical
P's: Fill the final \(2\) slots in \(\binom{2}{2} = 1\) way.
By the Multiplication Principle, the intermediate factorials cancel cleanly:
The General Multiset Permutation Theorem
Theorem (Multiset Permutations): Let \(A = \{n_1 \cdot a_1,\; n_2 \cdot a_2,\; \dots,\; n_k \cdot a_k\}\) be a multiset containing \(k\) distinct types of objects repeated \(n_1, n_2, \dots, n_k\) times respectively, and let \(n = n_1 + n_2 + \dots + n_k\) be the total number of objects. The total number of distinct linear permutations of all \(n\) objects is:
Proof 1 (Sequential Slot Selection): Choose \(n_1\) of the \(n\) slots for the copies of \(a_1\) in \(\binom{n}{n_1}\) ways, then \(n_2\) of the remaining \(n - n_1\) slots for \(a_2\) in \(\binom{n - n_1}{n_2}\) ways, and continue until the last \(n_k\) copies of \(a_k\) fill the remaining \(n_k\) slots in \(\binom{n_k}{n_k}\) ways. Multiplying and canceling consecutive factorials gives:
Proof 2 (Via the Division Principle): Temporarily attach distinct subscript labels to identical objects so all \(n\) objects become distinguishable. These \(n\) labeled objects permute in \(n!\) ways. Removing the temporary labels groups every distinct multiset permutation into an equivalence class of equal size \(n_1! n_2! \cdots n_k!\) (the number of ways to permute identical copies among themselves). By the Division Principle, dividing \(n!\) by \(n_1! n_2! \cdots n_k!\) yields the exact count. \(\blacksquare\)
Example 1 (Bundle Method with Identical Objects): In how many ways can the letters of ASSASSINATION be arranged so that all the S's stay together?
Solution: The word has \(13\) letters: \(\{3 \cdot \text{A},\; 4 \cdot \text{S},\; 2 \cdot \text{I},\; 2 \cdot \text{N},\; 1 \cdot \text{T},\; 1 \cdot \text{O}\}\).
Tie all \(4\) S's into a single block [SSSS]. Because all four S's are identical, there is only \(1\) internal arrangement inside the block (not \(4!\)). We now permute \(13 - 4 + 1 = 10\) objects with multiplicities \(3\) A's, \(2\) I's, \(2\) N's, \(1\) T, \(1\) O, and \(1\) [SSSS]:
Example 2 (Gap Method with Identical Objects): Find the number of arrangements of MISSISSIPPI in which no two I's are adjacent.
Solution: First arrange the \(7\) non-I letters (M, \(4\) S's, \(2\) P's):
These \(7\) letters create \(8\) gaps (including both outer ends). We must place the \(4\) I's into \(4\) of these \(8\) gaps. Be careful: because all \(4\) I's are identical, we choose \(4\) gaps using \(\binom{8}{4}\)—not \({}^8 P_4\)!
Example 3 (Fixed Relative Order): In how many ways can the letters of MATHEMATICS be arranged such that the vowels (A, E, A, I) always appear in alphabetical order (A, A, E, I) from left to right (not necessarily adjacent)?
Solution: MATHEMATICS has \(11\) letters: \(\{2 \cdot \text{M},\; 2 \cdot \text{A},\; 2 \cdot \text{T},\; 1 \cdot \text{H},\; 1 \cdot \text{E},\; 1 \cdot \text{I},\; 1 \cdot \text{C},\; 1 \cdot \text{S}\}\).
Here is a slick trick using the multiset formula: temporarily treat all \(4\) vowels (A, A, E, I) as \(4\) identical blank tokens □, □, □, □! Arrange the \(11\) symbols (\(4\) □'s, \(2\) M's, \(2\) T's, H, C, S) in:
In every such arrangement, there is only \(1\) way to replace the four □ slots from left to right with A, A, E, I in alphabetical order! Hence the answer is \(415{,}800\).
Dictionary Rank of a Word with Repeated Letters
In Section 03, we computed the dictionary rank of words whose letters are all distinct. Now that we have the Multiset Permutation Formula, we can extend that exact prefix-by-prefix algorithm to words with repeated letters.
At each position \(i\) from left to right, count how many words start with a smaller unused letter at position \(i\). Whenever a remaining suffix has repeated letters with multiplicities \(m_1, m_2, \dots\), the number of distinct suffix permutations is \(\frac{(n - i)!}{m_1!\,m_2!\cdots}\). Equivalently, you may count all unused letters strictly before the \(i\)-th letter (with multiplicity) and divide by the factorials of the multiplicities of all remaining letters (including the current letter itself).
Example 4 (Repeated Letters — SMALL): Find the dictionary rank of the word SMALL.
Solution: Sort the \(5\) letters alphabetically: A, L, L, M, S.
- Position 1 (
S): Remaining multiset is{A, L, L, M, S}(Lrepeated twice). There are \(4\) letters strictly beforeS(A, L, L, M), giving \(\frac{4 \times 4!}{2!} = 48\) preceding words. (Check directly: starting withAgives \(\frac{4!}{2!} = 12\); starting withLgives \(4! = 24\); starting withMgives \(\frac{4!}{2!} = 12\); and \(12 + 24 + 12 = 48\).) LockS. - Position 2 (
M): Remaining{A, L, L, M}(Lrepeated twice). Three letters precedeM(A, L, L), giving \(\frac{3 \times 3!}{2!} = 9\) words. LockM. - Position 3 (
A): Remaining{A, L, L}; \(0\) letters precedeA\(\implies 0\). LockA. - Position 4 (
L): Remaining{L, L}; \(0\) letters precedeL\(\implies 0\). LockL. - Position 5 (
L): \(0\).
Adding \(1\) for SMALL itself:
Example 5 (Multiple Repeated Letters — BANANA): Find the dictionary rank of the word BANANA.
Solution: Sort the \(6\) letters alphabetically: A, A, A, B, N, N.
- Position 1 (
B): Remaining{A, A, A, B, N, N}(\(3\)A's, \(2\)N's). OnlyAprecedesB(\(3\) copies), giving \(\frac{3 \times 5!}{3!\,2!} = 30\) words (starting withA, the remaining{A, A, B, N, N}permute in \(\frac{5!}{2!\,2!} = 30\) ways). LockB. - Position 2 (
A): Remaining{A, A, A, N, N}; \(0\) letters precedeA\(\implies 0\). LockA. - Position 3 (
N): Remaining{A, A, N, N}(\(2\)A's, \(2\)N's). TwoA's precedeN, giving \(\frac{2 \times 3!}{2!\,2!} = 3\) words. LockN. - Position 4 (
A): Remaining{A, A, N}; \(0\) letters precedeA\(\implies 0\). LockA. - Position 5 (
N): Remaining{A, N}. OneAprecedesN, giving \(1 \times 1! = 1\) word (BANANAis preceded byBANAAN). LockN. - Position 6 (
A): \(0\).
Adding \(1\) for BANANA itself:
Partial Permutations of Non-Distinct Objects
What if we do not use all letters of a multiset, and instead ask for the number of \(r\)-permutations (say, \(4\)-letter words) formed from a multiset like MISSISSIPPI?
Here there is no single elementary closed-form formula, because different letters have different supply limits. (In a later chapter, Exponential Generating Functions provide a general algebraic engine for this problem.) With our current tools, the clean, rigorous method is to partition all \(r\)-letter words into mutually exclusive, exhaustive cases based on how many distinct letters appear and how often they repeat, then add the cases.
Example 6 (Four-Letter Words from MISSISSIPPI): How many distinct \(4\)-letter words can be formed using the letters of MISSISSIPPI?
Solution: Our available multiset is \(\{1 \cdot \text{M},\; 4 \cdot \text{I},\; 4 \cdot \text{S},\; 2 \cdot \text{P}\}\) (\(4\) distinct letter types). Partition all \(4\)-letter words by the number of distinct letters they contain:
Case I (All \(4\) letters distinct — pattern \(1 + 1 + 1 + 1\)): There are only \(4\) distinct letter types in total (M, I, S, P), so we must use one of each. They permute in:
Case II (Exactly \(3\) distinct letters — pattern \(2 + 1 + 1\)): One letter must appear twice, and two other letters once each.
- Only
I,S, andPhave at least \(2\) copies, so choose the repeating letter in \(\binom{3}{1} = 3\) ways. - Choose \(2\) other distinct letters from the remaining \(3\) letter types in \(\binom{3}{2} = 3\) ways.
- Arrange the \(4\) selected letters (one repeated twice) in \(\frac{4!}{2!\,1!\,1!} = 12\) ways.
Total words in Case II:
Case III (Exactly \(2\) distinct letters): Two letters forming a \(4\)-letter word can repeat in two disjoint ways—either both appear twice (\(2 + 2\)), or one appears three times and the other once (\(3 + 1\)).
- Subcase IIIa (Pattern \(2 + 2\)):
Mcannot be used (only \(1\) copy available). Choose \(2\) letter types from{I, S, P}in \(\binom{3}{2} = 3\) ways, and arrange them in \(\frac{4!}{2!\,2!} = 6\) ways:
- Subcase IIIb (Pattern \(3 + 1\)): Only
IandShave at least \(3\) copies. Choose the triply repeated letter in \(\binom{2}{1} = 2\) ways, choose \(1\) other distinct letter from the remaining \(3\) types in \(\binom{3}{1} = 3\) ways, and arrange in \(\frac{4!}{3!\,1!} = 4\) ways:
Total words in Case III \(= 18 + 24 = 42\).
Case IV (Only \(1\) distinct letter — pattern \(4\)): The single letter must repeat \(4\) times. Only I and S have \(4\) copies, giving \(\binom{2}{1} \times \frac{4!}{4!} = 2\) words (IIII and SSSS).
By the Addition Principle, summing all four disjoint, exhaustive cases:
Example 7 (Four-Letter Words from EXAMINATION): How many distinct \(4\)-letter words can be formed using the letters of EXAMINATION?
Solution: The multiset is \(\{2 \cdot \text{A},\; 2 \cdot \text{I},\; 2 \cdot \text{N},\; 1 \cdot \text{E},\; 1 \cdot \text{X},\; 1 \cdot \text{M},\; 1 \cdot \text{T},\; 1 \cdot \text{O}\}\). There are \(8\) distinct letter types; \(3\) types (A, I, N) appear twice, and no letter appears \(3\) or more times. Thus only three patterns are possible:
- Pattern \(1 + 1 + 1 + 1\): \(\binom{8}{4} \times 4! = 70 \times 24 = 1680\).
- Pattern \(2 + 1 + 1\): \(\binom{3}{1} \times \binom{7}{2} \times \frac{4!}{2!} = 3 \times 21 \times 12 = 756\).
- Pattern \(2 + 2\): \(\binom{3}{2} \times \frac{4!}{2!\,2!} = 3 \times 6 = 18\).
Total \(4\)-letter words \(= 1680 + 756 + 18 = 2454\).
Permutations with Unlimited Repetition
In many situations, copies of every distinct object are available in unlimited (infinite) supply. We denote such a multiset by:
Suppose we arrange objects from \(A\) into \(k\) distinct fixed places. Because each type can be reused freely, the first place can be filled in \(n\) ways, the second place in \(n\) ways, ..., and the \(k\)-th place in \(n\) ways independently.
Theorem (Permutations with Unlimited Repetition): The number of \(k\)-permutations of \(n\) distinct types of objects when each type may be repeated any number of times is:
Example 8: How many \(5\)-digit numbers can be formed using the digits \(\{0, 1, 2, 3, 4, 5\}\) if repetition of digits is allowed and the number must be divisible by \(5\)?
Solution:
- Ten-thousands place: \(5\) choices (\(1, 2, 3, 4, 5\); cannot be \(0\)).
- Thousands, hundreds, and tens places: \(6\) choices each (all digits allowed with repetition).
- Units place: \(2\) choices (\(0\) or \(5\), for divisibility by \(5\)).
By the Multiplication Principle, there are \(5 \times 6^3 \times 2 = 2160\) such numbers.
Example 9 (Ship Signals): A ship carries an unlimited supply of red, blue, and green signal flags. How many distinct vertical signals can be hoisted using at least \(1\) and at most \(4\) flags?
Solution: Partition by the exact number of flags hoisted (\(k = 1, 2, 3, 4\)). A vertical signal of \(k\) flags can be formed in \(3^k\) ways. By the Addition Principle:
Summary Table
| Problem Type | Formula / Method | Key Detail |
|---|---|---|
| Full permutation of multiset \(\{n_1 \cdot a_1, \dots, n_k \cdot a_k\}\) | \(\frac{n!}{n_1!\,n_2!\,\cdots\,n_k!}\) (\(n = \sum n_i\)) | Divide \(n!\) by the factorial of each multiplicity |
| \(r\)-permutation of finite multiset | Partition by frequency patterns of \(r\) | Select letter types per pattern, then arrange via multiset formula |
| \(k\)-permutation with unlimited repetition | \(n^k\) | Each of \(k\) positions has \(n\) independent choices |
| No two identical objects adjacent | Arrange remaining objects, then choose gaps with \(\binom{g}{m}\) | Use \(\binom{g}{m}\), not \({}^g P_m\), because identical copies are indistinguishable |
| Fixed relative order among \(m\) objects | Replace those \(m\) objects by \(m\) identical tokens □ |
Only \(1\) way to fill the □ slots in the required order |
