# Thread: Number of solutions to an equation.

1. ## Number of solutions to an equation.

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

My Logic:
I started by interpreting $\displaystyle \binom{r}{k}$ to be the number of ways you can select $\displaystyle k$ out of the $\displaystyle r$ terms to be zero. But, I can't figure out what \binom{n-1}{n-r+k} does. I think the $\displaystyle n-1$ part is essentially saying you line up $\displaystyle n$ ones and create a spot between each one where you can insert a bar. I.e. if $\displaystyle 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 $\displaystyle r-k-1$ bars giving you $\displaystyle \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:

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

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

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

$\displaystyle =\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.