20 books in 5 shleves I have a question from my homework and I can't solve it.
How to arrange 20 books in 5 shelves if the order of books in each shelf matters?
I thought first that the answer is $5^{20}$, but that only counts the arranging of the books in the shelf if the order does not matter, but the number of shelf does. The thing that makes it difficult is that there can be any number of books in each shelf. Any help?
 A: Ultimately we will multiply by $20!$ in order to deal with the ordering. But we need  to deal also with how many books each shelf will hold.
Let $x_1,x_2,x_3,x_4,x_5$ be the numbers of books to be placed on the various shelves. To find the number of ways to make the decision about numbers, we need to determine the number of solutions of the equation
$$x_1+x_2+x_3+x_4+x_5=20$$
in non-negative integers. This is a standard Stars and Bars problem.  The Wikipedia article gives a pretty good discussion of this problem.
It tuns out that there are $\dbinom{20+5-1}{5-1}$ solutions to the equation, and therefore $20!\dbinom{24}{4}$ ways to arrange the books. 
A: Another way of looking at the problem:
Take your $20$ distinct books, and add $4$ identical "End of Shelf" markers.  These $24$ objects can be arranged in a row in  N distinct ways:$$N=\frac{24!}{4!}$$The "End of Shelf" markers function like this:  all the books (if any) up to the first marker go on the first shelf, the ones between the first and second marker (if any) go on the second shelf, ....    The books after the fourth and last marker (if any) go on the fifth shelf.
