Stars, Bars and Cookies 

How many ways are there to distribute 7 cookies to 4 kids? Here are two things to help you. It is perfectly OK for someone to get no cookie. The cookies are identical. The second property suggests the order in which cookies are given doesn’t matter. Imagine a third child getting two cookies; that can happen in the beginning, mid or at the end.  

The problem is solved using the famous ‘stars and bars’ method. Step one is to box cookies into four compartments, each representing a child. Suppose kid 1 gets one, kid 2 gets two, kid 3 gets one, and kid 4 gets three. The representation is: 

* | ** | * | ***

The solution to the problem has now become the rearrangement of these stars and bars. Since the order doesn’t matter, it is a ‘combinations’ problem of 10 (7 stars + 3 bars), where three are bars (10C3). It is also 10 possibilities among 7 bars (10C7). 

10C3 = 10C7 = 120