Number of solutions of the equation $x_1 + x_2 + x_3 = 9$ How to calculate the number of solutions of the equation $x_1 + x_2 + x_3 = 9$ when $x_1$, $x_2$ and $x_3$ are integers which can only range from 1 to 6.
 A: We can find the number of solutions using binomial theorem.
The coefficient of $x^9$ in the following will be the required answer.
$$(x+x^2+\cdots+x^6)^3$$
This above, is a Geometric Progression. Therefore,
$$=\left (\frac{x-x^7}{1-x}\right )^3$$
$$=(x-x^7)^3(1-x)^{-3}$$
Now apply binomial theorem to get the coefficient of $x^9$
$$\left (\binom{3}{0}x^3-\binom{3}{1}x^9+\binom{3}{2}x^{15}-\binom{3}{3}x^{21} \right )\left (\binom{2}{0}+\binom{3}{1}x+\binom{4}{2}x^2+\cdots\infty\right )$$
We can neglect all terms with exponent $>9$
$$\left (\binom{3}{0}x^3-\binom{3}{1}x^9\right )\left (\binom{2}{0}+\binom{3}{1}x+\binom{4}{2}x^2+\cdots+\binom{11}{9}x^9\right )$$
We get the the coefficeient of $x^9$ as
$$\binom{3}{0}\binom{8}{6}-\binom{3}{1}\binom{2}{0}$$
$$=28-3$$
$$=25$$
A: Write $x_i = y_i + 1$, where $0\le y_1 \le 5$
Then you have:
$$y_1 + y_2 + y_3 = 6$$
And according to stars and bars we have: $$\binom{6+3-1}{6} = 28 \text{ combinations}$$
Now just exclude the $(6,0,0), (0,6,0)$ and $(0,0,6)$ and you have $25$ solutions 

UPDATE:
Now to find all the solutions we should exclude let $y_1 = 6 + z_1$, where $z_1 \ge 0$, then you have: $z_1 + y_2 + y_3 = 0$, and according to stars and bars we have:
$$\binom{0+3-1}{0} = 1 \text{ solution}$$
Now since we have three varaibles we have $3\cdot 1$ solution to exclude.
Note working with bigger numbers you'll exclude some solutions twice. To add them again let $y_1=6+z_1$ and $y_2=6+z_2$ and you'll have:
$$z_1 + z_2 + y_3 = -6$$
which obviously doesn't yield any solution. Now since we have $\binom{3}{2} = 3$ such pairs we need to add $3 \cdot 0 = 0$ solutions. Also you need to exclude the solution when $y_1 = 6+z_1; y_2 = 6+z_2; y_3=6+z_3$, which gives you:
$$z_1 + z_2 + z_3 = -12$$
obviously this doesn't yield any solutions, so we need to exclude $\binom{3}{3} \cdot 0 = 0$ solutions.
A: A very simple way first count no.of 
Positive solutions by $(n-1)C(r-1)$.
I hope you understand the meaning of $C$.Then if $x_1$ is $7$ then no. of solutions is $1$ similarly for $x_2$ & $x_3$
is also $1$, so number of solution is $28-3=25$.
A: There are six situations.
126,135,144,225,234 and 333,it's easy to know there is no other situation.
So,we can add each of them together using permutation theorem.
$$P_3^3+P_3^3+\frac{P_3^3}{P_2^2}+\frac{P_3^3}{P_2^2}+P_3^3+\frac{P_3^3}{P_3^3}=25$$
