The number of non-negative integral solutions to the equation $4x_1+x_2+x_3=n$ We know that $x_1+x_2+x_3=n$ has ${{n+2}\choose{2}}$ solutions, but how do we calculate the solutions to an equation such as $4x_1+x_2+x_3=n$?
Please do explain! Thanks!
 A: We want to find the number of non-negative integral solutions to the equation $4x_1+x_2+x_3=n$. We can see that $x_1$ is a multiple of $4$, that is $x_1\in\{0,4,8,...\}$, and $x_2$, $x_3$ have no restrictions, that is $x_2,x_3\in\{0,1,2,3,...\}$. 
Consider the generating function $$G(x)=(1+x^4+x^8+\cdots)(1+x+x^2+\cdots)(1+x+x^2+\cdots).$$ 
Where $x_1$ represents the number of apples, $x_2$ represents the number of oranges, and $x_3$ represents the number of bananas. We can rewrite this using the geometric series. So $$G(x)={1\over 1-x^4}\cdot {1\over 1-x}\cdot {1\over 1-x}.$$
Another glance at $G(x)$ and we can see that ${1\over 1-x^4}={1\over 1-x^2}\cdot{1\over 1+x^2}={1\over 1-x}\cdot {1\over 1+x}\cdot {1\over 1+x^2}.$
Thus $$G(x)={1\over (1-x)^3}\cdot {1\over 1+x}\cdot {1\over 1+x^2}.$$
We can use Newton's Binomial Theorem to rewrite $G(x)$ as three different series. The answer we're looking for is the coefficient of $x^n$ in $G(x)$. Computing this by hand is a nightmare. Usually a computer would be used to compute something like this, which is unfortunate.
