In how many ways can 9 books be arranged on a shelf so that 5 of the books are always together?

There are only 5 places on the shelf. You have 7 books to choose from. We will ignore the order of the books on the shelf. The first place can be filled from a choice of 7 books, the next place from 6, the next place from 5, the next from 4, and the last of the 5 places from 3 books. So the number of ways of choosing the 5 is found from 7 * 6 * 5 * 4 * 3 = 2520

Part (a) We have 9 books which I'll call book a, book b, book c, ..., book h, book i Let's say we want books a through c to always stick together in any particular order. We can pull books a,b,c out of the group on a temporary basis for now. Replace them with book j. The position of book j will represent books a,b,c in any order. The 9 books drop to 9-3 = 6 after taking books a,b,c out, but then the count bumps up to 6+1 = 7 after adding book j. Arrange the 7 books and you should find there are 7! = 7*6*5*4*3*2*1 = 5040 permutations. The order matters. You can alternatively use the nPr formula with n = 7 and r = 7. That 5040 describes sequences involving book j. Wherever you see book j, replace it with some permutation of a,b,c. For example, if we had the sequence

j,d,e,f,g,h,i


then it could represent any of the following 6 items
  • a,b,c,d,e,f,g,h,i
  • a,c,b,d,e,f,g,h,i
  • b,a,c,d,e,f,g,h,i
  • b,c,a,d,e,f,g,h,i
  • c,a,b,d,e,f,g,h,i
  • c,b,a,d,e,f,g,h,i
The 6 is due to the fact that 3! = 3*2*1 = 6 There are 6 ways to arrange any group of 3 items where order matters. As another example, the sequence here

g,h,i,j,d,e,f


could represent any of the following
  • g,h,i,a,b,c,d,e,f
  • g,h,i,a,c,b,d,e,f
  • g,h,i,b,a,c,d,e,f
  • g,h,i,b,c,a,d,e,f
  • g,h,i,c,a,b,d,e,f
  • g,h,i,c,b,a,d,e,f
Overall, there are 6*5040 = 30,240 ways to arrange the 9 books such that 3 of them are always together in some fashion.

Answer: 30,240

----------------------------------------------------------- Part (b) There are 9! = 9*8*7*6*5*4*3*2*1 = 362,880 different ways to arrange all of the books regardless if 3 particular books stick together or not. We found earlier there are 30,240 ways to arrange the books so that 3 stick together. Subtract those two values to get

362,880 - 30,240 = 332,640

which represents the number of ways to have the 3 books separated in some fashion. Either they are all isolated from one another, or we only have 2 of them together (but not all 3 together). This works because those 3 books are either always together, or split apart in some way. The two events are complementary of one another.

Answer: 332,640