Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Permutations with Identical Items


Press ▶ Play to build all n! / (k₁!·k₂!·…) distinct arrangements of the chosen multiset, or Step ▶ to advance one ball at a time. Cycle the multiset to try different duplicate patterns.
● BallsA Letters
multiset =AAB?
Speed
3!/(2! · 1!) = 3Press Play or Step to beginSOURCE — MULTISET AAB (n = 3)112BUILD AREA#1#2#3
Permutations with identical items
3! / (2! · 1!) = 3
Arrange a multiset of n items where some are identical. Swapping two copies of the same item doesn't produce a new arrangement, so we divide the total n! by k! for each group of identical copies.
The multiset waits in the source row — duplicates drawn side by side, slots empty below. The count is already fixed by the letter multiplicities. Learn more about getting started · All multisets





Key Terms



Key Terms

Multiset — a collection of items where some may be identical. Unlike a set, a multiset records how many copies of each item are present. In this tool the multiset is encoded as a string like *AABBC*.

Permutation with identical items — a distinct arrangement of a multiset in a line. Swapping two identical copies does not produce a new permutation. The count is n!/(k1!k2!)n! / (k_1! \cdot k_2! \cdots) where each kik_i is the size of an identical group.

Multinomial coefficient — the formula (nk1,k2,)=n!/(k1!k2!)\binom{n}{k_1, k_2, \dots} = n! / (k_1! \cdot k_2! \cdots). The generalization of the binomial coefficient to more than two groups.

Distinct first item — a unique item value in the multiset. The completed section groups arrangements by which distinct item appears in position #1\#1, so there is one group per distinct item, not one per source position.

Positional dimming — the source row shows every copy in its own position. When a copy is used in the current build, only that position dims — the other copies of the same item stay fully visible.

Group size — the number of distinct arrangements in a first-item group. With kik_i copies of the chosen first item, that count is (n1)!/((ki1)!jikj!)(n - 1)! / ((k_i - 1)! \cdot \prod_{j \neq i} k_j!), which varies between groups.

Getting Started

The tool opens with multiset *AAB* selected: two copies of AA and one copy of BB. The scene splits into three areas:

• A source row at the top showing the multiset as separate balls, including duplicates side by side.

• A build area in the middle with nn slots, where nn is the total size of the multiset (counting duplicates).

• A completed section below, where every finished distinct permutation is filed under the row matching its first item.

To run the visualization:

• Press ▶ Play to auto-build all distinct permutations of the current multiset.

• Press Step ▶ to advance one ball at a time.

• Press to step backward through the animation.

• Adjust the Speed slider to control how fast play advances.

The header shows the formula n!/(k1!k2!)=totaln! / (k_1! \cdot k_2! \cdots) = \text{total} together with a live status line like *Group A: kk / size* while building.
3!/(2! · 1!) = 3Press Play or Step to beginSOURCE — MULTISET AAB (n = 3)112BUILD AREA#1#2#3
AAB, idle, frozen

Two red A balls, one blue B, three dashed slots: the smallest multiset, waiting. The copies are drawn apart but will be counted as one.

The frozen frame above is the opening position for the default multiset: two red A balls side by side, one blue B, three dashed slots. Already the central subtlety is on display — the two A balls are drawn as separate objects even though, mathematically, they are the same letter.

That tension is the whole subject. The tool draws copies separately so you can watch them move, then counts as if they were indistinguishable — the reconciliation is the division explained under why divide by k!.

The Build Area

The build area is where one distinct permutation at a time is constructed. The label above the area simply reads *BUILD AREA*; the slot count equals the size of the chosen multiset.

What to watch:

Empty slot outlines with dashed borders, labeled #1,#2,,#n\#1, \#2, \dots, \#n from left to right.

• When a ball is in flight from the source row to a slot, a dotted guide line traces the trajectory in the color of the item being moved.

• Each ball lands in its assigned slot and stays put until the permutation completes.

• In the source row, only the specific copy being used dims — not every copy of that item. So when one of the two AA balls flies into a slot, the other AA stays bright. This is the visual signature of positional dimming.

• When all nn slots are filled, a flash ring briefly pulses around the build area, and the completed arrangement is filed in the appropriate first-item row below.
3!/(2! · 1!) = 3Group Red: 1 / 2SOURCE — MULTISET AAB (n = 3)112BUILD AREA#1#2#312COMPLETED1 / 31112
AAB mid-build, frozen

A has landed in slot #1 and its own source copy dims — but its identical twin stays bright. B rides the dotted guide toward slot #2.

The frozen frame above shows positional dimming doing its job: A has landed in slot #1 and its source copy is dimmed, B is mid-flight along its dotted guide — but the second A is still bright, because that particular copy has not been used.

Positional dimming is the honest way to animate a multiset: the tool must move one specific ball, even though the mathematics does not care which A it was. Every arrangement the build produces would look identical if the two A copies swapped roles — exactly the redundancy the formula divides away.

The Multiset Stepper

Instead of an nn stepper, this tool has a multiset stepper that cycles through six curated presets, increasing in complexity:

AAB — two of AA, one of BB. 3!/(2!1!)=33! / (2! \cdot 1!) = 3 distinct permutations.

AAAB — three of AA, one of BB. 4!/(3!1!)=44! / (3! \cdot 1!) = 4 permutations.

AABB — two each of AA and BB. 4!/(2!2!)=64! / (2! \cdot 2!) = 6 permutations.

AABC — two of AA, one each of BB and CC. 4!/(2!1!1!)=124! / (2! \cdot 1! \cdot 1!) = 12 permutations.

AAABB — three of AA, two of BB. 5!/(3!2!)=105! / (3! \cdot 2!) = 10 permutations.

AABBC — two each of AA and BB, one of CC. 5!/(2!2!1!)=305! / (2! \cdot 2! \cdot 1!) = 30 permutations.

Use the and buttons next to *multiset =* to cycle. Each preset resets the build, refreshes the formula in the header, and rebuilds the completed section into the new set of first-item rows.

AAB: The Smallest Multiset

The opening preset is the smallest multiset with a genuine duplicate: two copies of AA and one BB. Its three distinct arrangements can be written out faster than any formula: AABAAB, ABAABA, BAABAA.

The formula agrees: 3!/(2!1!)=6/2=33! / (2! \cdot 1!) = 6 / 2 = 3. Without the division, the six tagged permutations of A1A2BA_1 A_2 B would each be counted — but A1A2BA_1 A_2 B and A2A1BA_2 A_1 B are the same word once the tags come off.

Three is also the count of *positions the single BB can occupy* — last, middle, or first. With only one non-duplicate letter, the whole arrangement is determined by where that letter sits.
3!/(2! · 1!) = 3Complete · 3 / 3SOURCE — MULTISET AAB (n = 3)112BUILD AREA#1#2#3COMPLETED3 / 311121212211
AAB complete, frozen

Three cards in two unequal rows: AAB and ABA under the A group, BAA alone under B — 3!/2! = 3, checkable by hand.

The frozen run above shows the tool's two unequal groups: the AA-first row holds AABAAB and ABAABA, the BB-first row holds only BAABAA. Starting with the duplicate leaves a mixed pair to arrange two ways; starting with BB leaves the identical pair AAAA, which can be "arranged" in exactly one.

Being fully enumerable by hand makes this the preset to verify against. Every claim on this page — the group sizes, the positional dimming, the division — can be checked here in seconds before the larger presets put it beyond patience.

AAAB: Placing the Single B

Three copies of AA and a single BB: 4!/(3!1!)=44! / (3! \cdot 1!) = 4 distinct arrangements — AAABAAAB, AABAAABA, ABAAABAA, BAAABAAA.

The count equals the number of slots the lone BB can occupy, and that is no coincidence: when a multiset has just one letter that differs, an arrangement carries no information beyond *where the odd one out went*. Four positions, four arrangements.

Watch the group structure: the AA-first row holds three arrangements (the BB still has three slots left to choose from), while the BB-first row holds exactly one — BAAABAAA, with all decisions already made.
4!/(3! · 1!) = 4Complete · 4 / 4SOURCE — MULTISET AAAB (n = 4)1112BUILD AREA#1#2#3#4COMPLETED4 / 4111121121121122111
AAAB complete, frozen

Four arrangements, one per possible home of the single B. The A-first row holds three; the B-first row is a row of one.

This preset is the cleanest bridge to combinations: "choose which 1 of the 4 positions holds BB" is (41)=4\binom{4}{1} = 4. The multinomial 4!/(3!1!)4!/(3! \cdot 1!) and the binomial (41)\binom{4}{1} are the same number wearing different notation — a coincidence that becomes a theorem in the two-letter preset AAABB.

Try predicting before pressing Play: which group will fill first, and how large will each be? The frozen frame above is the answer key.

AAABB: Two Letters, Ten Arrangements

Three AAs and two BBs give 5!/(3!2!)=120/12=105! / (3! \cdot 2!) = 120 / 12 = 10 distinct arrangements — the largest two-letter preset in the stepper.

Ten should ring a bell: (52)=10\binom{5}{2} = 10 as well. With exactly two distinct letters, arranging the multiset is the same act as *choosing which positions get the* BB*s* — order inside each letter group is meaningless, so only the choice of positions matters. Every two-letter multiset permutation is secretly a binomial coefficient:

n!k!(nk)!=(nk)\frac{n!}{k! \cdot (n-k)!} = \binom{n}{k}


The group split is 6+46 + 4: starting with AA leaves AABBAABB (six ways), starting with BB leaves AAABAAAB (four ways) — both remainders being smaller presets from this very stepper.
5!/(3! · 2!) = 10Complete · 10 / 10SOURCE — MULTISET AAABB (n = 5)11122BUILD AREA#1#2#3#4#5COMPLETED10 / 101111221121211221121121212112211221112211212121122111
AAABB complete, frozen

Ten arrangements of three A and two B — the same ten that C(5,2) counts, since only the B positions carry information.

The recursion visible in the group sizes is worth savoring: the AA-first row is exactly the AABB preset shifted one slot right, and the BB-first row is the AAAB preset. Multiset permutations decompose into smaller multiset permutations, just as n!n! decomposed into first-item families for distinct items.

This preset is also the page's binomial ambassador: any time you compute (nk)\binom{n}{k}, you are counting the arrangements of a two-letter multiset with kk of one letter and nkn - k of the other.

AABBC: The Longest Run

The final preset has five items in three groups — two AAs, two BBs, one CC — and produces the stepper's largest count: 5!/(2!2!1!)=120/4=305! / (2! \cdot 2! \cdot 1!) = 120 / 4 = 30 distinct arrangements.

Thirty is small enough to enumerate on screen but large enough that the structure, not the list, is what you remember. The three first-item rows hold 12+12+612 + 12 + 6 arrangements: starting with AA or BB leaves one duplicate pair intact (ABBCABBC or AABCAABC-type remainders, twelve ways each), while starting with CC leaves both pairs AABBAABB — the most collapsible remainder, six ways.

The denominator 2!2!1!=42! \cdot 2! \cdot 1! = 4 means each card on screen quietly stands for four tagged permutations of the 120 total.
5!/(2! · 2! · 1!) = 30Complete · 30 / 30SOURCE — MULTISET AABBC (n = 5)11223BUILD AREA#1#2#3#4#5COMPLETED30 / 30111223112321132212123121321221312231123121232113122132121322122112321132212132123121312213212211322131223112311223121232113311223121231221321123212132211
AABBC complete, frozen

The longest run: thirty cards in rows of 12, 12, and 6, each card silently standing for four of the 120 tagged permutations.

A full Play run of this preset is the page's best show: thirty completions, three rows filling at different rates, and the counter climbing to the multinomial total. If the smaller presets proved the formula, this one demonstrates its economy — nobody wants to hand-list thirty words to learn what 120/4120 / 4 already says.

For genuinely large multisets the tool bows out and the formula alone remains: MISSISSIPPI's 34,65034{,}650 arrangements, computed under what is a permutation with identical items, would need a screen four hundred times taller.

Grouping by Distinct First Item

The completed section organizes permutations into distinct first-item groups — one row per distinct value in the multiset, not one per source position. So *AAB* has two groups (AA and BB), not three.

Group sizes vary because the remaining multiset depends on which item was used first. For example with *AABB*:

• Starting with AA: remaining multiset is ABBABB, giving 3!/(1!2!)=33! / (1! \cdot 2!) = 3 arrangements.

• Starting with BB: remaining multiset is AABAAB, also giving 3!/(2!1!)=33! / (2! \cdot 1!) = 3 arrangements.

For *AABC*:

• Starting with AA: remaining is ABCABC (no repeats), giving 3!=63! = 6 arrangements.

• Starting with BB: remaining is AACAAC, giving 3!/2!=33! / 2! = 3.

• Starting with CC: remaining is AABAAB, giving 3!/2!=33! / 2! = 3.

This is why each row in the completed area has its own height — the tool computes a separate row size per group to keep proportions clean. The total across all groups always equals the multinomial coefficient n!/(k1!k2!)n! / (k_1! \cdot k_2! \cdots).
4!/(2! · 1! · 1!) = 12Complete · 12 / 12SOURCE — MULTISET AABC (n = 4)1123BUILD AREA#1#2#3#4COMPLETED12 / 12111231132121312311312132122113213123113311231213211
AABC complete, frozen

Twelve cards in unequal rows of 6, 3, and 3: starting with the duplicate A frees the remainder; starting with B or C leaves the pair AA to collapse.

The frozen frame above is *AABC* complete, and the unequal rows tell the story at a glance: the AA row holds six cards while the BB and CC rows hold three each. Starting with AA uses up one of the duplicates and leaves three distinct letters — the freest possible remainder — while starting with BB or CC leaves the pair AAAA intact to keep collapsing arrangements.

Unequal group sizes are the feature that separates this tool from the full permutation's perfectly even rows: with duplicates, symmetry among first choices is broken by what each choice leaves behind. Adding down the rows — 6+3+3=126 + 3 + 3 = 12 — recovers the multinomial total.

Transport Controls

The control bar offers four transport buttons plus a speed slider:

(Step back) — walks the animation one step backward. Useful for re-examining a single arrangement or pausing mid-build.

Step ▶ (Step forward) — advances one ball into one slot. Stop after each step to read the partial arrangement.

▶ Play / ⏸ Pause — runs the animation continuously until all distinct permutations are built, then auto-pauses.

↺ Reset — clears the completed section and starts over from the first arrangement.

The Speed slider controls how fast play advances. At higher speeds the fly and land timings shrink proportionally; at slower speeds you can clearly see each ball travel from its source position to the assigned slot.

Mode Switch

The Mode switch at the start of the control bar toggles how each item is rendered:

Balls mode (default) — items appear as colored circles. Identical copies share the same color, so the multiset *AABB* shows two circles of one color and two of another. The first-item avatar in each completed group is a circle with the item's number.

Letters mode — items appear with letter labels (A, B, C, …). The multiset display becomes literal — *AABB* shows as A,A,B,BA, A, B, B in the source row. The first-item avatar in each completed group is just the letter, colored to match.

The encoding is consistent across the source row, the build slots, the flying ball, every mini permutation card in the completed grid, and the right-panel narration. Letters mode is especially useful for this scenario because the multiset names themselves are letter strings.

Right Panel and Progress

The right panel narrates the build as it unfolds, anchored by the header *Permutations with identical items* and the full multinomial formula for the current multiset.

A StepRow is added for each distinct first-item group as soon as a permutation in that group starts or completes. Each StepRow shows:

• The first item as a chip plus its name — for instance, *First item: A*.

• A progress counter like k/group sizek / \text{group size} tracking how many distinct permutations in this group have completed.

• A short narration of the structure: *Position 1 is locked to A. The remaining positions hold 1 A, 2 Bs, and 1 C, arranged in 4!/(1!2!1!)=124! / (1! \cdot 2! \cdot 1!) = 12 distinct ways.* The formula uses the leftover multiplicities after one copy of the first item is removed.

When all groups complete, every StepRow shows *done* with a checkmark, and the counter reaches *total / total*.

What Is a Permutation with Identical Items

A permutation with identical items is a distinct arrangement of a multiset — a collection of nn items where some are repeated. Two arrangements count as the same if they only differ by swapping copies of the same item. The number of distinct arrangements is:

n!k1!k2!km!\frac{n!}{k_1! \cdot k_2! \cdots k_m!}


where kik_i is the number of copies of the iith distinct item and k1+k2++km=nk_1 + k_2 + \dots + k_m = n. This is the multinomial coefficient (nk1,k2,,km)\binom{n}{k_1, k_2, \dots, k_m}, and the reason for the division is worked out under why divide by k!.

Examples:

• Distinct arrangements of the letters in *MISSISSIPPI* (11 letters: 1 M, 4 I, 4 S, 2 P): 11!/(1!4!4!2!)=34,65011! / (1! \cdot 4! \cdot 4! \cdot 2!) = 34{,}650.

• Distinct arrangements of the word *DATA* (4 letters with 2 A): 4!/2!=124! / 2! = 12.

• Lining up 8 students where 3 wear identical red shirts and 5 wear identical blue shirts: 8!/(3!5!)=568! / (3! \cdot 5!) = 56 distinguishable lineups.

For deeper coverage, see the permutation with identical items section on the permutations theory page.

Why Divide by k!

Start with the multiset treated as if every item were distinct — say by tagging copies A1,A2A_1, A_2 and B1,B2B_1, B_2 for *AABB*. There are n!=4!=24n! = 4! = 24 full permutations of the tagged set.

But the tags are fake. When we remove them and look at the actual multiset, many of those 2424 permutations collapse into the same arrangement:

• The two AA copies can swap in 2!=22! = 2 ways without changing what we see.

• The two BB copies can swap in 2!=22! = 2 ways without changing what we see.

• Together, 2!2!=42! \cdot 2! = 4 tagged permutations map to each distinct untagged arrangement.

So the distinct count is 24/4=624 / 4 = 6, matching the formula 4!/(2!2!)4! / (2! \cdot 2!).

Generalizing: for each identical group of size kik_i, exactly ki!k_i! tagged permutations collapse into one untagged arrangement. Dividing n!n! by the product of all such ki!k_i! removes every layer of redundancy:

distinct count=n!k1!k2!km!\text{distinct count} = \frac{n!}{k_1! \cdot k_2! \cdots k_m!}
4!/(2! · 2!) = 6Complete · 6 / 6SOURCE — MULTISET AABB (n = 4)1122BUILD AREA#1#2#3#4COMPLETED6 / 611122121212212211221212211
AABB complete, frozen

Six cards, three per row — each standing for 2!·2! = 4 invisible swaps of tagged copies. 24 tagged permutations, 6 visible words.

The frozen frame above is the argument's own example completed on screen: *AABB*, six cards, split three-and-three between the AA-first and BB-first rows. Each visible card stands for exactly four invisible tagged permutations — the 2!2!2! \cdot 2! silent swaps of the copies.

The collapse ratio is the same for every card, which is why plain division works: redundancy in this problem is perfectly uniform. Run the build and watch for repeats that never come — the enumeration simply skips arrangements it has already produced, which is division enacted rather than computed. The remaining presets scale the same idea; see the multiset stepper for the full ladder.