We have 4 dogs and 3 cats in a line but no two cats can be together, in how many ways can they be arranged?

Since there are 5 spaces the cats can be in with the dogs fixed, there are ${5 \choose 3} * 4! * 3! = 1440$ ways and this is the correct answer.

I thought of a different approach. Instead of fixing the dogs' places, I fixed the places of the cats. Now, we have 4 spaces of which the two spaces in the middle must be filled. Therefore, out of the 4 dogs, 2 must fill those, and there are $4 * 3$ ways of doing this (since one dog must be chosen to fill one middle space and the other, to fill the second but now there are only 3 dogs left.)

The other two dogs are free to go to any of the 4 spaces, with $4^2$ possibilities.

The cats can now be arranged in $3!$ ways.

So, our final answer should be $3! * 4^2 * 4 * 3 = 1152$

Where have I gone wrong?

  • 2
    $\begingroup$ Is your problem arising as a consequence of a rainfall ? $\endgroup$
    – Jean Marie
    Mar 30, 2019 at 16:27

2 Answers 2


The second computation is missing a symmetry. Say your initial pattern is $$\underline {\quad}C_1\underline {\quad}C_2\underline {\quad}C_3\underline {\quad}$$

You then populate the spaces immediately to the right of $C_1$, and $C_2$. As:

$$\underline {\quad}C_1D_1\underline {\quad}C_2D_2\underline {\quad}C_3\underline {\quad}$$

So far so good. You still have $D_3,D_4$ to place. Where can they go? True, they can each go to any of the four spaces, but if, say, they both go to the first space, in which order do they go?

Taking the two possible orders into account, we see that you are missing $$4\times 3!\times 4\times 3=288$$ cases. Adding them back gives you the desired result.

Phrased differently: once you have placed $D_3$ there are now five available spaces for $D_4$ (since $D_4$ might go either to the left or to the right of $D_3$). thus you should have had $$3!\times 4\times 5\times 4\times 3=1440$$


You can separate the two cases for the two last dogs: single dogs and double dogs.

Single dogs: $$P(4,2)=\frac{4!}{2!}=12.$$ Double dogs: $$P(2,2)\cdot C(4,1)=2\cdot 4=8.$$ Hence, there are $12+8=20$ (not $4^2=16$) ways to distribute the last two dogs.

The final answer is: $$3!\cdot 20\cdot 4\cdot 3=1440.$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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