[Math] Books on the shelf problem

combinatoricsdiscrete mathematics

The questions are:
a) There are $5$ comic books, $3$ cooking books, $2$ grammar books. In how many ways can these books be arranged on a shelf if no two of the $3$ cooking books are together?

b) There are $5$ comic books, $3$ cooking books, $2$ grammar books. In how many ways can these books be arranged on a shelf if one of the grammar books is on the left of all cooking books, and the other grammar book is on the right of all cooking books.

For b) after calculation I got $5!\times2!\times10\times9\times8\times7\times6$. Did I solve it correctly?

For a) I'm kind of confused… Any help will be very much appreciated! Thanks

Best Answer

a is a stars and bars problem. Put the non-cooking books in a line. How many ways can you do that? From your answer to b, it appears you consider the five comic books to be distinct. Then you have eight slots (including the ends) that you can put cooking books into. Now put the cooking books in a line-how many ways? Now select three of the eight slots to put the books into.

For b, no. That is twice as many orders as for the ten books without constraint. Put the grammar and cooking books in an allowable order. Put the comic books in an order. Now you need a weak composition of the five comic books into six pieces, the slots at the ends or between the other books.