# Rearrange letters in "ENGINE" so no letter appears next to itself

How many ways are there to arrange the letters in "engine" so that no letter appears next to itself?

Initially, I know that there are 6! possible arrangements of the letters. But we have to divide the 6! by 4 because there are 4 duplicate letters. There are 2 e's and 2 n's, so I must subtract these cases.

So there are 5 scenarios where the e's are next to each other
EExxxx
xEExxx
xxEExx
xxxEEx
xxxxEE

same cases for the letter N.

So that's 5*2 (E1E2 and E2E1 are 2 different cases where the letters are next to each other), and we square it because the n's also have the same positioning. $6! - (5 * 2)^2$ However, this seems to

However, since it is the same letter, we must multiply it by 2 because E1E2 is the same as E2E1. This brings me to $6!/4 - [2 * (2 * 5)]$, but apparently that's incorrect. Can anyone please help me see why this is incorrect?

• Instead of rearrange, use 'number of ways'. Commented Dec 11, 2015 at 10:14

Use inclusion-exclusion to count.

Cases where EE appears: $\frac{5!}{2}$.

Cases where NN appears: $\frac{5!}{2}$

Cases where EE and NN appear: $4!$.

Cases where neither appear: $\frac{6!}{2!2!}-2\cdot\frac{5!}{2}+4!$

Further explanation of values:

To count cases where EE appears: Think of EE as a single symbol. We must place EE, N, G, I, I (5 symbols, two are the same (the I's). So $\frac{5!}{2}$ ways).

The NN case is basically same as EE case.

To count the EE, NN case, think of each of EE and NN as a single symbol. Then there are four symbols to place: EE, NN, I, G. There are $4!$ ways to do this.

The final calculation takes the total, subtracts off the EE cases and the NN cases, but this double subtracts the EE, NN cases, so they get added back on.

• I think you should include a few words motivating the number of cases on each row. Commented Dec 11, 2015 at 10:47
• Perfect explanation. Thank you. Commented Dec 11, 2015 at 12:10
• Thank you, now I understand. However, I think the "2 I's part" is an unintentional error? Commented Dec 11, 2015 at 19:30

1)Total permutations = 6!/(2! 2!)

Consider the cases where E repeats now we can treat EE as a single letter

2) Number of permutations where E repeats= 5!/2!

Similarly for NN

3) Number of permutations where N repeats= 5!/2!

When EE and NN both are treated as single letters we have only 4 letters left

4) Number of permutations where both E and N repeats= 4!

5) Number of permutations where neither repeat = 6!/2!2!-(2*5!/2!)+4!=84

We added 4! because 2) and 3) both include 4)

• I think you should include a few words motivating the number of cases on each row. And use $\TeX$ markup as well. Commented Dec 11, 2015 at 10:47

Here's another way.
First consider the possible sequences using the $E's$ and $N's$, and insert the $G$ and $I$ one by one

$ENEN , NENE : 2*5*6 = 60$

$ENNE , NEEN : 2*2*6 -4 = 20$
($-4$ for double counting when both $G$ and $I$ are between the two $N's$)

$EENN , NNEE : 2*2*1 = 4$

total number of ways = $60+20+4 = 84$

Okay lets start total ways are $\frac{6!}{2!.2!}=180$ now lets us consider ways where E are together so consider both E's as a block so total ways are $\frac{(1+4)!}{2!.2!}=30$we have divide by $2!$ as N are also repeated these are ways for E same logic goes for N so total ways are $180-2.30=120$ hope you got it now