Problem
COM-B2-M03-P012 Compositions and Separators
#12
★★★☆☆ Level 3 of 5
Prove that the number of ways to write \(n\) as a sum of \(k\) positive integers, with order taken into account, is \(\binom{n-1}{k-1}\).
com_3.md (method inspiration)
Place bars in the gaps between \(n\) ones.
Write \(n\) ones in a row. To split them into \(k\) nonempty groups, choose \(k-1\) of the \(n-1\) gaps between consecutive ones and place bars there. The group sizes are the summands. Conversely, every composition gives such bars. The answer is \(\binom{n-1}{k-1}\).
Distinguish compositions from partitions.