The ● Balls / A Letters switch at the left of the control bar draws the items as numbered coloured balls or as letter tiles A, B, C, …; the box names stay A, B, C either way. Learn more about the mode switch
Use ◀ and ▶ next to partition = to cycle through seven shapes, from 2+2 to 2+2+1; each shape clears the build and updates the formula n!/(n1!⋯nk!) at the top right of the scene. Learn more about the partition stepper
Press Step ▶ to send one ball into its slot; once every slot is full, the next press files the finished partition below. ◀ Back undoes one step. Learn more about the transport controls
▶ Play builds every partition of the current shape and stops at the end, ↺ Reset clears the completed section, and the Speed slider sets how fast the balls fly. Learn more about Play, Reset and Speed
The top right of the scene shows the formula with its value and a status line such as Item 1 in Box A: 0 / 3. Learn more about getting started
In the BUILD BOXES row each box is labelled BOX A (2), BOX B (2), … with dashed slots; balls fill Box A first, and a ring flashes around the boxes when a partition is complete. Learn more about the build boxes
The COMPLETED section files each partition as a card in the row of the box that received item 1 (→ Box A, → Box B, …), with the count of finished partitions at its right. Learn more about grouping by item-1 destination
The right panel adds one row per destination of item 1, with a counter such as 0 / 3 and the formula for that row; a ✓ marks each finished row. Learn more about the right panel
Press ▶ Play to build all n! / (n₁!·n₂!·…·nₖ!) partitions of n distinct items into k labeled boxes of fixed sizes, or Step ▶ to advance one ball at a time. Cycle the partition to try different shapes.
● BallsA Letters
partition =2+2?
Speed
Partitions into labeled groups
4! / (2! · 2!) = 6
Split n distinct items into k labeled boxes with fixed sizes (n₁, n₂, …, nₖ). The boxes are distinguishable; only which items are together in a box matters — internal order within a box doesn't. Equivalent to the multinomial coefficient.
The box sizes are fixed before any ball moves — only the assignment is in question, which is exactly what the multinomial counts. Learn more about getting started · All shapes
Partition into groups — a split of n distinct items into k labeled boxes of fixed sizes (n1,n2,…,nk) with n1+n2+⋯+nk=n. The count is n!/(n1!⋅n2!⋯nk!).
Labeled boxes — the boxes are distinguishable, named *Box A, Box B, Box C, …* in the tool. Swapping the entire contents of two boxes produces a different partition even if both boxes have the same size.
Within-box order does not matter — what counts is which items end up together in each box, not the order they appear in. Each box is treated as a set.
Partition shape — the sequence of box sizes, written like 2+2, 3+1+1, or 2+2+1. The visualizer cycles through seven curated shapes.
Item-1 destination group — the family of partitions where item 1 (the red ball) ends up in a specific box. The completed section groups results by this destination, giving k rows.
Getting Started
The tool opens with partition shape 2+2 — four items split into two boxes of two. The scene splits into three areas:
• A source row at the top showing the n available items.
• A build boxes row in the middle with k labeled boxes, each captioned *BOX A (n1), BOX B (n2), …* with the box size in parentheses.
• A completed section below, where every finished partition is filed under the row matching which box received item 1.
To run the visualization:
• Press ▶ Play to auto-build all n!/(n1!⋯nk!) partitions.
• Press Step ▶ to advance one ball at a time.
• Press ◀ to step backward through the animation.
• Adjust the Speed slider.
The header shows the multinomial formula for the current shape and a live status line such as *Item 1 in Box A: k / size*.
2+2, idle, frozen
Four bright balls above two labeled boxes of two dashed slots each: a floor plan with the room sizes fixed before anyone moves.
The frozen frame above is the opening position for the default shape: four bright balls, and below them two labeled boxes, each with two dashed slots. The build area is no longer a row — it is a floor plan, and the animation's job is to move everyone into a room.
The captions carry the constraint: BOX A (2), BOX B (2) — sizes fixed in advance. That is what separates this scenario from free distribution: the shape of the answer is decided before any ball moves; only the assignment is in question.
The Build Boxes
The build area has k separate boxes side by side, each labeled *BOX A, BOX B, BOX C, …* with the size of that box written in parentheses below the letter. What to watch:
• Box outlines in the surface color, with a stronger border that makes the boxes visually distinct from the build area as a whole.
• Dashed circle outlines inside each box mark the ni slot positions for that box.
• When a ball is in flight from the source row to a slot, a dotted guide line in that ball's color traces the trajectory. The ball may travel into any of the k boxes.
• Balls land in canonical order — the tool fills box A before box B before box C, and within each box in increasing item-id order — so equivalent partitions render the same way.
• In the source row, items already placed (or in flight) are dimmed.
• When all n slots are filled across all boxes, a flash ring briefly pulses around the entire box row, and the completed partition is filed in the right row below.
2+2 mid-build, frozen
The second partition under way: A and C settled in Box A, B riding its guide into Box B — and D still bright, its destination already forced.
The frozen frame above catches the second partition mid-build: A and C have settled into Box A, and B is riding its dotted guide into Box B — with D still bright, its destination already forced. When only one slot remains, the "choice" is no choice at all.
Watch the canonical filling discipline at work: boxes fill left to right, members ascending. Like the combination tool's smallest-first landings, this is spelling, not mathematics — a rule that makes equal partitions look equal, so the count on screen is honest.
The Partition Stepper
DemoCycling the partition shape
Step 0 of 5
Instead of separate n and r steppers, this tool has a partition stepper that cycles through seven curated shapes:
• 2+2 — n=4, two boxes of two. 4!/(2!⋅2!)=6 partitions.
• 3+1 — n=4, one box of three plus a singleton. 4!/(3!⋅1!)=4 partitions.
• 2+1+1 — n=4, one box of two plus two singletons. 4!/(2!⋅1!⋅1!)=12 partitions.
• 4+1 — n=5, one box of four plus a singleton. 5!/(4!⋅1!)=5 partitions.
Use the ◀ and ▶ buttons next to *partition =* to cycle. Each preset resets the build, refreshes the formula in the header, and rebuilds the completed section into a new set of item-1-destination rows.
3+1: A Combination in Disguise
Any two-box partition is secretly a combination: deciding who goes in Box A completely determines who goes in Box B. For shape 3+1 on four items, 4!/(3!⋅1!)=4 — which is just (34), choosing the trio (or equivalently (14), choosing the singleton).
Run it and read the four cards that way: each card is named by the one item standing alone on the right of the divider.
The two item-1-destination rows show the split 3+1: three partitions where the red ball joins the trio, one where it stands alone.
3+1 complete, frozen
Four cards, each named by the single item standing alone right of the divider: a two-box partition is a combination in disguise.
The identity in play is worth writing down: the multinomial with two parts is the binomial, (a,bn)=(an) when a+b=n. The multinomial coefficient is not a new formula so much as the binomial's grown-up form.
Every two-box shape in the stepper — this one, 2+2, 4+1, and 3+2 — can be read back through the combination tool. The three-box shapes are where the multinomial earns its longer name.
4+1: Choosing Who Stands Alone
Five items, one box of four, one singleton: 5!/(4!⋅1!)=5 partitions — the smallest count in the stepper's n=5 range, and the fastest to predict. A partition here is fully described by one decision: who stands alone.
The five cards read like a roll call: each shows four balls together and one apart, and the lone ball is different in every card.
The item-1-destination rows split 4+1: in four partitions the red ball is part of the crowd; in exactly one, it is the loner.
4+1 complete, frozen
Five cards — one per possible loner. With a singleton box, the whole partition is a single decision.
Singleton boxes are the multinomial's pressure valve: each 1! in the denominator divides by nothing, so a singleton adds a factor of choice without any collapsing. That is why this count equals plain n — five ways to pick the loner, nothing further to decide.
Compare against 3+1 to see the pattern scale: same shape idea, one more item, count climbing from 4 to 5 — always n, whatever the crowd size.
3+2: The Team Split
The classic unequal team split: five players into a squad of three and a squad of two, 5!/(3!⋅2!)=10 ways.
Ten is a number this site has met twice already on the combination page — and no accident: choosing the trio is the partition, so this count equals (35)=(25)=10. The two-box multinomial and the binomial symmetry are the same fact viewed from different tools.
The item-1-destination rows split 6+4: six partitions put the red ball on the trio (leaving (24)=6 ways to finish that team), four put it on the pair (leaving (14)=4).
3+2 complete, frozen
Ten team splits of a trio and a pair — the same ten that C(5, 3) counts, since choosing the trio decides everything.
This is the shape to use for the ten-players-two-teams word problems that fill textbooks — with one caution the labeled convention makes visible: splitting ten players into teams of 5 and 5 gives (510)=252 only when the teams are named (red vs blue). Unnamed equal teams need a further division by 2.
Unequal sizes dodge that subtlety, which is why 3+2 is the cleanest teaching case: the sizes themselves distinguish the boxes, and labels add nothing. The subtlety returns with force in 3+1+1.
3+1+1: Equal Boxes and the Labeled Convention
Shape 3+1+1 is where the labeled boxes convention stops being a technicality: 5!/(3!⋅1!⋅1!)=20 partitions — but Boxes B and C have the same size, so every way of splitting the items appears twice, once with the two loners swapped between the boxes.
Run it and find a witness pair: some card with item 4 in Box B and item 5 in Box C, and its twin with them exchanged. Both count, because Box B and Box C are different places.
If the two singleton boxes were indistinguishable — "split five people into a trio and two loners" — the answer would be 20/2!=10.
3+1+1 complete, frozen
Twenty cards — every underlying grouping appearing twice, once per way of assigning the two loners to the equal Boxes B and C.
The general rule: unlabeled equally-sized boxes divide the labeled count by m! for every family of m same-size boxes. That correction is the bridge from the multinomial to the Stirling-style counts under related concepts.
Word problems hide this decision constantly — "committees" are usually labeled by their purpose, "piles" usually are not. The tool's labeled boxes make the convention visible so the divide-or-don't decision becomes conscious rather than accidental.
2+2+1: The Largest Run
The stepper's finale: five items into two pairs and a singleton, 5!/(2!⋅2!⋅1!)=30 partitions — the largest enumeration on this page.
The three item-1-destination rows hold 12+12+6 cards: the red ball can join either pair (twelve ways each, by symmetry of the two equal boxes) or stand alone (six ways, one per arrangement of the remaining four into 2+2).
Like 3+1+1, this shape carries an equal-size pair of boxes, so every underlying "two pairs and a loner" grouping appears twice — 30 labeled, 15 unlabeled.
2+2+1 complete, frozen
The largest run: thirty cards in rows of 12, 12, and 6 — the two equal pair-boxes contributing identical rows, as symmetry demands.
Thirty cards is where watching gives way to counting — a full Play run takes its time, and nobody would tally the grid by hand. The formula's compression is the takeaway: three small factorials in a denominator replace a screen and a half of enumeration.
The 12+12+6 row split is also a neat self-check of the destination decomposition from the grouping section: two symmetric destinations must contribute equally, and they visibly do.
Grouping by Item-1 Destination
DemoRows by item-1 destination
Step 0 of 4
The completed section organizes partitions by which box contains item 1 (the red ball). There are exactly k rows — one per box — and each row holds every partition where item 1 ended up in that particular box.
Group sizes are not all equal. If item 1 goes into box i (of size ni), the remaining n−1 items must fill the remaining slots — one less slot in box i, all slots in the other boxes — and there are:
n1!⋅n2!⋯(ni−1)!⋯nk!(n−1)!
ways to do so. Summing this across the k possible destinations recovers the full multinomial:
i=1∑kn1!⋯(ni−1)!⋯nk!(n−1)!=n1!⋅n2!⋯nk!n!
This is the multinomial analogue of Pascal's identity. For example with shape 2+1+1:
• Item 1 in Box A (size 2): remaining 3 items split as 1+1+1, 3!/(1!⋅1!⋅1!)=6 partitions.
• Item 1 in Box B (size 1): Box B is full, remaining 3 items split as 2+1, 3!/(2!⋅1!)=3.
• Item 1 in Box C (size 1): same as B, 3 partitions.
Total: 6+3+3=12=4!/(2!⋅1!⋅1!).
2+1+1 complete, frozen
Twelve cards in rows of 6, 3, and 3 by the red ball’s destination — the big box leaves the freest remainder, so its row is largest.
The frozen frame above is that worked example completed: shape 2+1+1, twelve cards in rows of 6, 3, and 3 by the red ball's destination. The top row is largest because parking item 1 in the big box leaves the freest remainder — the same lopsidedness the multiset tool showed, for the same reason.
Following one ball through a partition problem is the oldest trick in combinatorics — condition on where a distinguished element goes, and the problem splits into smaller copies of itself. The rows above are that recursion drawn as furniture.
Transport Controls
DemoStep, file, back
Step 0 of 5
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 partition or pausing mid-build.
• Step ▶ (Step forward) — advances one ball into one slot in the relevant box. Stop after each step to read the partial partition.
• ▶ Play / ⏸ Pause — runs the animation continuously until all multinomial partitions are built, then auto-pauses.
• ↺ Reset — clears the completed section and starts over from the first partition.
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 source into a specific box and follow the dotted guide line.
Mode Switch
DemoBalls and letters
Step 0 of 4
The Mode switch at the start of the control bar toggles how each item is rendered:
• Balls mode (default) — items appear as colored circles. The item-1 chip in each StepRow is a red circle. Best for tracking item identity at a glance and watching the red ball flow into different boxes across rows.
• Letters mode — items appear with letter labels (A, B, C, …). The chip becomes the letter A in red. Best for reading off each partition as a set of labeled groups, like {A,C}∣{B,D}.
The encoding is consistent across the source row, the build boxes, the flying ball, every mini partition card in the completed grid, and the right-panel narration. Note the labels A, B, C, D inside the boxes (box names) are distinct from the item letters in letters mode — boxes are always named with the same A–D labels regardless of mode.
Right Panel and Progress
The right panel narrates the build as it unfolds, anchored by the header Partitions into labeled groups and the full multinomial formula for the current partition shape, with a reminder that boxes are distinguishable and within-box order doesn't matter.
A StepRow is added for each item-1-destination group as soon as a partition in that group starts or completes. Each StepRow shows:
• The destination as a chip and arrow — for instance, *A (red) → Box A*.
• A progress counterk/group size tracking how many partitions in this group have completed.
• A short narration of the structure: "Item 1 is placed in Box A (size 2). The remaining 3 items fill the rest: Box A needs 1 more, Box B takes 1 and Box C takes 1, giving 3!/(1!⋅1!⋅1!)=6 partitions." The formula reflects the reduced sizes after item 1 is placed.
When all groups complete, every StepRow shows done with a checkmark, and the counter reaches *total / total*.
What Is a Partition into Groups
A partition into groups distributes n distinct items into klabeled boxes of fixed sizes (n1,n2,…,nk) with n1+n2+⋯+nk=n. The count is the multinomial coefficient:
(n1,n2,…,nkn)=n1!⋅n2!⋯nk!n!
Two design choices are worth pinning down:
• Boxes are labeled. Swapping the entire contents of two boxes counts as a different partition, even if both boxes have the same size. So 2+2 on four items gives 6 partitions, not 3.
• Within a box, order does not matter. Each box is a set.
Examples:
• Splitting 10 players into two teams of 5 (labeled team red vs team blue): 10!/(5!⋅5!)=252 ways.
• Dealing 13 cards each to four labeled players from a 52-card deck: 52!/(13!)4≈5.36×1028 deals.
• Sorting 9 students into three labeled committees of sizes 4,3,2: 9!/(4!⋅3!⋅2!)=1260 assignments.
Note: if the boxes were unlabeled instead, you would divide by the number of permutations of equally-sized boxes, since those rearrangements no longer count separately. This tool covers the labeled case — the difference is drawn out under equal boxes.
On this page the idea runs live: from the opening floor plan, the build boxes fill in canonical order, results group by the red ball's destination, and the seven shapes of the stepper walk the formula from six partitions up to thirty.
For deeper coverage, see the partition into groups section on the combinations theory page.
Deriving the Multinomial Coefficient
Two equivalent derivations.
By sequential choice. Fill the boxes in order:
• Choose n1 items for Box A: (n1n) ways.
• From the remaining n−n1, choose n2 for Box B: (n2n−n1) ways.
• From the remaining n−n1−n2, choose n3 for Box C: (n3n−n1−n2) ways.
• Continue until all boxes are filled.
Multiplying these binomial coefficients telescopes:
By over-counting and dividing. Arrange all n items in a sequence (n! ways), then declare that the first n1 items go in Box A, the next n2 in Box B, and so on. Within each box the internal order doesn't matter, so we have over-counted by n1!⋅n2!⋯nk!. Divide:
n1!⋅n2!⋯nk!n!
The tool visualizes the equivalent decomposition: every partition has a unique destination for item 1. Group by that destination. Summing (n−1)!/(n1!⋯(ni−1)!⋯nk!) across all k destinations reconstructs the multinomial coefficient.
2+2 complete, frozen
Six cards from 24 orderings: each card absorbs the 2!·2! = 4 internal shufflings of its boxes — and mirror cards appear because boxes are labeled.
The frozen frame above is the over-count-and-divide argument at its smallest: shape 2+2, six cards. Line up all 4!=24 orderings of the four balls, cut each in half, and every card here absorbs exactly 2!⋅2!=4 of them — the internal shufflings of each box.
Six is also small enough to expose the labeled-boxes convention: cards like {1,2}∣{3,4} and {3,4}∣{1,2} both appear, because Box A and Box B are different places. Merge them and you would have 3 — the unlabeled count, one division further down.
Related Concepts
Simple combination — the two-group special case. C(n,r)=(r,n−rn)=n!/(r!(n−r)!).
Permutation with identical items — algebraically the same formula n!/(k1!k2!⋯), but a different scenario. There the ki are repeat counts of identical items, and the question is distinct multiset arrangements. Here the ni are box sizes, the items are all distinct, and the question is distinct box assignments.
Distribution into cells — relaxes the fixed-size constraint. n distinct items go into r labeled boxes of any size, each item picking a box independently. Formula rn.
Stirling numbers of the second kind S(n,k) — the unlabeled counterpart. Counts partitions of n distinct items into k unlabeled non-empty subsets. To convert: a labeled-box partition with all distinct sizes corresponds to k! labeled versions of one unlabeled partition — the distinction explored under equal boxes.
Multinomial theorem — the algebraic context: (x1+x2+⋯+xk)n expands with multinomial coefficients (n1,…,nkn) on each monomial x1n1⋯xknk.
Combinatorics calculator — to compute the multinomial coefficient n!/(n1!⋯nk!) for any partition shape, see the partition into groups calculator.