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

How many ways can four letters abcd be arranged such that a always comes before b and c always comes before d?

Total number of ways abcd can be arranged? 4! Half of them a if before b, half b is before a. Similarly, in half, c is before d, and other half, d is before a.

But we can't divide 4! by 2 - because there are some in which b is before a AND d is before c. So what's the answer?

share|cite|improve this question
just count them. – Holdsworth88 Mar 12 '12 at 10:24
For some reason your comment on my answer disappeared. You misunderstood me, I was enumerating the possibilities (not favourable cases). Only one out of four possibilities was favourable, so the answer becomes (total cases)/4 – Manishearth Mar 12 '12 at 10:59
up vote 5 down vote accepted

It would be $\frac{4!}{2\cdot 2}$. The "a before b" and "c before d" are two independent events, so we can straightaway divide by two twice. You can also look at it this way:

There are four (equally likely) possibilities that can occur when we arrange a,b,c,d without any rules --

  • a before b, c before d (favourable)
  • a before b, c after d (not favourable)
  • a after b, c after d (not favourable)
  • a after b, c before d (not favourable)

Only one out of the four equally likely possibilities is favourable, and we have a total number of $4!$ cases, thus the answer if $\frac{4!}{4}=6$. If you want, the favourable cases are: abcd,acbd,acdb,cdab,cabd,cadb.

share|cite|improve this answer

Actually, you can just divide by $2$ twice. Each of the four scenarios listed below account for an equal number of possibilities, by the same symmetry you noticed for dividing by two originally.

$$\rm \begin{array}{|c|c|c|} \hline & \text{a before b} & \text{b before a} \\ \hline \text{c before d} & \large\color{LimeGreen}\bullet & \large\color{Red}\bullet \\ \hline \text{d before c} & \large\color{Red}\bullet & \large\color{Red}\bullet \\ \hline \end{array} $$

share|cite|improve this answer

You have ${4\choose 2}$ choices for where to place a & b (obviously, putting a in the first of these); but c & d then have to fill the remaining places in a predetermined order. So there are $6$ ways.

share|cite|improve this answer

Did you mean a before b (just before b), or is it acbd allowed (a before b, and c before d)? Please be more specific.

share|cite|improve this answer
I upvote it so you have enough points to put it as a comment next time. – Listing Mar 12 '12 at 15:23
Zeina I meant a before b, not right before b. Sorry for not being clear enough. So in acbd, a is before b, and c is before d. Thanks! – Saad Rehman Shah Mar 16 '12 at 22:29

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.