How many different ways can the cookies be chosen?

725 Views Asked by At

Suppose that a cookie shop has 2 different kinds of cookies. How many different ways can 7 cookies be chosen from 3 type1 cookies and 4 type2 cookies where the order in which they are chosen matters? Can you help me by providing a generalized formula for this?

1

There are 1 best solutions below

0
On BEST ANSWER

If you only have two types of cookies the answer is simply $\binom{7}{3}$; indeed if we choose the turns that cookie A are chosen, then there is no choice when to choose cookies of the other type; so the set $\{1,2,6\}$ would correspond to the cookie choices $AABBBAB$. In general though the answer is a bit harder; lets say we had $k$ cookies and wanted to pick $n$ (with order mattering), where we choose $m_i$ cookies of type $i$. Then the answer is $$ \frac{n!}{m_1!m_2!\dots m_k!}. $$ You can think of this as follows; first choose $n$ distinct cookies; this is a permutation of length $n$, lets say $2146537$. Then assign cookies $1,2,...,m_1$ to be of type $A$, cookies $m_1+1,\dots,m_1+m_2$ of type $B$, etc. So the word above would be $AABBBAB$ from our previous example. You can see that this accounts exactly for dividing by $$ m_1!\dots m_k!, $$ since the ordering of $1,2,\dots,m_1$ does not matter, as they all map to $A$!