Maths WorkshopMaths problems with full solutions
Exercise 802Combinatorics › Binomial coefficientsOlympiadAdded 3 Nov 2026

Compositions via binomial coefficients

#compositions#binomial#counting

Statement

Count the number of compositions of nn into kk positive parts.

Hint

Stars and bars: place k−1k-1 bars among n−1n-1 positions.

Show solutionHide solution

Solution

Stars and bars. Represent nn as a sum of kk positive parts by placing k−1k-1 dividers between nn stars in a row of nn stars, giving (n−1k−1)\binom{n-1}{k-1} ways.

Conclusion. Number of compositions of nn into kk positive parts is (n−1k−1)\binom{n-1}{k-1}.

Total. ∑k=1n(n−1k−1)=2n−1\sum_{k=1}^{n}\binom{n-1}{k-1}=2^{n-1} compositions of nn.