Number of solutions in non-negative integers question (Stars and bars) Q How many solutions are there in non-negative integers $a, b
, c, d$ to the equation:
$$ a + b + c + d = 79 $$
with the restrictions that $a \geq 10$, $b \leq 40$ and $20 \leq c \leq 30?$
If anyone could point me to any notes regarding the topic that would be greatly appreciated. 
 A: $$x_1=a-10\quad \quad,\quad x_2=b,\quad x_3=c-20\quad,\quad x_2=d$$
we have
$$x_1+x_2+x_3+x_4=49 \quad ,\quad x_1\ge0\,\,\,\, , \quad 0\le x_2\le 40\quad  ,\quad 0\le x_3\le10\,\,,\quad x_4\ge0$$
Now apply inclusion and exclusion principle

$$\operatorname{n}(S)-\operatorname{n}(A)-\operatorname{n}(B)+\operatorname{n}(A\cap B)$$
1. let $x_2\ge41$ we have
$$n(A)=C\left( \begin{matrix}
   8+4-1  \\
   3  \\
\end{matrix} \right)
$$
2. let $x_3\ge11$ we have
$$n(B)=C\left( \begin{matrix}
   38+4-1  \\
   3  \\
\end{matrix} \right)
$$
3. let $x_2\ge41$ and $x_3\ge11$ we have
$$n(A\cap B)=0$$
finally
$$C\left( \begin{matrix}
   52  \\
   3  \\
\end{matrix} \right)-C\left( \begin{matrix}
   11  \\
   3  \\
\end{matrix} \right)-C\left( \begin{matrix}
   41  \\
   3  \\
\end{matrix} \right)
$$
A: Using generating functions, we want to find the coefficient of $x^{79}$ in the product
$\displaystyle(x^{10}+x^{11}+x^{12}+\cdots)(1+x+\cdots+x^{40})(x^{20}+x^{21}+\cdots+x^{30})(1+x+x^2+\cdots)$
$\displaystyle=\left(\frac{x^{10}}{1-x}\right)\left(\frac{1-x^{41}}{1-x}\right)\left( x^{20}\cdot\frac{1-x^{11}}{1-x}\right)\left(\frac{1}{1-x}\right)=x^{30}\cdot\frac{(1-x^{41})(1-x^{11})}{(1-x)^4}$.
Therefore we need to find the coefficient of $x^{49}$ in
$\displaystyle\left(1-x^{11}-x^{41}+x^{52}\right)\sum_{n=0}^{\infty}\binom{n+3}{3}x^n$, which is given by$\displaystyle\binom{52}{3}-\binom{41}{3}-\binom{11}{3}$
