Sub topic 6
Arranging Items When Some Are Identical
This chapter assumes you can compute factorials, you know that n! counts the ways to order n distinct items, and you can use the multiplication principle. If any of that feels shaky, review the chapters on counting principles, factorials, and permutations first.
Why identical items change the count
Suppose you arrange the letters of the word CAT. All three letters are different, so there are 3! = 6 arrangements. Now arrange the letters of the word TOO. There are only 3 distinct results: TOO, OTO, OOT.
The formula 3! = 6 overcounts here. If you swap the two O's, you get the same word. The factorial treats the two O's as different objects, so it counts each real arrangement more than once.
The fix is to divide out the extra copies. That is the whole idea of this chapter.
The core formula
Suppose you have n items in total. Suppose one kind of item appears k₁ times, another kind appears k₂ times, and so on. The number of distinct arrangements in a row is:
n! / (k₁! × k₂! × ...)
Items that appear only once contribute 1! = 1, so you can leave them out of the denominator.
Why the division works
Take the word TOO again. Label the O's as O₁ and O₂ so they look different. Now there are 3! = 6 arrangements:
| Labeled arrangement | Real word |
|---|---|
| T O₁ O₂ | TOO |
| T O₂ O₁ | TOO |
| O₁ T O₂ | OTO |
| O₂ T O₁ | OTO |
| O₁ O₂ T | OOT |
| O₂ O₁ T | OOT |
Each real word shows up exactly 2 times, because the two O's can be ordered in 2! = 2 ways. So the count of real words is 6 / 2 = 3.
The same logic works in general. For each real arrangement, a group of k identical items can be shuffled among themselves in k! ways. Every real arrangement is counted k! times in n!. Dividing by k! removes that duplication. When several kinds repeat, you divide once for each kind, because the shuffles within each kind happen independently.
Worked example: BANANA
How many distinct arrangements are there of the letters in BANANA?
- Count the letters: there are 6.
- Count the repeats: B appears 1 time, A appears 3 times, N appears 2 times.
- Apply the formula: 6! / (3! × 2!) = 720 / (6 × 2) = 720 / 12 = 60.
You can check this in code.
import math
# Distinct arrangements of the letters in BANANA (B once, A three times, N twice)
print(math.factorial(6) // (math.factorial(3) * math.factorial(2))) # 60On the GRE you do not have this tool, so practice simplifying by hand. Cancel before multiplying: 6!/(3! × 2!) = (6 × 5 × 4 × 3!)/(3! × 2!) = (6 × 5 × 4)/2 = 60. Cancelling the larger factorial in the denominator keeps the numbers small.
A general helper you can run
The formula is easy to wrap in a small function. This version counts the repeats automatically from a string, so you can test your hand calculations.
import math
from collections import Counter
def distinct_arrangements(items):
"""Return the number of distinct orderings of a sequence with repeats."""
counts = Counter(items)
result = math.factorial(len(items))
for k in counts.values():
result //= math.factorial(k)
return result
print(distinct_arrangements("BANANA")) # 60
print(distinct_arrangements("MISSISSIPPI")) # 34650
print(distinct_arrangements("TOO")) # 3The integer division // is safe here. Dividing n! by the factorials of the repeat counts always gives a whole number, because the result counts real arrangements. The division is done one factor at a time, and each intermediate result is still a whole number. This is because the multinomial coefficient is an integer and each partial quotient is also a multinomial-style count.
Worked example: MISSISSIPPI
MISSISSIPPI has 11 letters: M once, I four times, S four times, P twice.
The count is 11! / (4! × 4! × 2!). Simplify by hand:
- 11! = 39,916,800
- 4! × 4! × 2! = 24 × 24 × 2 = 1,152
- 39,916,800 / 1,152 = 34,650
The GRE would never expect you to compute 11! in full. If a question used numbers this large, the answer choices would often be written as an unevaluated expression, or the question would be set up so that most terms cancel.
Arranging with a fixed position or a restriction
Identical-item problems often add a condition. The standard approach is to handle the condition first, then arrange what remains.
Example: a fixed first letter
How many distinct arrangements of BANANA start with B?
Place B in the first position. The remaining 5 positions hold A, A, A, N, N. The count is 5! / (3! × 2!) = 120 / 12 = 10.
Example: keeping identical items together
How many distinct arrangements of BANANA keep all three A's together?
Glue the three A's into one block, written [AAA]. Now you are arranging the items B, N, N, and [AAA]. That is 4 items with N repeated twice. The count is 4! / 2! = 24 / 2 = 12.
The block itself has only one internal ordering, because its letters are identical. If the glued items were distinct, you would also multiply by the number of orderings inside the block.
Example: separating identical items
How many arrangements of BANANA have no two A's next to each other?
Use the complement idea from a later chapter, or place the non-A letters first. The non-A letters are B, N, N. They can be arranged in 3! / 2! = 3 ways. Each arrangement of those 3 letters creates 4 gaps, counting both ends. Choose 3 of the 4 gaps to receive one A each, which can be done in C(4, 3) = 4 ways. The total is 3 × 4 = 12.
Because the A's are identical, choosing which gaps get an A is a combination. There is no extra ordering to count.
Identical items in a path or sequence problem
The same formula handles paths on a grid. To walk from the bottom-left corner of a grid to a point 3 steps right and 2 steps up, you take 5 steps. Three of them are R (right) and two are U (up). Each distinct path is a distinct arrangement of the letters RRRUU.
The count is 5! / (3! × 2!) = 10.
This is also C(5, 2) = 10. The two views agree. Choosing which 2 of the 5 step positions are U is the same as arranging the letters. For two kinds of items, the arrangement formula and the combination formula are the same number.
import math
# Paths with 3 right steps and 2 up steps
print(math.factorial(5) // (math.factorial(3) * math.factorial(2))) # 10
print(math.comb(5, 2)) # 10Common errors
- Forgetting to divide at all. Writing 6! = 720 for BANANA treats the repeated letters as different. Always scan for repeats before you compute.
- Dividing by the repeat count instead of its factorial. For 3 identical A's, divide by 3!, not by 3. The number of shuffles of k identical items is k!.
- Dividing by single items. Items that appear once give 1!, which is 1. Including them does no harm, but you do not need them.
- Mixing up the total. The n in n! is the total number of items, counting repeats. In BANANA, n is 6, not 3.
- Applying the formula to a selection problem. If you are choosing a subset of the letters and not using all of them, this formula does not apply directly. You must split into cases by which letters are chosen.
- Treating "identical" as a property of the letters on the page. Two people with the same name are still different people. Only apply the division when the problem says the items are indistinguishable, such as identical books, same-colored balls, or repeated letters.
A selection example that needs cases
How many distinct 3-letter strings can be made from the letters of BANANA, using each letter no more times than it appears?
Split by the letter pattern:
| Pattern | Letters used | Count |
|---|---|---|
| All different | B, A, N | 3! = 6 |
| Two alike, one different | AA with B, or AA with N | 2 × (3! / 2!) = 6 |
| Two alike, one different | NN with B, or NN with A | 2 × (3! / 2!) = 6 |
| Three alike | AAA | 1 |
The total is 6 + 6 + 6 + 1 = 19.
You can confirm it by brute force.
from itertools import permutations
letters = "BANANA"
unique_strings = {"".join(p) for p in permutations(letters, 3)}
print(len(unique_strings)) # 19Notice that this problem uses all four sources of structure at once: cases, the multiplication principle, the repeat formula, and a check by direct enumeration. When a GRE question looks complicated, a short case split like this is often the cleanest route.
Checking your answer
A good habit is to test the formula on a tiny version of the problem. For BANANA, consider just AAN. Listing by hand gives AAN, ANA, NAA, which is 3. The formula gives 3! / 2! = 3. If the tiny case works, the method is set up correctly.
Also check reasonableness. The answer with repeats must be smaller than n!, and it must be a whole number. If your result is larger than n! or is a fraction, you have inverted the fraction or divided by the wrong thing.
Exercise
How many distinct arrangements are there of the letters in the word LETTER?
Show answer
LETTER has 6 letters: L once, E twice, T twice, R once. The count is 6! / (2! × 2!) = 720 / 4 = 180.
Exercise
How many distinct arrangements of the letters in BANANA begin with an N?
Show answer
Put N first. The remaining letters are B, A, A, A, N, which is 5 letters with A repeated 3 times. The count is 5! / 3! = 120 / 6 = 20.
Exercise
A shelf will hold 4 identical red books and 3 identical blue books in a row. How many different color patterns are possible?
Show answer
There are 7 books in total, with 4 of one kind and 3 of the other. The count is 7! / (4! × 3!) = 5040 / 144 = 35. This also equals C(7, 3) = 35.
Exercise
How many distinct arrangements of the letters in MOON have the two O's next to each other?
Show answer
Glue the O's into one block [OO]. Now arrange M, N, and [OO], which are 3 distinct items. The count is 3! = 6.