Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Partition into Groups

How to use
  1. 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
  2. Use ◀ and ▶ next to partition = to cycle through seven shapes, from 2+22+2 to 2+2+12+2+1; each shape clears the build and updates the formula n!/(n1!⋯nk!)n!/(n_1! \cdots n_k!) at the top right of the scene. Learn more about the partition stepper
  3. 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
  4. ▶ 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
  5. 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
  6. 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
  7. 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
  8. 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
4!/(2! · 2!) = 6Press Play or Step to beginSOURCE (n = 4)1234BUILD BOXES (2+2)BOX A (2)BOX B (2)
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





Key Terms



Key Terms

Partition into groups — a split of nn distinct items into kk labeled boxes of fixed sizes (n1,n2,…,nk)(n_1, n_2, \dots, n_k) with n1+n2+⋯+nk=nn_1 + n_2 + \dots + n_k = n. The count is n!/(n1!⋅n2!⋯nk!)n! / (n_1! \cdot n_2! \cdots n_k!).

Multinomial coefficient — the formula above, written (nn1,n2,…,nk)\binom{n}{n_1, n_2, \dots, n_k}. Generalizes the binomial coefficient (nr)\binom{n}{r} to more than two groups.

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+22+2, 3+1+13+1+1, or 2+2+12+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 kk rows.

Getting Started

The tool opens with partition shape 2+22+2 — four items split into two boxes of two. The scene splits into three areas:

• A source row at the top showing the nn available items.

• A build boxes row in the middle with kk 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!)n! / (n_1! \cdots n_k!) 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: kk / size*.
4!/(2! · 2!) = 6Press Play or Step to beginSOURCE (n = 4)1234BUILD BOXES (2+2)BOX A (2)BOX B (2)
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 kk 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 nin_i 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 kk 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 nn 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.
4!/(2! · 2!) = 6Item 1 in Box A: 1 / 3SOURCE (n = 4)1234BUILD BOXES (2+2)BOX A (2)BOX B (2)132COMPLETED1 / 6→ BoxA1234
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 nn and rr steppers, this tool has a partition stepper that cycles through seven curated shapes:

• 2+2 — n=4n = 4, two boxes of two. 4!/(2!⋅2!)=64!/(2! \cdot 2!) = 6 partitions.

• 3+1 — n=4n = 4, one box of three plus a singleton. 4!/(3!⋅1!)=44!/(3! \cdot 1!) = 4 partitions.

• 2+1+1 — n=4n = 4, one box of two plus two singletons. 4!/(2!⋅1!⋅1!)=124!/(2! \cdot 1! \cdot 1!) = 12 partitions.

• 4+1 — n=5n = 5, one box of four plus a singleton. 5!/(4!⋅1!)=55!/(4! \cdot 1!) = 5 partitions.

• 3+2 — n=5n = 5. 5!/(3!⋅2!)=105!/(3! \cdot 2!) = 10 partitions.

• 3+1+1 — n=5n = 5. 5!/(3!⋅1!⋅1!)=205!/(3! \cdot 1! \cdot 1!) = 20 partitions.

• 2+2+1 — n=5n = 5. 5!/(2!⋅2!⋅1!)=305!/(2! \cdot 2! \cdot 1!) = 30 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+13+1 on four items, 4!/(3!⋅1!)=44!/(3! \cdot 1!) = 4 — which is just (43)\binom{4}{3}, choosing the trio (or equivalently (41)\binom{4}{1}, 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+13 + 1: three partitions where the red ball joins the trio, one where it stands alone.
4!/(3! · 1!) = 4Complete · 4 / 4SOURCE (n = 4)1234BUILD BOXES (3+1)BOX A (3)BOX B (1)COMPLETED4 / 4→ BoxA123412431342→ BoxB2341
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, (na,b)=(na)\binom{n}{a, b} = \binom{n}{a} when a+b=na + 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!)=55!/(4! \cdot 1!) = 5 partitions — the smallest count in the stepper's n=5n = 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+14 + 1: in four partitions the red ball is part of the crowd; in exactly one, it is the loner.
5!/(4! · 1!) = 5Complete · 5 / 5SOURCE (n = 5)12345BUILD BOXES (4+1)BOX A (4)BOX B (1)COMPLETED5 / 5→ BoxA12345123541245313452→ BoxB23451
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!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 nn — 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 44 to 55 — always nn, 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!)=105!/(3! \cdot 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 (53)=(52)=10\binom{5}{3} = \binom{5}{2} = 10. The two-box multinomial and the binomial symmetry are the same fact viewed from different tools.

The item-1-destination rows split 6+46 + 4: six partitions put the red ball on the trio (leaving (42)=6\binom{4}{2} = 6 ways to finish that team), four put it on the pair (leaving (41)=4\binom{4}{1} = 4).
5!/(3! · 2!) = 10Complete · 10 / 10SOURCE (n = 5)12345BUILD BOXES (3+2)BOX A (3)BOX B (2)COMPLETED10 / 10→ BoxA123451243512534134251352414523→ BoxB23415235142451334512
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 55 and 55 gives (105)=252\binom{10}{5} = 252 only when the teams are named (red vs blue). Unnamed equal teams need a further division by 22.

Unequal sizes dodge that subtlety, which is why 3+23+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+13+1+1 is where the labeled boxes convention stops being a technicality: 5!/(3!⋅1!⋅1!)=205!/(3! \cdot 1! \cdot 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!=1020 / 2! = 10.
5!/(3! · 1! · 1!) = 20Complete · 20 / 20SOURCE (n = 5)12345BUILD BOXES (3+1+1)BOX A (3)BOX B (1)BOX C (1)COMPLETED20 / 20→ BoxA123451235412435124531253412543134251345213524135421452314532→ BoxB23415235142451334512→ BoxC23451235412453134521
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!m! for every family of mm 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!)=305!/(2! \cdot 2! \cdot 1!) = 30 partitions — the largest enumeration on this page.

The three item-1-destination rows hold 12+12+612 + 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+22+2).

Like 3+1+13+1+1, this shape carries an equal-size pair of boxes, so every underlying "two pairs and a loner" grouping appears twice — 3030 labeled, 1515 unlabeled.
5!/(2! · 2! · 1!) = 30Complete · 30 / 30SOURCE (n = 5)12345BUILD BOXES (2+2+1)BOX A (2)BOX B (2)BOX C (1)COMPLETED30 / 30→ BoxA123451235412453132451325413452142351425314352152341524315342→ BoxB231452315424135241532513425143341253415235124351424512345132→ BoxC234512435125341342513524145231
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+612 + 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 kk 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 ii (of size nin_i), the remaining n−1n - 1 items must fill the remaining slots — one less slot in box ii, all slots in the other boxes — and there are:

(n−1)!n1!⋅n2!⋯(ni−1)!⋯nk!\frac{(n - 1)!}{n_1! \cdot n_2! \cdots (n_i - 1)! \cdots n_k!}


ways to do so. Summing this across the kk possible destinations recovers the full multinomial:

∑i=1k(n−1)!n1!⋯(ni−1)!⋯nk!=n!n1!⋅n2!⋯nk!\sum_{i=1}^{k} \frac{(n - 1)!}{n_1! \cdots (n_i - 1)! \cdots n_k!} = \frac{n!}{n_1! \cdot n_2! \cdots n_k!}


This is the multinomial analogue of Pascal's identity. For example with shape 2+1+12+1+1:

• Item 1 in Box A (size 2): remaining 33 items split as 1+1+11+1+1, 3!/(1!⋅1!⋅1!)=63!/(1!\cdot 1!\cdot 1!) = 6 partitions.

• Item 1 in Box B (size 1): Box B is full, remaining 33 items split as 2+12+1, 3!/(2!⋅1!)=33!/(2!\cdot 1!) = 3.

• Item 1 in Box C (size 1): same as B, 33 partitions.

Total: 6+3+3=12=4!/(2!⋅1!⋅1!)6 + 3 + 3 = 12 = 4!/(2! \cdot 1! \cdot 1!).
4!/(2! · 1! · 1!) = 12Complete · 12 / 12SOURCE (n = 4)1234BUILD BOXES (2+1+1)BOX A (2)BOX B (1)BOX C (1)COMPLETED12 / 12→ BoxA123412431324134214231432→ BoxB231424133412→ BoxC234124313421
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+12+1+1, twelve cards in rows of 66, 33, and 33 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}\{A, C\} \mid \{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 counter k/group sizek / \text{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!)=63!/(1! \cdot 1! \cdot 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 nn distinct items into kk labeled boxes of fixed sizes (n1,n2,…,nk)(n_1, n_2, \dots, n_k) with n1+n2+⋯+nk=nn_1 + n_2 + \dots + n_k = n. The count is the multinomial coefficient:

(nn1,n2,…,nk)=n!n1!⋅n2!⋯nk!\binom{n}{n_1, n_2, \dots, n_k} = \frac{n!}{n_1! \cdot n_2! \cdots n_k!}


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+22+2 on four items gives 66 partitions, not 33.

• Within a box, order does not matter. Each box is a set.

Examples:

• Splitting 1010 players into two teams of 55 (labeled team red vs team blue): 10!/(5!⋅5!)=25210!/(5! \cdot 5!) = 252 ways.

• Dealing 1313 cards each to four labeled players from a 5252-card deck: 52!/(13!)4≈5.36×102852!/(13!)^4 \approx 5.36 \times 10^{28} deals.

• Sorting 99 students into three labeled committees of sizes 4,3,24, 3, 2: 9!/(4!⋅3!⋅2!)=12609!/(4! \cdot 3! \cdot 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 n1n_1 items for Box A: (nn1)\binom{n}{n_1} ways.

• From the remaining n−n1n - n_1, choose n2n_2 for Box B: (n−n1n2)\binom{n - n_1}{n_2} ways.

• From the remaining n−n1−n2n - n_1 - n_2, choose n3n_3 for Box C: (n−n1−n2n3)\binom{n - n_1 - n_2}{n_3} ways.

• Continue until all boxes are filled.

Multiplying these binomial coefficients telescopes:

(nn1)(n−n1n2)(n−n1−n2n3)⋯=n!n1!⋅n2!⋯nk!\binom{n}{n_1} \binom{n - n_1}{n_2} \binom{n - n_1 - n_2}{n_3} \cdots = \frac{n!}{n_1! \cdot n_2! \cdots n_k!}


By over-counting and dividing. Arrange all nn items in a sequence (n!n! ways), then declare that the first n1n_1 items go in Box A, the next n2n_2 in Box B, and so on. Within each box the internal order doesn't matter, so we have over-counted by n1!⋅n2!⋯nk!n_1! \cdot n_2! \cdots n_k!. Divide:

n!n1!⋅n2!⋯nk!\frac{n!}{n_1! \cdot n_2! \cdots n_k!}


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!)(n - 1)! / (n_1! \cdots (n_i - 1)! \cdots n_k!) across all kk destinations reconstructs the multinomial coefficient.
4!/(2! · 2!) = 6Complete · 6 / 6SOURCE (n = 4)1234BUILD BOXES (2+2)BOX A (2)BOX B (2)COMPLETED6 / 6→ BoxA123413241423→ BoxB231424133412
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+22+2, six cards. Line up all 4!=244! = 24 orderings of the four balls, cut each in half, and every card here absorbs exactly 2!⋅2!=42! \cdot 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}\{1,2\} \mid \{3,4\} and {3,4}∣{1,2}\{3,4\} \mid \{1,2\} both appear, because Box A and Box B are different places. Merge them and you would have 33 — the unlabeled count, one division further down.