Combinatorics the number of options for $k$ different balls in n different cells, with at least $1$ ball in each cell How do I calculate the number of options for $k$ different balls in $n$ cells, with at least $1$ ball in each cell? 
Lets say $6$ different balls in $3$ different cells, with at least $1$ ball in each cell. 
like this: 
$$x_1+x_2+x_3 = 6$$
I would like to see an explanation please and not just the answer.
Thanks!
 A: 
In how many ways can six distinct balls be placed in three boxes if at least one ball is placed in each box?

There are three choices for each of the six balls, so there are $3^6$ ways to place the balls without restriction.  From these, we must subtract those distributions in which one or more of the boxes is left empty.  To do so, we use the Inclusion-Exclusion Principle.  
There are three ways to exclude one of the boxes from receiving a ball and $2^6$ ways to distribute the balls to the remaining boxes.  Thus, there are $\binom{3}{1}2^6$ ways to exclude one of the boxes from receiving a ball.
However, if we subtract this amount from the total, we will have subtracted those cases in which two boxes are left empty twice, once for each way we could have designated one of those boxes as the box that is left empty.  We only want to subtract them once, so we must add them back.  
There are three ways to exclude two of the three boxes and one way to place all the balls in the remaining box.
Hence, there are $$3^6 - \binom{3}{1}2^6 + \binom{3}{2}1^6$$ ways to distribute six distinct balls to three distinct boxes so that at least one ball is placed in each box.

In how many ways can $k$ distinct balls be placed in $n$ distinct boxes if at least one ball is placed in each box?

Since there are $n$ choices for each of the $k$ balls, there are $n^k$ ways to distribute the balls without restriction.
There are $\binom{n}{i}$ ways to exclude $i$ of the $n$ boxes from receiving a ball and $(n - i)^k$ ways to distribute $k$ balls to the remaining $n - i$ boxes.
Thus, by the Inclusion-Exclusion Principle, the number of ways to place $k$ distinct balls in $n$ distinct boxes is 
$$\sum_{i = 0}^{n} (-1)^i\binom{n}{i}(n - i)^k$$
A: For a detailed description of all the cases, please see Distributing Balls into Boxes
Your problem is covered by Theorem $5$, Case $2$. Applying the formula on page $3$, the answer in this case would be $540$. Please check the calculations.
