AMC 10 Step by Step

Distributions & Stars and Bars

Distributing objects into bins, integer partitions, compositions

Print these 5
5
primary-topic problems (0.4% of all)
1
more as a secondary topic
Where it appears
0
P1-10
1
P11-15
2
P16-20
2
P21-25

What you need to know

  • Stars and bars (also called balls and urns). The equation x1+x2+⋯+xk=nx_1+x_2+\dots+x_k = n has (n+k−1k−1)\binom{n+k-1}{k-1} solutions in whole numbers that are zero or positive, and (n−1k−1)\binom{n-1}{k-1} if every xix_i is at least 11. Why: line up nn stars and k−1k-1 bars. The bars cut the stars into kk groups (⋆⋆∣⋆∣⋆⋆\star\star|\star|\star\star means 2+1+22+1+2), so you choose which k−1k-1 of the n+k−1n+k-1 spots are bars. Example: x+y+z=5x+y+z = 5 has (72)=21\binom72 = 21 solutions, or (42)=6\binom42 = 6 with each at least 11.
  • Identical objects to different people (or boxes) is the same count: xix_i is what person ii gets. If person ii must get at least aia_i, give them aia_i first. (In symbols, use yi=xi−aiy_i = x_i - a_i, which only has to be zero or positive.) Example: 1010 identical candies to 33 kids, at least 22 each: hand out 66, then share the other 44 in (62)=15\binom62 = 15 ways.
  • Upper limits (xix_i at most mm) need inclusion-exclusion (PIE): subtract the solutions with some variable over mm, then add back the overlaps. See the worked example.
  • Different objects into different boxes is not stars and bars. Each of the nn objects picks a box: knk^n ways. Example: 44 different books to 33 kids: 34=813^4 = 81 ways.
  • Identical objects into identical boxes (partitions) have no formula; list them, largest part first. Example: 55 splits into parts in 77 ways: 55, 4+14+1, 3+23+2, 3+1+13+1+1, 2+2+12+2+1, 2+1+1+12+1+1+1, 1+1+1+1+11+1+1+1+1.
  • Ordered sums. nn can be written as an ordered sum of positive whole numbers (any number of parts) in 2n−12^{n-1} ways. Why: in 1+1+⋯+11+1+\dots+1, each of the n−1n-1 plus signs either stays or is erased. Example: 44 has 23=82^3 = 8, such as 3+13+1, 1+31+3, and 1+2+11+2+1.

How AMC 10 tests it

  • Problems 10–18: "How many ways can 1010 identical candies be given to 44 children if each gets at least one?"
  • Equations in disguise: numbers whose digits add up to a given total, the number of terms in an expansion, ways to pay an amount with coins.
  • Problems 18–24: a cap ("no child receives more than 44") that forces PIE, or a twist about identical versus different objects.
  • Often the top or bottom of a probability fraction.

Standard approaches

  1. Sort first: identical or different objects? Identical or different boxes? Only identical objects into different boxes is stars and bars.
  2. Shift variables to remove lower limits, then use (n+k−1k−1)\binom{n+k-1}{k-1}.
  3. For upper limits, count all, subtract the cases with one variable too big, add back the cases with two, subtract the cases with three, and so on. Stop when that many variables cannot all be too big at once.
  4. For small nn or identical boxes, list the partitions from the largest part down.
  5. Check on a tiny case you can list.

Worked example

How many ordered triples (a,b,c)(a, b, c) of nonnegative integers satisfy a+b+c=12a + b + c = 12 with a≤5a \le 5, b≤5b \le 5, and c≤5c \le 5?

(A) 77 (B) 1010 (C) 1919 (D) 2828 (E) 9191

Solution. "Nonnegative" means zero or positive.

Step 1: ignore the limits. With 1212 stars and 22 bars: (142)=91\binom{14}{2} = 91 solutions.

Step 2: subtract the too-big cases. If a≥6a \ge 6, write a=a′+6a = a'+6, with a′a' zero or positive. Then a′+b+c=6a'+b+c = 6, which has (82)=28\binom82 = 28 solutions. The same holds for bb and for cc, so subtract 3⋅28=843\cdot28 = 84.

Step 3: add back the overlaps. A solution with two variables at least 66 was subtracted twice. If a≥6a\ge6 and b≥6b\ge6, then a=b=6a = b = 6 and c=0c = 0: one solution for each of the 33 pairs, so add back 33. All three is impossible.

Step 4: combine. 91−84+3=1091-84+3 = 10.

Check. The triples are the orderings of (5,5,2)(5,5,2), (5,4,3)(5,4,3), and (4,4,4)(4,4,4): 3+6+1=103+6+1 = 10.

The answer is (B) 10\boxed{\textbf{(B)}\ 10}.

Pitfalls

  • Using (n+k−1k−1)\binom{n+k-1}{k-1} when the objects are different (the answer is knk^n) or the boxes are identical (list the partitions).
  • Mixing up (n−1k−1)\binom{n-1}{k-1} (every part at least 11) with (n+k−1k−1)\binom{n+k-1}{k-1} (parts can be 00): 66 versus 2121 for x+y+z=5x+y+z = 5.
  • Forgetting to add back the double overlaps after subtracting the over-the-limit cases (here that gives 77, choice (A)).
  • Miscounting bars: kk boxes need k−1k-1 bars, not kk.

Traps that recur

  • Distributing the five 2's without requiring every factor to exceed 1, which counts factors equal to 1 and overcounts badly. (2020 AMC 10B #25)
  • Forgetting that dice cannot show 0 and counting solutions to a sum of 10 over 7 nonnegative variables, or worrying about the upper bound 6 when it cannot bind. (2018 AMC 10A #11)
  • Dropping the constant 1 from the count (treating the exponents as summing to exactly N with no slack), which gives C(N-1, 3) and no matching choice. (2016 AMC 10A #20)
  • Treating the six cookies as distinguishable and answering 3^6 = 729, choice (E). (2003 AMC 10A #21)

Problems, easiest first

Open any of them to try it here; the worked solution is on the problem's own page.