Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Distribution into Cells

How to use
  1. The Mode switch toggles ● Balls (colored circles numbered 1, 2, 3 …) and A Letters (tiles A, B, C …); cells stay numbered in both. Learn more about the mode switch
  2. n − / + sets the items from 2 to 4 and k − / + the cells from 2 to 4, capped at 3 for n=4n = 4; raising nn can lower kk. Learn more about adjusting n and k
  3. ▶ Play builds all knk^n distributions and stops at the end, Step ▶ sends one item into its cell, ◀ Back steps backward and ↺ Reset clears the completed rows. Learn more about the transport controls
  4. The Speed slider runs from 0.3 to 3 and sets how fast Play flies and lands each item. Learn more about the speed slider
  5. The header shows knk^n and the total; the status line under it tracks the cell item 1 went to and ends at Complete. Learn more about getting started
  6. Each item flies into its cell and stacks on what is there, with no capacity limit; the assignment readout fills in (c1,c2,… )(c_1, c_2, \dots) as items land. Learn more about the cells
  7. Finished distributions are filed under COMPLETED, one row per cell item 1 went to, each row holding kn−1k^{n-1} cards. Learn more about the item 1 groups
  8. The right panel adds a row per destination of item 1 with its progress and the kn−1k^{n-1} count for the remaining items. Learn more about the right panel


Press ▶ Play to build all kn ways to distribute n distinct items into k labeled cells, or Step ▶ to send one item at a time. Each item independently picks one of the k cells (no capacity limit, cells may be empty) — so there are k choices for each of the n items, giving k × k × … × k = kn. Same math as permutations with repetition, just framed from the items' point of view.
● BallsA Letters
n =3?
k =3?
Speed
3³ = 27Press Play or Step to beginITEMS TO PLACE (n = 3)123CELLS (k = 3)Cell 1Cell 2Cell 3assignment: (?, ?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 3 items independently picks 1 of k = 3 cells:3³ = 3 × 3 × 3 = 27
Distribution into cells (kⁿ)
kn
= 3³
= 3 × 3 × 3
= 27
Distribute n distinct items into k distinct cells. Each item independently picks one cell, with no capacity limit (cells may be empty). Since each of the n items has k independent choices, the total is k × k × ⋯ × k = kn. Same math as permutations with repetition — different framing.
The readout's question marks are the whole problem: one cell number per item, freely chosen — no sizes, no quotas. Learn more about getting started · Adjusting n and k





Key Terms



Key Terms

Distribution into cells — an assignment of nn distinct items to kk labeled cells, where each item independently picks one cell. The count is knk^n.

Labeled cells — the cells are distinguishable, named *Cell 1, Cell 2, …, Cell k*. The same set of items split between *Cell 1* and *Cell 2* differently from how they sit in *Cell 2* and *Cell 1* gives a different distribution.

No capacity limit — any cell may receive any number of items, including zero. Cells may end up empty, full, or anything in between.

Assignment tuple (c1,c2,…,cn)(c_1, c_2, \dots, c_n) — the canonical encoding: cic_i is the cell that item ii chose. Two distributions are the same iff their tuples are identical.

Function view — every distribution is a function f:{1,2,…,n}→{1,2,…,k}f: \{1, 2, \dots, n\} \to \{1, 2, \dots, k\}, mapping each item to its cell. There are exactly knk^n such functions.

Item-1 destination group — the family of distributions where item 1 ends up in a specific cell. The completed section groups results by this destination; with kk cells each holding kn−1k^{n - 1} outcomes, the groups are all the same size.

Getting Started

DemoPlay all 3² distributions
Step 0 of 5
The tool opens with n=3n = 3 items and k=3k = 3 cells. The scene splits into three areas:

• An items row at the top, captioned *ITEMS TO PLACE (n = N)*, showing the nn distinct items.

• A cells row in the middle, captioned *CELLS (k = K)*, with kk labeled boxes named *Cell 1* through Cell k.

• A completed section below, where every finished distribution is filed under the row matching which cell item 1 picked.

To run the visualization:

• Press ▶ Play to auto-build all knk^n distributions.

• Press Step ▶ to send one item at a time.

• Press ◀ Back to step backward.

• Adjust the Speed slider.

The header shows the formula kn=totalk^n = \text{total} alongside a live status line like *Cell c: kk / kn−1k^{n-1}* while building. Below the cells a live assignment readout shows (c1,c2,…,cn)(c_1, c_2, \dots, c_n) with unknown slots marked ?? as the build progresses.
3³ = 27Press Play or Step to beginITEMS TO PLACE (n = 3)123CELLS (k = 3)Cell 1Cell 2Cell 3assignment: (?, ?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 3 items independently picks 1 of k = 3 cells:3³ = 3 × 3 × 3 = 27
(n, k) = (3, 3), idle, frozen

Three items above three empty cells, the readout showing (?, ?, ?) — a distribution is that tuple, and the run just fills in the question marks.

The frozen frame above is the opening position: three items above three tall, empty cells, the readout showing (?,?,?)(?, ?, ?). The question marks are the honest notation — a distribution is that tuple, one cell number per item, and the run's only job is to replace every ?? with a choice.

Unlike the partition tool's fixed room sizes, nothing here constrains where anyone goes. Every ?? has the full menu of kk cells, which is why the total is a clean power — see the cells for the mechanics.

The Cells

DemoOne item at a time
Step 0 of 5
The cells are the destination boxes for each item. Five things to watch:

• Each cell is labeled *Cell 1, Cell 2, …* above the box. The labels are part of the data — *Cell 1* and *Cell 2* are different even if they end up holding the same items.

• Items stack bottom-up inside a cell as they arrive. The visual position in the stack reflects arrival order, but for counting purposes only which items are in this cell matters.

• No capacity limit. A cell can end up with 00, 11, 22, … any number of items up to nn. The all-items-in-Cell-1 outcome is just as valid as the perfectly-spread outcome.

• When an item is in flight from its source position to a cell, a dotted guide line in the item's color traces the trajectory.

• When all nn items are placed, a flash ring briefly pulses around the entire cell row, and the completed distribution is filed in the right group row below.

Below the cells, an assignment readout shows the current tuple (c1,c2,…,cn)(c_1, c_2, \dots, c_n) with ?? for unfilled positions, and a legend reminds you that cic_i is the cell item ii went to.
3³ = 27Cell 1: 1 / 9ITEMS TO PLACE (n = 3)123CELLS (k = 3)Cell 1Cell 2Cell 3123assignment: (1, 1, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 3 items independently picks 1 of k = 3 cells:3³ = 3 × 3 × 3 = 27COMPLETED1 / 27item 1 →Cell 1123(1,1,1)
(3, 3) mid-build, frozen

Items 1 and 2 stacked together in Cell 1, item 3 riding its guide to Cell 2, readout (1, 1, ?) — sharing a cell is the rule working, not breaking.

The frozen frame above catches the second distribution mid-build: items 1 and 2 stacked together in Cell 1, item 3 riding its dotted guide toward Cell 2, and the readout at (1,1,?)(1, 1, ?). Two items sharing a cell is not a collision — it is the "no capacity limit" rule doing exactly what it promises.

The stack order inside a cell records arrival, not meaning: for the count, only the tuple matters. That is why the readout, not the picture, is the mathematical object — the picture is the tuple made physical, as the derivation spells out.

Adjusting n and k

DemoSteppers n and k
Step 0 of 5
Two steppers in the control bar control the size:

• n sets the number of distinct items. Range 22 to 44.

• k sets the number of distinct cells. Range 22 to 44, capped per nn to keep knk^n manageable.

The caps are:

• n=2n = 2: maximum k=4k = 4, giving 42=164^2 = 16 distributions — more cells than items.

• n=3n = 3: maximum k=4k = 4, giving 43=644^3 = 64 distributions.

• n=4n = 4: maximum k=3k = 3, giving 34=813^4 = 81 distributions — the largest run on this page.

Common combinations:

• n=3,k=2n = 3, k = 2: 23=82^3 = 8 distributions — binary choices.

• n=3,k=3n = 3, k = 3: 33=273^3 = 27 distributions — the default configuration.

• n=4,k=2n = 4, k = 2: 24=162^4 = 16 distributions.

Reducing nn may cause kk to clamp to the new maximum automatically. Changing either value resets the build and refreshes the formula in the header.

Grouping by Item 1's Destination

The completed section organizes distributions by which cell item 1 picked. There are exactly kk rows — one per cell — and each row holds every distribution where item 1 went to that particular cell.

Unlike the variable-size groups in partition into groups, here all kk groups have the same size:

group size=kn−1\text{group size} = k^{n - 1}


This is because once item 1's destination is fixed, the remaining n−1n - 1 items still independently pick from all kk cells — no constraint changes. So each group contributes kn−1k^{n - 1} distributions and the total is:

k×kn−1=knk \times k^{n - 1} = k^n


This uniformity is the visual signature of independent choice. Compare it with the simple combination visualizer, where smallest-item groups shrink as the smallest gets larger, or with partition into groups, where group sizes depend on the box sizes. Here every group is identical in size.

Each row in the completed area has a *item 1 → Cell c* label on the left and a grid of mini cards. Each mini card shows the full assignment as kk small stacked cells plus the tuple (c1,c2,…,cn)(c_1, c_2, \dots, c_n) below it.
3³ = 27Complete · 27 / 27ITEMS TO PLACE (n = 3)123CELLS (k = 3)Cell 1Cell 2Cell 3assignment: (?, ?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 3 items independently picks 1 of k = 3 cells:3³ = 3 × 3 × 3 = 27COMPLETED27 / 27item 1 →Cell 1123(1,1,1)123(1,1,2)123(1,1,3)132(1,2,1)123(1,2,2)123(1,2,3)132(1,3,1)132(1,3,2)123(1,3,3)item 1 →Cell 2231(2,1,1)213(2,1,2)213(2,1,3)312(2,2,1)123(2,2,2)123(2,2,3)312(2,3,1)132(2,3,2)123(2,3,3)item 1 →Cell 3231(3,1,1)231(3,1,2)213(3,1,3)321(3,2,1)231(3,2,2)213(3,2,3)312(3,3,1)312(3,3,2)123(3,3,3)
3³ complete, frozen

Twenty-seven cards in three ruler-straight rows of nine: equal groups are the fingerprint of fully independent choices.

The frozen frame above is the default 33=273^3 = 27 completed: three rows of nine, ruler-straight. The equal rows are this page's counterpoint to the staircases elsewhere in the section — independence means the first choice tells you nothing about how many ways remain.

Twenty-seven cards also invite an audit of the "no constraint" claim: find (1,1,1)(1,1,1) — everything crowded into one cell — and (1,2,3)(1,2,3) — everything spread. Both sit in the grid with equal standing; the count plays no favorites among shapes.

Two Cells: Binary Choices

Set k=2k = 2 and every item faces the simplest possible decision: Cell 1 or Cell 2. With n=3n = 3 items, that is 23=82^3 = 8 distributions — the assignment tuples run through every binary string of length three, from (1,1,1)(1,1,1) to (2,2,2)(2,2,2).

Eight is a number with a second identity: it is the number of subsets of a three-element set. Read each distribution as "the set of items that chose Cell 1" and the eight cards become the eight subsets — empty set through full set — with Cell 2 holding each complement.

This is why 2n2^n counts subsets: a subset is nothing but a two-cell distribution wearing set notation.
2³ = 8Complete · 8 / 8ITEMS TO PLACE (n = 3)123CELLS (k = 2)Cell 1Cell 2assignment: (?, ?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 3 items independently picks 1 of k = 2 cells:2³ = 2 × 2 × 2 = 8COMPLETED8 / 8item 1 →Cell 1123(1,1,1)123(1,1,2)132(1,2,1)123(1,2,2)item 1 →Cell 2231(2,1,1)213(2,1,2)312(2,2,1)123(2,2,2)
2³ complete, frozen

Eight cards, one per binary string — and one per subset of the three items, reading Cell 1 as "in" and Cell 2 as "out."

The subset reading turns this configuration into a bridge across the whole section: the combination tool counts subsets of one fixed size ((nr)\binom{n}{r} of them), and summing those sizes recovers this page's total — ∑r(nr)=2n\sum_r \binom{n}{r} = 2^n, the binomial theorem at x=y=1x = y = 1.

Every yes/no survey, every on/off switchboard, every include/exclude decision is a two-cell distribution. The general knk^n is just this picture with a longer menu.

More Cells Than Items

Set n=2,k=4n = 2, k = 4 and the tool draws a scene the fixed-size partition tool never could: four cells for only two items, 42=164^2 = 16 distributions — and in every one of them, at least two cells stand empty.

Emptiness here is not failure but freedom: "no capacity limit" cuts both ways, and a cell that attracts nobody is as legal as a cell that attracts everyone. The sixteen cards show every pattern — the two items together in any of the four cells, or split across any ordered pair of different cells.

In function language: with a domain of 22 and a codomain of 44, no function can be surjective — the range simply runs out of elements before the codomain does.
4² = 16Complete · 16 / 16ITEMS TO PLACE (n = 2)12CELLS (k = 4)Cell 1Cell 2Cell 3Cell 4assignment: (?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 2 items independently picks 1 of k = 4 cells:4² = 4 × 4 = 16COMPLETED16 / 16item 1 →Cell 112(1,1)12(1,2)12(1,3)12(1,4)item 1 →Cell 221(2,1)12(2,2)12(2,3)12(2,4)item 1 →Cell 321(3,1)21(3,2)12(3,3)12(3,4)item 1 →Cell 421(4,1)21(4,2)21(4,3)12(4,4)
4² complete, frozen

Sixteen cards, each leaving at least two of the four cells empty: with more cells than items, vacancy is guaranteed.

The guaranteed-empty configuration is the mirror image of the pigeonhole crowding at n>kn > k: too many cells forces vacancy exactly as too many items forces sharing. Between the two regimes sits n=kn = k, the only territory where every-cell-filled is even possible — those all-full distributions are the k!k! bijections, a vanishing minority of the kkk^k total.

For counts that require every cell non-empty, the section offers the strong composition for identical items — and for distinct items, the surjection count in the related concepts is the answer this tool deliberately doesn't enforce.

Transport Controls

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

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

• Step ▶ (Step forward) — sends one item into its chosen cell. Stop after each step to read the partial assignment tuple.

• ▶ Play / ⏸ Pause — runs the animation continuously until all knk^n distributions are built, then auto-pauses.

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

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 item travel from the items row into a specific cell and stack on top of whatever is already there.

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. Best for tracking item identity at a glance as items stack inside cells and for spotting distribution patterns visually.

• Letters mode — items appear with letter labels (A, B, C, …). Best for reading off each distribution and matching the visual stack to the assignment tuple, where item A goes to cell c1c_1, item B to cell c2c_2, and so on.

The encoding is consistent across the items row, the cells, the flying ball, every mini distribution card in the completed grid, and the right-panel narration. Cell numbers (1, 2, 3, …) are independent of mode — cells are always numbered, regardless of how items are displayed.

Right Panel and Progress

The right panel narrates the build as it unfolds, anchored by the header *Distribution into cells (knk^n)* with the formula displayed across multiple lines and a reminder that this is the same math as permutations with repetition, framed from the items' point of view rather than positions to fill.

A StepRow is added for each item-1-destination group as soon as a distribution in that group starts or completes. Each StepRow shows:

• The destination as text — *Item 1 → Cell c*.

• A progress counter k/kn−1k / k^{n-1} tracking how many distributions in this group have completed.

• A short narration: *When item 1 goes to Cell c, the remaining n−1n - 1 items each still independently pick one of kk cells. That gives kn−1k^{n-1} outcomes in this group.*

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

What Is a Distribution into Cells

A distribution into cells assigns nn distinct items to kk labeled cells, with each item independently choosing one cell and no capacity restriction. The count is:

knk^n


Equivalently, this counts:

• The number of functions f:{1,…,n}→{1,…,k}f: \{1, \dots, n\} \to \{1, \dots, k\} — every item has a target, every target is a valid choice.

• The number of length-nn sequences with entries from {1,…,k}\{1, \dots, k\} — the assignment tuple (c1,…,cn)(c_1, \dots, c_n) is exactly such a sequence.

• The number of ways to color nn distinguishable objects using kk colors with reuse allowed.

Examples:

• Assigning 44 distinct tasks to 33 workers (any worker may get any number of tasks): 34=813^4 = 81 assignments.

• Sending 55 different letters to 33 different mailboxes: 35=2433^5 = 243 sendings.

• Coloring 66 distinct beads with 44 colors, repeats allowed: 46=40964^6 = 4096 colorings.

• Number of functions from a 33-element set to a 55-element set: 53=1255^3 = 125.

On this page the idea runs live: from the opening tuple of question marks, items stack into cells one independent choice at a time, results group into k equal-size rows, and the n and k steppers stretch the count from the binary 232^3 up to 34=813^4 = 81.

For deeper coverage of the formula and its connections, see the distribution into cells section on the combinations theory page.

Deriving k^n

The cleanest derivation is the multiplication principle from the items' perspective.

Each of the nn items independently picks one of kk cells:

• Item 1: kk choices.

• Item 2: kk choices (independent of item 1).

• Item 3: kk choices.

• …\dots

• Item nn: kk choices.

Multiply nn identical factors of kk:

k×k×k×⋯×k=knk \times k \times k \times \dots \times k = k^n


The tool visualizes the equivalent decomposition: fix where item 1 goes (kk ways), then ask how many ways the remaining n−1n - 1 items can be distributed independently (kn−1k^{n - 1} ways). Every row in the completed section is one of those kk item-1-destination families, all the same size.

Note the perfect symmetry: it doesn't matter which item you fix first — fixing item 2 or item nn instead would give the same decomposition into kk equal-size groups, just labeled differently. This is the visual signature of full independence.

Counts grow quickly: 25=322^5 = 32, 35=2433^5 = 243, 55=31255^5 = 3125. The base kk and exponent nn play asymmetric roles — increasing nn multiplies the count by kk, increasing kk multiplies by a factor that itself depends on nn.
3⁴ = 81Complete · 81 / 81ITEMS TO PLACE (n = 4)1234CELLS (k = 3)Cell 1Cell 2Cell 3assignment: (?, ?, ?, ?)(item 1 → cell c₁, item 2 → cell c₂, …)Each of n = 4 items independently picks 1 of k = 3 cells:3⁴ = 3 × 3 × 3 × 3 = 81COMPLETED81 / 81item 1 →Cell 11234(1,1,1,1)1234(1,1,1,2)1234(1,1,1,3)1243(1,1,2,1)1234(1,1,2,2)1234(1,1,2,3)1243(1,1,3,1)1243(1,1,3,2)1234(1,1,3,3)1342(1,2,1,1)1324(1,2,1,2)1324(1,2,1,3)1423(1,2,2,1)1234(1,2,2,2)1234(1,2,2,3)1423(1,2,3,1)1243(1,2,3,2)1234(1,2,3,3)1342(1,3,1,1)1342(1,3,1,2)1324(1,3,1,3)1432(1,3,2,1)1342(1,3,2,2)1324(1,3,2,3)1423(1,3,3,1)1423(1,3,3,2)1234(1,3,3,3)item 1 →Cell 22341(2,1,1,1)2314(2,1,1,2)2314(2,1,1,3)2413(2,1,2,1)2134(2,1,2,2)2134(2,1,2,3)2413(2,1,3,1)2143(2,1,3,2)2134(2,1,3,3)3412(2,2,1,1)3124(2,2,1,2)3124(2,2,1,3)4123(2,2,2,1)1234(2,2,2,2)1234(2,2,2,3)4123(2,2,3,1)1243(2,2,3,2)1234(2,2,3,3)3412(2,3,1,1)3142(2,3,1,2)3124(2,3,1,3)4132(2,3,2,1)1342(2,3,2,2)1324(2,3,2,3)4123(2,3,3,1)1423(2,3,3,2)1234(2,3,3,3)item 1 →Cell 32341(3,1,1,1)2341(3,1,1,2)2314(3,1,1,3)2431(3,1,2,1)2341(3,1,2,2)2314(3,1,2,3)2413(3,1,3,1)2413(3,1,3,2)2134(3,1,3,3)3421(3,2,1,1)3241(3,2,1,2)3214(3,2,1,3)4231(3,2,2,1)2341(3,2,2,2)2314(3,2,2,3)4213(3,2,3,1)2413(3,2,3,2)2134(3,2,3,3)3412(3,3,1,1)3412(3,3,1,2)3124(3,3,1,3)4312(3,3,2,1)3412(3,3,2,2)3124(3,3,2,3)4123(3,3,3,1)4123(3,3,3,2)1234(3,3,3,3)
3⁴ complete, frozen

The largest run: 81 cards, and by the pigeonhole principle every single one has some cell holding two or more items.

The frozen frame above is the page's largest run: 34=813^4 = 81 distributions of four items into three cells. With more items than cells, the pigeonhole principle guarantees a shared cell in every single card — scan the grid and you will find no distribution with all four items alone.

Eighty-one is also where this tool and its mirror meet: the permutation-with-repetition page shows the same 8181 as 343^4 sequences. One enumeration, two stories — positions choosing symbols there, items choosing cells here.