In how many ways can n identical balls be distributed in three green, yellow and blue colored baskets?

Question: In how many ways can $$n$$ identical balls be distributed in three green, yellow and blue colored baskets?

My asnwer: For each ball exist $$3$$ possibilities of choosen, so $$3*3*3*...*3$$ $$n$$ times, that is $$3^n$$

Book's answer: Considering that the first basket has $$0$$ balls, the other two can have $$(0, n), (1, n-1), ..., (n, 0)$$ balls, that is, there are $$(n+1)$$ possibilities of distribute the remaining balls between the two baskets. Considering that the first basket has $$1$$ ball, there are $$n$$ possibilities to distribute the other balls in the other baskets, and so on. So there is a total of $$T = (n+1) + n + ... + 1 = (n+1)(n+2)/2$$

I understand the book's answer, but why is mine wrong?

• can you clarify how many basket there are . Is it $3$ or are there $3$ basket from each color ? Dec 4, 2021 at 21:09
• read this article : en.wikipedia.org/wiki/Stars_and_bars_(combinatorics) Dec 4, 2021 at 21:20