# Compute the number of ways to arrange 7 of those cookies into a straight line.

You baked 6 indistinguishable snickerdoodle cookies and 8 indistinguishable chocolate chip cookies. Compute the number of ways to arrange 7 of those cookies into a straight line.

My try: First, identify the number of snickerdoodle cookies, denoted as 𝑠, and the number of chocolate chip cookies, denoted as c, such that $$s+c=7$$. The values of s can range from $$0$$ to $$6$$ (since there are only 6 snickerdoodle cookies available).

For each possible value of s, the corresponding value of c is given by $$c=7−s$$. Also, c must not exceed 8 (the number of available chocolate chip cookies).

Next, we compute the number of distinct arrangements for each valid combination of s and c using the binomial coefficient, which counts the number of ways to choose s positions out of 7 for the snickerdoodle cookies. This is given by: $$C(7,s)$$

Let's calculate it for each valid s we get, $$\sum_{s=0}^7C(7,s)=1+7+21+35+35+21+7=127$$ Thus, the total number of ways to arrange 7 cookies from 6 Snickerdoodle cookies and 8 chocolate chip cookies is $$127$$.

I know that the approach is not correct and I need to use the indistinguishable one differently. Can you help me with a well-explained solution? ​ I was also trying to think about putting a divider between cookies but couldn't get a good idea. Any help!

• I agree with the comment embedded in the answer of mikhail. That is, your analysis is both accurate and valid. Commented Jul 28 at 10:30
• A computation with exponential generating functions also gives an answer of $127$. Commented Jul 28 at 13:02

I think the solution is correct. I got the same answer, and here's how I did it:

We're looking for the number of sequences of 7 cookies, where 2 types of cookies exist. There's {2^7=128} ways to do this, but we exclude the 7 snickerdoodle possibility, so we have $$\boxed{127}$$.

Could you check if you misinterpreted the question, or perhaps verify again whether the answer is wrong?

Here's another approach that seems to work for this case.

First, suppose we had an infinite supply of both types of cookie.  In that case, we'd have a free choice of either type of cookie for the first one, either type for the second, and so on until the 7th.  So that would give 2 × 2 × 2 × 2 × 2 × 2 × 2 = 2⁷ = 128 ways.

However, that counts some ways that aren't allowed with our finite supply of cookies.  The chocolate cookies aren't a limitation, because we have more than enough to have all 7 chocolate.  But we can't have all 7 snickerdoodle, because there are only 6.

That disallows one single way — all 7 snickerdoodle — and so the final answer is 2⁷ - 1 = 128 - 1 = 127 ways.

(That's an easier calculation, though it's probably less general, and would have more trouble if there were fewer cookies available.)

I am new to combinatorics and I guess this might be an answer, not sure though: To find the number of ways to arrange $$7$$ cookies out of $$6$$ snickerdoodle cookies and $$8$$ chocolate chip cookies, we can use the binomial coefficient.

Given:

• $$6$$ snickerdoodle cookies (S)
• $$8$$ chocolate chip cookies (C)
• We need to choose $$7$$ cookies out of these 14 in total.

We can represent the problem as selecting a combination of snickerdoodle and chocolate chip cookies that add up to $$7$$.

Let $$k$$ be the number of snickerdoodle cookies chosen, and $$7-k$$ be the number of chocolate chip cookies chosen.

The possible values for $$k$$ range from $$0$$ to $$6$$ (since there are only $$6$$ snickerdoodle cookies available).

For each $$k$$, we compute the number of ways to choose $$k$$ snickerdoodle cookies from $$6$$, and $$7-k$$ chocolate chip cookies from $$8$$.

The number of ways to choose $$k$$ snickerdoodle cookies from 6 is $$\binom{6}{k}$$.

The number of ways to choose $$7 - k$$ chocolate chip cookies from 8 is $$\binom{8}{7 - k}$$.

The total number of ways for each $$k$$ is the product of these two binomial coefficients.

So, the total number of ways to arrange 7 cookies is the sum of these products for all possible values of $$k$$:

$$\sum_{k=0}^{6}\binom{6}{k}\binom{8}{7-k}$$

If you compute this sum, the number of ways to arrange $$7$$ cookies from a selection of $$6$$ snickerdoodle cookies and $$8$$ chocolate chip cookies is $$3432$$.

• Don't forget that the cookies are indistinguishable, so the number of ways to select $k$ snickerdoodle cookies from 6 is only 1. Commented Jul 28 at 7:49