# Problem of the Week Problem E and Solution Picture This

## Problem

Eight people, Alex, Braiden, Christine, Gary, Henry, Mary, Sam, and Zachary are lining up in a row for a picture. Due to the dynamics of the people involved, there are certain restrictions in the way the people will line up. Anyone with a name that ends in ’y’ will not stand next to anyone else with a name that ends in ’y’. (Notice that four names end in a ’y’: Gary, Henry, Mary, and Zachary.) Also the twins, Alex and Gary, will not stand beside each other.

If the photographer randomly organizes the people, what is the probability that she arranges the people in a valid order?

The diagram below illustrates one possible valid arrangement of the people.

## Solution

Four of the eight people have a name that ends in ’y’, and these people will not stand next to each other. The problem is further complicated by the fact that Gary and Alex cannot stand together. Since Gary also has a name that ends in ’y’, we will break the problem into cases, based on Gary’s position. We will number the positions from $$1$$ to $$8$$, starting on the left.

Let Gary’s position in the line be marked with a $$G$$. Let the positions of the other people with names that end in ’y’ be marked with a $$Y$$. Positions that have not yet been filled with a person will be marked with a $$\underline{\ \ }$$.

1. Gary is in position $$\mathbf{1}$$.

We place Gary in position $$1$$ and systematically list out the possible placements of the three other people with names that end in ’y’, and see that there are $$4$$ possible configurations: $G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\$ $G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\ \underline{\ \ }\ Y\$ $G\ \underline{\ \ }\ Y\ \underline{\ \ }\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$ $G\ \underline{\ \ }\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$

For each of these $$4$$ configurations, there are $$3$$ possible people to fill in the empty spot immediately next to Gary (these people do not have a name that ends in ’y’, nor are they Alex). For each of these, there are $$3\times 2\times 1$$ ways to place the other people with a name that ends in ’y’ and $$3\times 2\times 1$$ ways to place the remaining people, including Alex.
Therefore, there are $$4\times 3\times (3\times 2\times 1)\times (3\times 2\times 1)=432$$ ways to place the people properly with Gary in position $$1$$.

2. Gary is in position $$\mathbf{8}$$.

The possible placements of Gary and the three other people with names that end in ’y’ will be the reverse of the configurations above when Gary is in position $$1$$. Using a similar argument, we see that there are $$432$$ ways to place the people properly with Gary in position $$8$$.

3. Gary is in position $$\mathbf{2}$$.

We place Gary in position $$2$$ and systematically list out the possible placements of the three other people with names that end in ’y’, and see that there is only $$1$$ possible configuration: $\underline{\ \ }\ G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$

For this configuration, there are $$3$$ possible people to fill in the empty spot to the left of Gary (these people do not have a name that ends in ’y’, nor are they Alex). Once that person has been placed, there are $$2$$ possible people to put in the empty spot immediately to the right of Gary. For each of these arrangements, there are $$3\times 2\times 1$$ ways to place the other people with a name that ends in ’y’ and $$2\times 1$$ ways to place the remaining people, including Alex.

Therefore, there are $$1\times (3\times 2)\times (3\times 2\times 1)\times (2\times 1)=72$$ ways to place the people properly with Gary in position $$2$$.

4. Gary is in position $$\mathbf{7}$$.

The possible placements of Gary and the three other people with names that end in ’y’ will be the reverse of the configurations above when Gary is in position $$2$$. Using a similar argument, we see that there are $$72$$ ways to place the people properly with Gary in position $$7$$.

5. Gary is in position $$\mathbf{3}$$.

We place Gary in position $$3$$ and systematically list out the possible placements of the three other people with names that end in ’y’, and see that there are only $$3$$ possible configurations: $Y\ \underline{\ \ }\ G\ \underline{\ \ }\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$ $Y\ \underline{\ \ }\ G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\ \underline{\ \ }\$ $Y\ \underline{\ \ }\ G\ \underline{\ \ }\ Y\ \underline{\ \ }\ \underline{\ \ }\ Y\$

For each of these $$3$$ configurations, there are $$3$$ possible people to fill in the empty spot to the left of Gary (these people do not have a name that ends in ’y’, nor are they Alex). Once that person has been placed, there are $$2$$ possible people to put in the empty spot immediately to the right of Gary. For each of these arrangements, there are $$3\times 2\times 1$$ ways to place the other people with a name that ends in ’y’ and $$2\times 1$$ ways to place the remaining people, including Alex.

Therefore, there are $$3\times (3\times 2)\times (3\times 2\times 1)\times (2\times 1)=216$$ ways to place the people properly with Gary in position $$3$$.

6. Gary is in position $$\mathbf{6}$$.

The possible placements of Gary and the three other people with names that end in ’y’ will be the reverse of the configurations above when Gary is in position $$3$$. Using a similar argument, we see that there are $$216$$ ways to place the people properly with Gary in position $$6$$.

7. Gary is in position $$\mathbf{4}$$.

We place Gary in position $$4$$ and systematically list out the possible placements of the three other people with names that end in ’y’, and see that there are only $$2$$ possible configurations: $\underline{\ \ }\ Y\ \underline{\ \ }\ G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$ $Y\ \underline{\ \ }\ \underline{\ \ }\ G\ \underline{\ \ }\ Y\ \underline{\ \ }\ Y\$

Using an analysis similar to that in previous cases, we see that there are $$2\times (3\times 2)\times (3\times 2\times 1)\times (2\times 1)=144$$ ways to place the people properly with Gary in position $$4$$.

8. Gary is in position $$\mathbf{5}$$.

The possible placements of Gary and the three other people with names that end in ’y’ will be the reverse of the configurations above when Gary is in position $$4$$. Therefore, there are $$144$$ ways to place the people properly with Gary in position $$5$$.

The cases have no overlapping possibilities and we have considered all of the possible placements of Gary. Therefore, there are $432 + 432+72 + 72 + 216 + 216 + 144+144=1728$ ways for the people to line up correctly.

If the people could stand in any position in the line, the number of possible ways to line up is $8\times 7\times 6\times \times 5\times 4 \times 3\times 2\times 1= 40\,320$ Therefore, the probability that the photographer randomly lines up the people in a valid order is $\dfrac{1728}{40\,320}=\dfrac{3}{70} \approx 0.043$

Therefore, there is approximately a $$4.3\%$$ chance of the photographer arranges the people in a valid order.