Counting distinct arrangements when labels repeat
When some labels are identical, swapping them does not produce a new visible arrangement. This guide shows how to start from the full factorial count and divide out the duplicates, using the five labels A, A, B, B, C.
The problem with counting copies as different
Five distinct objects can be placed in a row in 5 factorial ways, which is 120. That count is correct when every object is individually recognizable. The trouble starts when the labels on the objects repeat and you only care about the sequence of labels you can see. The strings AABBC and AABBC are the same string even if the first A was originally the left copy and the second A the right copy. A raw factorial treats those two situations as different orders, so it counts the same visible string more than once. The task is therefore to count how many times each visible string was counted, and divide that multiplicity out. This guide works through the labels A, A, B, B, C because the multiplicity is easy to see, then applies the same reasoning to longer words where listing is impractical.
Counting the duplicates for A, A, B, B, C
Start with the 120 orders obtained by pretending the two A copies and the two B copies are different. Pick any visible string, such as ABACB. Swap the two A copies and you get a different ordering of the labeled objects that produces the same visible string. Swap the two B copies and the same thing happens. Doing both swaps gives a third variation. Counting the original too, there are 2 times 2, which is 4 labeled orders behind every visible string. The single C has no partner, so it adds a factor of 1. Dividing 120 by 4 gives 30 distinct strings. The Permutation calculator supplies the 120 with n equal to 5 and r equal to 5, and the Basic calculator does the division, which is why the worked cases show exactly those two steps.
The general rule with factorials
The pattern generalizes cleanly. If a collection has n objects and the labels repeat with counts k1, k2, and so on, the number of distinct arrangements is n factorial divided by the product of each count factorial. For A, A, B, B, C that is 5! divided by (2! times 2! times 1!), which is 120 divided by 4. The factorial of each count is the number of ways to reorder the identical copies among themselves. Notice that the rule uses the multiplicity of every label, including labels that appear once, since 1 factorial is 1 and changes nothing. It does not use the number of label types. A common slip is to divide by 3, because there are three different letters. That gives 40, which looks plausible and is wrong. The divisor must come from the counts, so it is 2 times 2 times 1.
An alternative derivation by choosing positions
A second route reaches the same answer and often feels more natural. Choose which positions the A labels occupy, then which of the remaining positions the B labels occupy, and the last position is forced to hold C. Choosing 2 positions out of 5 for the A copies can be done in C(5,2), which is 10 ways. Of the 3 positions left, choosing 2 for the B copies gives C(3,2), which is 3 ways. The final position goes to C in 1 way. Multiplying 10 times 3 times 1 gives 30, matching the factorial division. This approach scales well to words with many repeated letters, because each step is a combination count, and it makes it obvious why the result must be a whole number. If you ever get a fraction from the factorial formula, an input count is wrong.
A longer word as a practical test
Consider the word BANANA, which has 6 letters: B once, A three times and N twice. The raw count of 6 factorial is 720. The repeated A copies can be reordered in 3 factorial, or 6, ways, and the N copies in 2 factorial, or 2, ways, so each visible word was counted 6 times 2 times 1, or 12 times. Then 720 divided by 12 equals 60 distinct arrangements of the letters. A longer example is MISSISSIPPI, with 11 letters: M once, I four times, S four times and P twice. The raw count is 11 factorial, which is 39,916,800. The duplicates factor is 4! times 4! times 2! times 1!, which is 24 times 24 times 2, or 1,152. Dividing gives 34,650 distinct arrangements. The Basic calculator can do both divisions, once you have the factorial values.
Adding a condition: keeping two labels together
Real problems often add a restriction, and the repeated-label correction still applies. Suppose the two A labels in A, A, B, B, C must sit side by side. Treat the adjacent pair AA as a single block. You now arrange four items: the block, B, B and C. The two B copies are still identical, so the count is 4 factorial divided by 2 factorial, which is 24 divided by 2, or 12. There is only one way to order the two identical A copies inside the block, so no further factor is needed. Of the 30 distinct strings, exactly 12 have the A labels adjacent. The remaining 18 strings, found by subtracting, have them separated. Checking a restricted count against the unrestricted total in this way is a good habit, because the restricted answer can never exceed the full count of 30.
When identical labels still need to be distinguished
The division is justified only when the labels are truly indistinguishable for the purpose of the question. Two coins of the same type placed in a row are interchangeable, and swapping them changes nothing you could observe. Two people who happen to wear the same color shirt are not interchangeable, because the question probably cares who stands where. In that case the 5 factorial count is the right one even though the shirts match. The same distinction appears with tickets, seats and assigned tasks. Ask whether a swap of two equal-looking items would be detected by the person receiving the result. If yes, keep the items distinct. If no, divide. When a problem statement says objects are identical, indistinguishable or of the same kind, that wording is the signal to divide, and when it names individuals, it is the signal to keep the full factorial.
Using the calculators for the checks
The worked cases split the problem into two clear steps, which suits a calculator. The Permutation calculator evaluates P(n, r) equal to n factorial divided by (n minus r) factorial, so with n and r both 5 it returns 120, the number of orders if every object were different. The Basic calculator then divides by the duplicates factor of 4 to get 30. For BANANA you would enter n and r as 6 to get 720, then divide by 12 for 60. For MISSISSIPPI, the permutation count with n and r both 11 returns 39,916,800, and a division by 1,152 gives 34,650. Keep the intermediate factors written next to each step. If you only record the final answer, it is difficult to see afterward whether the divisor was built from the counts or from the number of letter types.
Sanity checks before trusting the result
A few quick tests catch most errors. The number of distinct arrangements can never exceed the factorial of the total count, so for five labels the answer must be at most 120. It must also be at least 1, and it equals 1 only when all labels are identical. The divisor must be an integer that divides the factorial exactly, since each visible string corresponds to a whole number of labeled orders. Finally, the sum of the counts of repeated labels must equal n. In A, A, B, B, C the counts 2, 2 and 1 add to 5, which matches the five positions. If the counts add to 4 or 6, a label was dropped or counted twice, and the division would produce a number that refers to a different word than the one you meant to arrange.
Fixing one label in place
Fixing a position is a quick way to verify the total. Place the single C at the end of the row. The remaining four positions hold A, A, B, B, and the number of distinct strings is 4 factorial divided by (2 factorial times 2 factorial), which is 24 divided by 4, or 6. By the same argument, C could sit in any of the five positions, and each choice leaves the same four labels to arrange, so there are 5 times 6, or 30 strings in total. That matches the earlier count and shows the divisor from a different angle. This decomposition is useful when a question asks for arrangements with a particular label in a particular place, such as a string that must start with A. Fix the A at the front, leaving A, B, B, C for the other four positions. That gives 4 factorial divided by 2 factorial, or 12 strings out of the 30.
Where this counting shows up
The same division appears in many settings that do not look like word puzzles. A binary string with three ones and two zeros is an arrangement of the labels 1, 1, 1, 0, 0, so there are 5 factorial divided by (3 factorial times 2 factorial), which is 10 of them. A path across a grid that takes four steps right and three steps up is an arrangement of seven moves with repeated labels, giving 7 factorial divided by (4 factorial times 3 factorial), or 35 distinct routes. A rota that places three identical morning shifts and two identical evening shifts across five slots has the same count as the binary string. Whenever there are exactly two kinds of label, the division is the binomial coefficient, and with three or more kinds it is called a multinomial coefficient. Recognizing the shape of the problem lets you reuse the same structure.
Reproduce the checks
Initially distinct-copy orders
Open the Permutation calculator and enter:
- Total items n
5- Positions r
5
Expected output:
Permutations
120This temporary count distinguishes the copies.
Remove repeated-label duplicates
Open the Basic calculator and enter:
- First number
120- Operation
divide- Second number
4
Expected output:
Result
30The two repeated pairs supply a factor of four.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.