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.$
How many ways to lineup 14 candies in a row?
229 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
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$.
With inclusion/exclusion we find for positive integers:
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.