We're arranging 8 books on a shelf. How many ways can we arrange the books if the history, biology, and computer programming books (1 each) can't be together?
1 Answer
If the 3 books can't be together (but any 2 of the 3 can be) then it's 36,000 ways. If any one of the 3 books can't touch either of the other 2, it's 15,840 ways.
Explanation:
I'm not sure if the question is saying that all three books can't be together in a group (and so biology and history can be together, but biology, history and programming can't), or if the books in that group can't sit next to other books in the group (and so biology and history can't be together). Let's do it both ways - case 1 will be all three together and case 2 will be any 2 together.
Before we work this, let's first see the number of ways we can have all 8 books arranged. Order matters and so we can approach this using a permutation equation. Moreover, since we're using all the books, we'll end up with the total number being:
Case 1 - the three books can't be together
Let's figure out the number of ways we can arrange the books and have the three be together. We can then subtract that number from the total number to get the number of ways to arrange the books without the three being together.
We can view the 3 books as 1 large book taking up 3 spaces (we'll deal with internal order in a minute). How many ways can we place the big book? It can be in slots
And to work out internal order of those 3 books - how many different ways can we arrange our 3 books?
The five remaining books can be placed in
This means we have
Case 2 - any 2 books can't be together
To do this one, I'm going to address the numbers of ways we can arrange the books without any 2 of the prohibited 3 touching.
Let's say for that we the three slots these books will occupy and call them
and I'll order seats with subscripts, and so we'll have
#a# is constrained with#1<=n<=4# #b# is constrained with#3<=n<=6# #c# is constrained with#5<=n<=8#
And so where are the allowable spots for these three books?
With
With
With
With
And so with
When
When
When
All told, we have
The internal order of the 3 books is still
And the ways to arrange the remaining books is still
All told, we have