ARITHMETIC WORKSHEETS

Counting allocations with no empty labeled box

To count ways to place identical items into labeled boxes with no box empty, put one item in each box first and count the ways to place the rest freely.

The counting question

Five identical coins go into three labeled boxes, and no box may stay empty. How many distributions exist? Labeled boxes mean that giving 3, 1 and 1 coins to boxes A, B and C differs from giving 1, 3 and 1. Identical coins mean only the counts per box matter. Listing the possibilities by hand is practical at this size, but a method that scales is more useful. The method is to satisfy the nonempty rule first by placing one coin in each box, then count the free placements of what is left.

Removing the minimum

Placing one coin in each of the three boxes uses three coins and leaves two. Any valid distribution of five coins can be obtained uniquely this way: subtract one from each box count, and the result is a distribution of two coins with no restriction. Conversely, adding one to each box of any unrestricted distribution of two coins produces a valid distribution of five. The two sets of distributions pair off one to one, so their sizes are equal. The preallocation is a bookkeeping step in the counting, and it does not describe the order in which anyone places the coins.

Counting the free placements with stars and bars

Two remaining coins across three boxes can be drawn as two stars and two bars, where the bars separate the boxes. A sequence such as star, bar, star, bar means one coin in the first box, one in the second, none in the third. There are four positions in total, and choosing which two hold the bars gives C(4, 2). The combination calculator returns 6. The general formula for n identical items in k labeled boxes with no restriction is C(n plus k minus 1, k minus 1). Here n is 2 and k is 3, giving C(4, 2).

Listing the six cases

The six distributions of the original five coins, written as counts in boxes A, B and C, are 3-1-1, 1-3-1, 1-1-3, 2-2-1, 2-1-2 and 1-2-2. Each has all three counts at least 1, and each sums to 5. No other arrangement qualifies: a distribution such as 4-1-0 leaves a box empty, and 5-0-0 leaves two. The list agrees with the count of 6, which is a good way to trust the formula before applying it to cases too large to list.

A second route: breaks among stars

The same count appears from another view. Lay five stars in a row. There are four gaps between neighboring stars. Choosing two of those gaps for breaks cuts the row into three nonempty groups, one for each box. Choosing 2 of 4 gaps is C(4, 2), which is 6 again. This version says that the number of ways to write a total n as an ordered sum of k positive integers is C(n minus 1, k minus 1). Both derivations give the same number because the preallocation and the gap view describe the same one-to-one correspondence.

Without the nonempty rule

If boxes may be empty, the count is larger. Five identical coins in three labeled boxes with no restriction give C(5 plus 2, 2), which is C(7, 2), and the calculator returns 21. The extra 15 distributions all leave at least one box empty. The positive requirement therefore removes more than two thirds of the options here. The two formulas differ only in the top number: n minus 1 when every box needs at least one item, and n plus k minus 1 when none is required. Mixing up which rule applies is the usual source of error.

A larger case

Ten identical items in four labeled boxes with every box nonempty give C(9, 3), which is 84. Without the restriction, the count is C(13, 3), which is 286. These numbers come straight from the formulas, and listing 84 arrangements by hand would be tedious. The gap view makes the first one natural: ten items in a row have nine gaps, and choosing three of them for breaks creates four groups. For the correct formula, count the stars, count the gaps, and choose the breaks.

Ordered sums of positive integers

Counting distributions with no empty box is the same as counting compositions, which are ordered ways to write a total as a sum of positive integers. The six distributions of 5 into three parts are the compositions of 5 with exactly three parts. If the number of parts is free, a total of n has 2 to the n minus 1 compositions, because each of the n minus 1 gaps between stars is either cut or left alone. For n equal to 5 that is 2 to the 4, or 16, spread over one part (1 way), two parts (4 ways), three parts (6 ways), four parts (4 ways) and five parts (1 way). The row 1, 4, 6, 4, 1 is a row of Pascal's triangle, so the sizes of the groups come from the same binomial coefficients that count the breaks.

Feasibility and distinct items

There must be at least as many items as boxes. Two coins cannot fill three boxes, and the formula agrees, since C(1, 2) is zero. The method also assumes the items are identical. If the five coins were distinct, each distribution would count many times, and the count of ways to put distinct items into three labeled boxes with none empty is 3 to the 5th minus 3 times 2 to the 5th plus 3, which is 243 minus 96 plus 3, or 150. Choosing the right model of the problem matters more than the arithmetic. Ask three questions before reaching for a formula: are the items identical or distinct, are the boxes labeled or interchangeable, and may a box be empty? Each answer changes the count. Interchangeable boxes would treat 3-1-1, 1-3-1 and 1-1-3 as one arrangement, reducing the five-coin example from 6 to 2 once the 2-2-1 family is also merged. Writing the three answers beside the problem statement prevents the most common mix-ups, which come from using a formula for a different setup than the one asked about. The worksheet answers only the identical, labeled, nonempty case, so read its count as valid for that setup alone.

Reproduce the checks

Remaining stars and separators

Open the Combination calculator and enter:

Total items n
4
Items selected r
2

Expected output:

Combinations

6

Two remaining items plus two separators give four positions.

Direct positive-composition check

Open the Combination calculator and enter:

Total items n
4
Items selected r
2

Expected output:

Combinations

6

Two breaks among the four internal gaps of five stars give the same count.

References and implementation scope

The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.

Related tasks