Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If say I want to arrange the letters of the alphabet a,b,c,d,e,f such that e and f cannot be next to each other.

I would think the answer was $6\times4\times4\times3\times2$ as there are first 6 letters then 4 as e cannot be next to f.


share|cite|improve this question
What if the first letter is neither $f$ nor $e$? Then there would be $5$ choices for the second. – David Mitra Dec 26 '12 at 18:26
up vote 3 down vote accepted

The $6$ numbers without any restriction can be arranged in $6!$ ways.

If we put $e,f$ together, we can arrange the $6$ numbers in $2!(5!)$ ways, as $e,f$ can arranged in $2!$ ways.

So, the required number of combinations is $6!-2(5!)$

share|cite|improve this answer
$e,f$ can be together in two differ orders. – Thomas Andrews Dec 26 '12 at 18:28

Count all the ways e and f can be together. Subtract this from the total number of permutations.

share|cite|improve this answer

You can, without loss of generality, choose to place $e$ first and then consider where to place $f$. However you will need to consider two cases, since if $e$ is at either end it only restricts one position and otherwise it restricts two.

The more direct way is to consider the number of ways to get what you don't want and then subtract it from the total. Of the 30 ways to arrange $e$ and $f$, 2 have distance 5, 4 have distance 4, 6 have distance 3, 8 have distance 2, and 10 have distance 1. So you should multiply the number of unrestricted arrangements by $\frac{20}{30}$ which should produce $\frac23 \cdot 6!$ which is $4 \cdot 5!$or 480.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.