How many distinct arrangements of the letters in HEELLOOP are there in which the first two letters include a H or a P (or both)?

168 Views Asked by At

CONTEXT: Question made up by uni lecturer.

How many distinct arrangements of the letters in HEELLOOOP are there in which the first two letters include a H or a P (or both)?

Note: There are 9 letters in total (one H, one P, two E's, two L's and three O's)

When attempting this question, I tried splitting it up into different cases:

  1. First letter H, second letter P
  2. First letter P, second letter H
  3. First letter H, second letter not P (either an E, L or O)
  4. First letter P, second letter not H (either an E, L or O)
  5. First letter not H (either an E, L or O), second letter P
  6. First letter not P (either an E, L or O), second letter H

I know for cases (1) and (2), there are $2!\cdot\frac{6!}{3!\cdot2!\cdot2!}=60$ ways to arrange it since there are $2!$ ways to arrange H and P, and for each, there are $\frac{6!}{3!\cdot2!\cdot2!}$ distinct ways to arrange 6 letters (where there are two E's, two L's and three O's).

It is cases (3) to (5) where I get a bit lost, because letters you get to choose from for the 6 end letters depend on which letter is chosen to accompany the H or P in the first and second position.

For example, in case (3), the first letter is a H, and the second letter can either be an E, L or O. If say, for example, it is an O, then the six remaining letters will consist of one P, two L's, two O's and two E's. But, if it were an E, then the six remaining letters would consist of one P, two L's, three O's and one E. The existence of these two different scenarios are what get me.

Any help on how to approach this would be greatly appreciated.

2

There are 2 best solutions below

3
On

I would split the cases $3-6$ in two different cases. The first two letters are either exact one $H$ and no $P$ or exact one $P$ and no $H$.

1) $HX|Y_1Y_2Y_3Y_4Y_5Y_6$

$X\in\{E,L,O\}, Y_i\in\{P,E,L,O\}$. Here are the different cases for $X$

a) $HE|ELLOOP$

b) $HL|EELOOP$

c) $HO|EELLOP$

$HX$ can be arranged in $2!=2$ ways. And the next sub-sequence can be arranged in $\frac{6!}{2!\cdot 2!\cdot 1!}=6$ ways. Therefore case 1) can be arranged in $3\cdot 2\cdot 6=24$ ways

2) $PX|Y_1Y_2Y_3Y_4Y_5Y_6$

This has the same number of arrangements as in case 1, due symmetry

0
On

Let's try another approach.

Method 1: We use complementary counting.

Observe that the number of arrangements with an H or a P in the first two positions can be found by subtracting the number of arrangements that have neither an H nor a P in the first two positions from the total number of arrangements.

Observe that HEELLOOP has one H, two E's, two L's, two O's, and one P. Choose two of the eight positions for the E's, two of the remaining six positions for the L's, and two of the remaining four positions for the O's, then arrange the H and P in the remaining two positions. We can do this in $$\binom{8}{2}\binom{6}{2}\binom{4}{2}2!$$ ways.

If neither H nor P is in the first two positions, they must be in the last six positions. Choose one of these six positions for the H and one of the remaining five of these positions for the P. That leaves us with six positions to fill with two E's, two L's, and two O's. Choose two of them for the E's, two of the remaining four positions for the L's, and fill the final two positions with the O's. There are $$\binom{6}{1}\binom{5}{1}\binom{6}{2}\binom{4}{2}\binom{2}{2}$$ such arrangements.

Thus, the number of admissible arrangements is $$\binom{8}{2}\binom{6}{2}\binom{4}{2}2! - \binom{6}{1}\binom{5}{1}\binom{6}{2}\binom{4}{2}\binom{2}{2}$$

Method 2: We use the Inclusion-Exclusion Principle.

If we simply add the number of arrangements that have an H in the first two positions to the number of arrangements that have a P in the first two positions, we will have counted those arrangements that have both an H and a P in the first two positions twice. We only want to count them once. Therefore, we must subtract them from the total.

Arrangements with the H in the first two positions: There are two ways to place the H in one of the first two positions. Once we have placed the H, we are left with seven positions to fill with two E's, two L's, two O's, and one P. Choose two of the seven positions for the E's, two of the remaining five positions for the L's, two of the remaining three positions for the O's, then fill the final position with the P. This can be done in $$\binom{2}{1}\binom{7}{2}\binom{5}{2}\binom{3}{2}\binom{1}{1}$$ ways.

Arrangements with the P in the first two positions: By symmetry, the number of arrangements with the P in the first two positions is equal to the number of arrangements with the H in the first two positions.

Arrangements with both the H and the P in the first two positions: There are $2!$ ways to arrange the H and the P in the first two positions. That leaves six positions to fill with two E's, two L's, and two O's. Choose two of those six positions for the E's, two of the remaining four positions for the L's, then fill the final two positions with the O's. There are $$2!\binom{6}{2}\binom{4}{2}\binom{2}{2}$$ such arrangements.

Hence, the number of admissible arrangements is $$2\binom{2}{1}\binom{7}{2}\binom{5}{2}\binom{3}{2}\binom{1}{1} - 2!\binom{6}{2}\binom{4}{2}\binom{2}{2}$$