Number of ways in which letters of the word ENGINEER can be arranged so that no two alike letters are together

Arrangements with $E's$ placed apart in gaps$\;(-)\;$ [$N's$ may be together or separate]

eg $-N-G-I-N-R-\;\; :\;\; \binom63\times \frac{5!}{2!} = 1200$

Subtract arrangements with the two $N's$ bunched as a super N:$\;\binom53\times 4! = 240$

Answer: $1200-240 = 960$


We can solve this problem with the Inclusion-Exclusion Principle.

The number of distinguishable arrangements of the letters of the word ENGINEER is $$\binom{8}{3}\binom{5}{2}3!$$ since we can choose three of the eight positions for the Es, two of the remaining five positions for the Ns, then arrange the three distinct letters G, I, R in the remaining three positions. From these arrangements, we must subtract those in which a pair of identical letters are adjacent.

A pair of adjacent identical letters: There are two possibilities, a pair of Es is adjacent or a pair of Ns is adjacent.

A pair of Es is adjacent: We have seven objects to arrange: EE, E, N, N, G, I, R. Choose two of the seven positions for the Ns, then arrange the five distinct objects EE, E, G, I, R in the remaining positions, which can be done in $$\binom{7}{2}5!$$ ways.

A pair of Ns is adjacent: We have seven objects to arrange: E, E, E, NN, G, I, R. Choose three of the seven positions for the Es, then arrange the four distinct objects NN, G, I, R in the remaining four positions, which can be done in $$\binom{7}{3}4!$$ ways.

Two pairs of adjacent identical letters: There are again two possibilities, either there are two pairs of adjacent Es, in which case all three Es are consecutive, or there is a pair of adjacent Es and a pair of adjacent Ns.

Two pairs of adjacent Es: We have six objects to arrange: EEE, N, N, G, I, R. Choose two of the six positions for the Ns, then arrange the four distinct objects EEE, G, I, R in the remaining four positions, which can be done in $$\binom{6}{2}4!$$ ways.

A pair of adjacent Es and a pair of adjacent Ns: We have six objects to arrange: EE, E, NN, G, I, R. Since the six objects are distinct, they can be arranged in $$6!$$ ways.

Three pairs of adjacent identical letters: The only way for this to occur is if there are two pairs of adjacent Es and a pair of adjacent Ns. We have five objects to arrange: EEE, NN, G, I, R. Since the five objects are distinct, they can be arranged in $5!$ ways.

By the Inclusion-Exclusion Principle, the number of distinguishable arrangements of the letters of the word ENGINEER in which no two adjacent letters are identical is $$\binom{8}{3}\binom{5}{2}3! - \binom{7}{2}5! - \binom{7}{3}4! + \binom{6}{2}4! + 6! - 5!$$


To construct the words where no two same characters adjacent ,we use Smirnov words

A generating function for the number of Smirnov words over an $n$-ary alphabet is given by \begin{align*} \left(1-\frac{nz}{1+z}\right)^{-1}\ \end{align*}

Here we consider an alphabet $\mathcal{V}=\{E,G,I,N,R\}$ with $n=5$ letters. Using $[z^k]$ to denote the coefficient of $z^k$ of a series we calculate \begin{align*} &\color{green}{[E^3GIRN^2]\left(1-\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^{-1}}\\\ &\qquad=[E^3GIRN^2]\sum_{j=0}^{\infty}\left(\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^j\\\ &\qquad=[E^3GIRN^2]\sum_{j=5}^{8}\left(\sum_{a\in\mathcal{V}}\frac{a}{1+a}\right)^j\\\ &\qquad=[E^3GIRN^2]\sum_{j=5}^{8}\left(G+E\left(1-E+E^2\right)\right.\\ &\qquad\qquad\qquad\qquad\qquad\qquad\left.+I+R+N(1-N)\right)^j\\\ &\qquad=-120+1080-3360+3360\\ &\,\,\color{blue}{\qquad=960} \end{align*}

CALCULATION OF EXPANSION