There are $10$ different books in a shelf. Find the number of ways of selecting $3$ books when exactly two are consecutive.

There are $10$ different books in a shelf. Find the number of ways of selecting $3$ books when exactly two are consecutive.

Let us represent the problem as follows: $x_1$||$x_2$|$x_3$, where the bars are the chosen books. So $x_1+x_2+x_3=7$, where $x_1,x_3\ge 0,x_2>0$.

So the number of ways are $\binom{8}{2}$ but the answer is $\binom{8}{3}$. I don't know where I am wrong.

• What if the two consecutive chosen books are to the right of the other one? – aPaulT Jul 19 '17 at 11:45

You have not taken into account whether the pair of selected books appears before or after the single selected book. Thus, you must double your answer. Notice that $$2\binom{8}{2} = \binom{8}{3}$$

I would solve the problems as follows:

If the consecutive books are at the ends of the shelf, then there are $10-3 = 7$ available spaces for the third book to be chosen.

If the consecutive books are somewhere in the middle of the shelf, then there are $10-4 = 6$ available spaces for the third book.

Since there are $2$ end spaces and $7$ spaces in the middle, the total number of ways to select the books are $6\times 7+ 7\times 2 = 56 = \binom{8}{3}$

Total number of ways $-$no consecutive $-$ all consecutive

$$\binom{10}{3}-\binom{8}{3}-8=56$$