Combinatorics: Cookies on a Line 2

You have 7 indistinguishable oatmeal cookies and 8 indistinguishable peanut butter cookies. In how many ways can you arrange 9 of these cookies in a straight line?

Answer

Let \(i\) be the number of oatmeal cookies in the arrangement. Since you can use at most 7 oatmeal cookies and you need 9 cookies in total, the number of peanut butter cookies will be \(9-i\), which must be at most 8. This gives the constraint:

\[ 9-i \le 8 \quad \Longrightarrow \quad i \ge 1. \]

Thus, \(i\) can range from 1 to 7. For each valid \(i\), the number of arrangements is given by choosing \(i\) positions (out of 9) for the oatmeal cookies:

\[ \binom{9}{i}. \]

The total number of arrangements is

\[ \sum_{i=1}^{7} \binom{9}{i}. \]

This number is $501$.

Notes and comments

Comment 1: This differs from the "Cookies on a Line 1" problem because here we must have at least one cookie from each type (we cannot form the line only with one type) to make a total of 9 cookies (due to the limited availability), which imposes the constraint \(1 \le i \le 7\).

Back to collection