# Arrange 'ARRANGED' s.t. A and N aren't next to each other

I was looking at a solution for a question regarding permutations at this thread Arranging letters with two letters not next to each other and I thought of another question.

In how many ways can the word ARRANGED be arranged if A and N aren't next to each other ?

Do I need to take into account that there are 2 As ? Since I would need to find

Number of ways to arrange - Number of ways to arrange such that A and N are next to each other.

This is currently what I have tried:

(1) Number of ways to arrange - $\frac{8!}{2!2!} = 10080$

(2) Number of ways to arrange st. A and N are next to each other - $2*\frac{7!2!}{2!2!} = 5040$

(3) Therefore, number of ways to arrange the st. A and N aren't next to each other = 5040.

I multiplied (2) by 2 to take into account that either As can be beside N. Would this be correct?

• You seem to be on right track. What have you tried ? – SMath Nov 8 '16 at 3:32
• Just for some extra clarification: Are you trying to rearrange "ARRANGE" or "ARRANGED"? – 2012ssohn Nov 8 '16 at 3:40
• Sorry I am trying to arrange "ARRANGED" and I have edited my question to include what I have already tried. – Kong Nov 8 '16 at 3:56
• I think you're not far from the answer, however, you may have overcounted the number of ways to arrange s.t. A and N are next to each other. You need to add the "AN" arrangements with the "NA" arrangements and then subtract the "ANA" arrangements. – 2012ssohn Nov 8 '16 at 4:01

Use inclusion/exclusion principle:

• Include the total number of arrangements: $\frac{8!}{2!2!}=10080$
• Exclude the number of arrangements containing AN: $\frac{7!}{2!}=2520$
• Exclude the number of arrangements containing NA: $\frac{7!}{2!}=2520$
• Include the number of arrangements containing ANA: $\frac{6!}{2!}=360$

Hence the number of arrangements without A and N next to each other is:

$$10080-2520-2520+360=5400$$

Complications are arising because $N$ can be at the ends or in the middle, and there are $2 A's$ to contend with, but theses complications can be handled rather neatly using stars and bars

$NRRGED$ can be permuted in $6!/2 = 360$ ways, and whether $N$ is at an end or not, there will always be five "boxes" in which the two $A's$ can be placed any which way, as shown below.

$NR\boxed.R\boxed.G\boxed.E\boxed.D\boxed.\;\; or \;\;\boxed.RNR\boxed.G\boxed.E\boxed.D\boxed.\;,$ with the two $A's$ placed in $\binom{2+5-1}{5-1} = 15$ ways

Thus answer $=360\cdot15 = 5400$

Added another method for those not knowing "stars and bars"

Denoting $N$ by a crossed ball among white ones, an arrangement without the $A's$ would be like

$\huge{\circ\circ\oplus\circ\circ\circ:\;}$ $RRNGED\;6!/2 = 360 \;ways$

Wherever the $N$ might be, the first $A$ would have $5$ places for insertion

$\huge\uparrow\circ\uparrow\circ\oplus\circ\uparrow\circ\uparrow\circ\uparrow:\;$ $360\cdot 5\; ways$

and wherever the first $A$ was inserted (black ball), the second $A$ would have $6$ places for insertion

$\huge\uparrow\circ\uparrow\bullet\uparrow\circ\oplus\circ\uparrow\circ\uparrow\circ\uparrow:\;$ $360\cdot5\cdot6/2\; ways$

How many ways can $\rm RRGED$ be arranged

How many ways can $\Box\Box\Box\blacksquare\blacksquare\blacksquare\blacksquare\blacksquare$ be arranged such that.

• No white square are adjacent.
• then how many ways can the white square be filled with $\rm AAN$
• Exactly two white square are adjacent
• then how many ways can these white squares be filled with $\rm AAN$ such that the two adjacent white squares don't contain $\rm AN$
• Don't bother counting ways exactly three white square are adjacent
• none of these are safe.

Put it all together.

We first place the $N$, then the $A$'s, and then the rest.

If $N$ occupies one of the two end cells there are $6$ cells left for the $A$'s, and if $N$ occupies one of the six inner cells there are $5$ cells left for the $A$'s. I all there are $$2{6\choose 2}+6{5\choose2}=90$$ admissible placements for these three letters. For each such placement the remaining $5$ letters $RRGED$ can then be placed arbitrarily in the $5$ remaining cells in ${5!\over2!}=60$ ways.

It follows that there are $90\cdot60=5400$ admissible arrangements in all.