# Math Help - Number of solutions to an equation.

1. ## Number of solutions to an equation.

Question:
Argue that there are exactly $\binom{r}{k}\binom{n-1}{n-r+k}$ solutions of $x_{1}+x_{2}+\cdots+x_{r}=n$ for which exactly $k$ of the $x_{i}$ are equal to $0$.

My Logic:
I started by interpreting $\binom{r}{k}$ to be the number of ways you can select $k$ out of the $r$ terms to be zero. But, I can't figure out what \binom{n-1}{n-r+k} does. I think the $n-1$ part is essentially saying you line up $n$ ones and create a spot between each one where you can insert a bar. I.e. if $n=8$ you have something like:

1 | 1 | 1 | 1 | 1 | 1 | 1 | 1

Where the |'s are possible places to insert a bar. In which case it seems to me that you would want to choose $r-k-1$ bars giving you $\binom{n-1}{r-k-1}$. Can someone please point out to me where my logic is flawed? Thanks.

2. Your logic is quite right. You're just missing a step:

$\binom{n-1}{r-k-1}=\frac{(n-1)!}{(r-k-1)!(n-1-r+k+1)!}$

$=\frac{(n-1)!}{(r-k-1)!(n-r+k)!}$

$=\frac{(n-1)!}{(n-1-n+r-k)!(n-r+k)!}$

$=\binom{n-1}{n-r+k}$.

3. @hatsoff
Thank you very much that helps a lot. I'll have to remember to check things like that in the future.