Sub topic 13
Distributing Objects and Counting Integer Solutions
Assume you can evaluate combinations and translate a word problem into variables. This chapter focuses on identical objects placed into distinct boxes, or equivalently, non-negative or positive integer solutions of an equation.
The stars-and-bars model
Suppose \(n\) identical objects are distributed among \(k\) distinct boxes. Let \(x_i\) be the number placed in box \(i\). Then:
\[ x1+x2+\cdots+x_k=n \]
If a box may receive zero objects, the solutions are non-negative. Represent each object by a star and each division between boxes by a bar.
For \(n\) stars and \(k-1\) bars, there are \(n+k-1\) positions. Choose the positions of the bars:
\[ \boxed{\binom{n+k-1}{k-1}} \]
If every box must receive at least one object, the solutions are positive. First place one object in each box. The remaining \(n-k\) objects can be distributed without restriction:
\[ \boxed{\binom{n-1}{k-1}} \]
| Condition | Number of solutions |
|---|---|
| \(x_1+\cdots+x_k=n,\ x_i\ge 0\) | \(\binom{n+k-1}{k-1}\) |
| \(x_1+\cdots+x_k=n,\ x_i\ge 1\) | \(\binom{n-1}{k-1}\) |
Worked examples
Non-negative solutions
How many solutions does
\[ x1+x2+x3+x4=10 \]
have when each variable may be zero?
There are \(n=10\) objects and \(k=4\) boxes:
\[ \binom{10+4-1}{4-1} =\binom{13}{3} =286 \]
Positive solutions
How many solutions satisfy
\[ x1+x2+x3+x4=10 \]
with every \(x_i\ge1\)?
Give each variable one unit first. Six units remain:
\[ \binom{10-1}{4-1} =\binom{9}{3} =84 \]
The condition \(x_i\ge1\) is the key difference. Applying the non-negative formula directly would count invalid cases containing zero.
import math
non_negative = math.comb(10 + 4 - 1, 4 - 1)
positive = math.comb(10 - 1, 4 - 1)
print(non_negative) # 286
print(positive) # 84Bounds and distribution language
A statement such as “at most 4 objects go into box 1” adds an upper bound, such as \(x_1\le4\). The basic stars-and-bars formula does not enforce this bound. A common CAT method is:
- Count all non-negative solutions.
- Subtract solutions violating the bound.
- Use inclusion-exclusion if several bounds overlap.
For example, “distribute 8 identical balls among 3 distinct boxes” means
\[ x1+x2+x3=8,\qquad xi\ge0 \]
and gives \(\binom{10}{2}=45\). The phrase “identical balls” matters. If the balls are distinguishable, each ball has three possible boxes, giving \(3^8\) assignments instead.
Exam checklist
- Are the objects identical?
- Are the boxes distinct?
- Can a box be empty?
- Are there minimum or maximum limits?
- Does each valid distribution correspond to exactly one stars-and-bars arrangement?
Exercise
How many non-negative integer solutions satisfy x + y + z + w + v = 7?
Show answer
There are 5 variables and 7 units, so the count is C(7 + 5 - 1, 5 - 1) = C(11, 4) = 330.