Four-letter word contains no two consecutive equal letters.

combinatoricscombinatorics-on-wordsdiscrete mathematicsprobability

This is taken from the book on Combinatorics, by Daniel Marcus.

Request vetting:

A16: Find the probability that a four-letter word that uses letters from $A,B,C,D,E$ contains (a) no repeated letters; (b) no two consecutive equal letters.

(a)
Total (Inclusion) ways to form four-letter word from five letters: $5^4$.

Ways to have repetitions of $A$:

Two $A$: Choose two positions for $A$ in $\binom{4}2= 6$ ways. Rest two positions can be filled in : $4\times 3= 12$ ways. So, by product rule: $72$ words. Also, the same for other $4$ letters, leading to $72\times 5= 360$ words.

Three $A$: Choose three positions for $A$ in $\binom{4}3= 4$ ways. Rest one position can be filled in : $4$ ways. So, by product rule: $16$ words. Also, the same for other $4$ letters, leading to $16\times 5= 80$ words.

Four $A$: Choose all four positions for $A$ in $\binom{4}4= 1$ ways. Also, the same for other $4$ letters, leading to $5$ words.

Sum of above three cases:
$360+80+5= 445.$

Left are: $5^4 – 445= 180.$

$p= \frac{180}{625}$

(b) no two consecutive same letters' case.

Approach#1:
To get, need subtract from $5^4$ the chances of having two consecutive same letters. This is divided into cases:
Case 1: Position #1,2 are the same, and position #4 can match too : $5\times 1\times 4\times 5= 100$ cases.
Case 2: position #2,3 are the same: $5\times 4\times 1 \times 4= 80$ cases.
Case 3: Position #3,4 are the same, and position #1 can match too:
$5\times 4\times 1\times 5=100$

So, get : $625- 280= 345$ cases.

Approach#2:
Alternatively, can 'directly' calculate by having $5$ choices for the first position, then $4$ choices, then again need eliminate one choice (of the second element) to have $4$ choices for the third position, and same for the fourth position. This leads to: $5\times 4^3= 320$ choices possible.

The second approach seems correct, but not clear why first approach is faulty.

Seems there are too many factors to consider in the first approach & hence error-prone (to miss some case(s) as here). So, second approach seems better.

Best Answer

The approach for (a) should work, but you have forgotten to subtract cases where there are two different repeated letters. There are three patterns for this: AABB, ABAB, ABBA. For each there are $5\times 4$ choices for the letters, so this is an extra $60$ to subtract.


The problems with the first attempt for (b) aren't quite as the other answer suggests. You do actually count AABB type possibilities, since case 1 counts cases where the first two are equal and different to the third, and the fourth can be anything (equal to the first or third or neither). Then case 2 counts cases where the middle two are equal, and the first and fourth are not the same as the middle two (but can be the same as each other). Case 3 seems to be the same as case 1 in reverse, in which case you have actually now counted AABB twice.

What's missing are the cases where there are more than two consecutive equal letters: $(5\times1\times 1\times 4)+(5\times 4\times1\times 1)+(5\times1\times1\times1)=45$.

Together with the fact that you have overcounted AABB-type ($5\times 1\times 4\times 1=20$) this should give the same answer as your other approach.