Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Partition into Groups


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.





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*.

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.

The Partition Stepper

Instead of separate nn and rr steppers, this tool has a partition stepper that cycles through seven curated shapes:

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

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

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

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

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

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

2+2+1n=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.

Grouping by Item-1 Destination

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 n1n - 1 items must fill the remaining slots — one less slot in box ii, all slots in the other boxes — and there are:

(n1)!n1!n2!(ni1)!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(n1)!n1!(ni1)!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!).

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 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

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 partition into the other boxes of sizes 1, 1, 1 (Box A needs 1 more), 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!)45.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.

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 nn1n - n_1, choose n2n_2 for Box B: (nn1n2)\binom{n - n_1}{n_2} ways.

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

• Continue until all boxes are filled.

Multiplying these binomial coefficients telescopes:

(nn1)(nn1n2)(nn1n2n3)=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 (n1)!/(n1!(ni1)!nk!)(n - 1)! / (n_1! \cdots (n_i - 1)! \cdots n_k!) across all kk destinations reconstructs the multinomial coefficient.

Related Concepts

Simple combination — the two-group special case. C(n,r)=(nr,nr)=n!/(r!(nr)!)C(n, r) = \binom{n}{r, n - r} = n! / (r! (n - r)!).

Permutation with identical items — algebraically the same formula n!/(k1!k2!)n! / (k_1! k_2! \cdots), but a different scenario. There the kik_i are repeat counts of identical items, and the question is distinct multiset arrangements. Here the nin_i are box sizes, the items are all distinct, and the question is distinct box assignments.

Distribution into cells — relaxes the fixed-size constraint. nn distinct items go into rr labeled boxes of any size, each item picking a box independently. Formula rnr^n.

Stirling numbers of the second kind $S(n, k)$ — the unlabeled counterpart. Counts partitions of nn distinct items into kk unlabeled non-empty subsets. To convert: a labeled-box partition with all distinct sizes corresponds to k!k! labeled versions of one unlabeled partition.

Multinomial theorem — the algebraic context: (x1+x2++xk)n(x_1 + x_2 + \dots + x_k)^n expands with multinomial coefficients (nn1,,nk)\binom{n}{n_1, \dots, n_k} on each monomial x1n1xknkx_1^{n_1} \cdots x_k^{n_k}.

Combinatorics calculator — to compute the multinomial coefficient n!/(n1!nk!)n!/(n_1! \cdots n_k!) for any partition shape, see the partition into groups calculator.