I know these questions get asked a lot but I cannot figure it out. It requires the use of generating functions to find the number of solutions (coefficient) to the equation:
$u_i+u_2+u_3+u_4 = 20$, where $1 \leq u_i \leq 5, i = 1,...,4$
How do I solve this question step-by-step?
Thanks.
I will take the case of equation $u_1+u_2+u_3+u_4+u_5=20$ because it provides a more interesting challenge.
The main idea is to transfer this issue into an issue about exponents, namely:
$$\tag{1}\underbrace{(x^1+x^2+x^3+x^4+x^5) \times (x^1+x^2+x^3+x^4+x^5) \times \cdots }_{5 \ \text{factors}}=$$
$$\tag{2}(x+x^2+x^3+x^4+x^5)^5$$
It suffices now to expand (2) (using a CAS = Computer Algebra System)
$$\tag{3}x^5+5x^6+15x^7+\cdots+121x^{20}+\cdots+15x^{23}+5x^{24}+x^{25}.$$
and collect the coefficient of $x^{20}$...
Why that ? Because the number of times one obtains $x^{20}$ is the number of times, by picking, in relationship (1), a certain $x^{u_1}$ inside the first parenthesis, a certain $x^{u_2}$ in the second parenthesis, etc. In this way, one gets a $x^{u_1+u_2+...}$ and we are interested in those that sum up to $20$...
Remark: In each factor of (1), the range of exponents, i.e., $\{1,2,3,4,5\}$ corresponds to the domain constraints: $ \ 1 \leq u_i \leq 5$.