How many ways to lineup 14 candies in a row?

229 Views Asked by At

Cindy has 6 identical pink candies and 8 identical green candies. Find the number of ways that Cindy can line up her candies in a row, so that there are exactly four places where a pink candy is next to a green candy. One example is $PPGGGPPPGGGGGP.$

2

There are 2 best solutions below

1
On

With inclusion/exclusion we find for positive integers:

  • There are $\binom71=7$ sums $g_1+g_2=8$.
  • There are $\binom72=21$ sums $g_1+g_2+g_3=8$.
  • There are $\binom51=5$ sums $p_1+p_2=6$.
  • There are $\binom52=10$ sums $p_1+p_2+p_3=6$.

So there are $21\times5=105$ orders of the form $[g_1][p_1][g_2][p_2][g_3]$.

And there are $7\times 10=70$ orders of the form $[p_1][g_1][p_2][g_2][p_3]$.

That gives a total of $$105+70=175$$possibilities.

0
On

To have four neighboring $P$ and $G$, there are two orderings: $P_1,G_1,P_2,G_2,P_3$ or $G_1,P_1,G_2,P_2,G_3$.

The first orderings are: $$\begin{align} &4P,7G,P,G,P;\cdots 4P,G,P,7G,P \Rightarrow 7 \\ &3P,7G,2P,G,P;\cdots 3P,G,2P,7G,P \Rightarrow 7 \\ &3P,7G,P,G,2P;\cdots 3P,G,P,7G,2P \Rightarrow 7 \\ &\cdots \\ &P,7G,P,G,4P;\cdots P,G,P,7G,4P \Rightarrow 7. \end{align}$$ Counting rule: note $n(P_1)+n(P_2)=2,3,4,5$, so: $$\left(\binom11+\binom21+\binom31+\binom41\right)\cdot 7=(1+2+3+4)\cdot 7=70.$$

The second orderings are: $$\begin{align} &6G,5P,G,P,G; \cdots ; 6G,P,G,5P,G \Rightarrow 5 \\ &5G,5P,2G,P,G;\cdots ;5G,P,2G,5P,G \Rightarrow 5 \\ &5G,5P,G,P,2G;\cdots ; 5G,P,G,5P,2G \Rightarrow 5 \\ &\cdots \\ &G,5P,G,P,6G;\cdots ; G,P,G,5P,6G \Rightarrow 5.\end{align}$$ Counting rule: note $n(G_1)+n(G_2)=2,3,4,5,6,7$, so: $$\left(\binom11+\binom21+\binom31+\binom41+\binom51+\binom61\right)\cdot 5=(1+2+3+4+5+6)\cdot 5=105.$$

In conclusion, $70+105=175$.