<s>[INST] 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.
 [/INST] 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$$
</s>