# How many ways I can arrange 5 unique blue books, 5 unique red books and 5 unique green books so that 2 blue books are always together?

how many ways can i arrange 5 unique blue books, 5 unique red books and 5 unique green books so that at least 2 blue books are always together?

I thought I had a better grasp of combinatorics, but Ive been told my approach is wrong. I see it as having 14 spots for the books, since 1 spot would be taken by the pair of blue books. So my answer would be 2!*14!, since the arrangement of the rest of the books is unimportant. I just want the arrangements where 2 blue books are next to each other. Any leads would be appreciated!

• Welcome to MSE. In cases like this, you may find it easier to instead determine the number of ways to arrange the books so that no blue books are together and subtract that from the total number of ways to arrange the books. – John Omielan Aug 13 at 0:45
• Hi John, thank you for your advice! I see the reasoning behind it, I will try to work a way for arranging the blue books so that they are not together – Nico Aug 13 at 1:05

There are a couple of things wrong with your analysis. First, there are five possible blue books that could be next to each other, so you would need an extra factor of $$\binom{5}{2}$$ to account for choosing which two they are. More profoundly, though, this will overcount the number of solutions. If there were two pairs of blue books together (or three blue books in a row), they would be counted as two different solutions even though they are the same arrangement.

So, let's follow John's suggestion and count the number of arrangements in which no two blue books are next to each other, and then subtract that from $$15!$$.

I'll start by putting the green and red books on the bookshelf. Since the books are unique, this can be done in $$10!$$ ways. This sets up eleven potential places where the blue books can fit (and if the blue books are all in different slots, we are certain they won't be next to each other). We can choose which books go in which slots in $$5!\binom{11}{5}$$ ways. This gives us a total of $$10!\cdot5!\binom{11}{5}$$ ways in which you can put the 15 books on the shelf with no blue books next to each other.

• Hi Matthew, thank you for your explanation! When you mentioned on your first paragraph about the over counting, as long a s 2 unique blue books are together, is ok. If another blue book follows it wouldnt matter as the condition of a pair was already met. Does this clarification changes your explanation? – Nico Aug 13 at 1:22
• No. Let's say that the three blue books were ...ABC... in order. If you're not careful with your counting (which is what's called the inclusion-exclusion principle), this will be counted as both an example of ...AB... and an example of ...BC..., which will make your calculation inaccurate. – Matthew Daly Aug 13 at 1:26
• I understand now, thank you for your clarification Matthew – Nico Aug 13 at 1:30

Of course, there are $$15!$$ arrangements without restrictions. The number of arrangements with no two blue books together can be computed as follows:

• Choose the locations of the blue books. They define $$6$$ spaces between and around them; the middle $$4$$ spaces must contain at least one other book. Thus $$6$$ extra books remain to be distributed among the $$6$$ spaces with possibly $$0$$ extra books in a space, so by stars and bars there are $$\binom{6+6-1}6=462$$ combinations.
• Permute the blue and red/green books in their positions; there are $$5!10!$$ permutations for each combination.

Thus the final answer is $$15!-462×5!×10!=1,106,493,696,000$$.

• Thank you for your explanation Parcly, I struggled a little with your set up for the start and bars, but realised you are placing books around the blue books to ensure they are not together. Thank you for your advice – Nico Aug 13 at 1:39
• @Nico Now upvote and accept my answer. Click on the green tick left of my answer. – Parcly Taxel Aug 13 at 1:39