Solve the following equation $x_1+x_2+x_3=98$ 
Find the number of integral solutions of the following equations $$x_1+x_2+x_3=98$$ subject to the conditions $0\le x_1$ and $0\le x_2$ and $0\le x_3\le 9$

I can do this questions by first putting $x_3$ as $1$ then as $2$ and so on and then applying the stars and bars formula $\displaystyle\binom{n+r-1}{r-1}$.
But then the answer will be too long. The answer given in the solution was $$\binom{100}{2}-\binom{90}{2}$$How will we bring the answer in this form$?$
This was not the original problem. I am posting the original problem too for clarification.
The number of ways in which we can choose two distinct integers from $1$ to $100$ such that difference between them is at most $10$ is
 A: Your attempt will lead to the answer. If you add together all your binomial coefficients
$$
\binom{99}1 + \binom{98}1 + \cdots + \binom{90}1
$$(the first one corresponding to $x_3 = 0$, the second to $x_3 = 1$, the last one to $x_3 = 9$), then by the hockey-stick identity, this is indeed equal to $\binom{100}2 - \binom{90}2$. (The actual hockey-stick identity must be used twice, once for each of
$$
\binom{99}1 + \binom{98}1 + \cdots + \binom11 = \binom{100}2\\
\binom{89}1 + \binom{88}1 + \cdots + \binom11 = \binom{90}2
$$
and then subtract these two to get the result we are after.)
Alternately, you can take the number of solutions without the restriction on $x_3$, which is $\binom{100}2$, and subtract the solutions that violate the restriction on $x_3$. To find the number of solutions that have $x_3\geq 10$, which is to say $x_3 - 10\geq 0$, let $x_3-10$ be its own variable (say $y_3$). Thus we are looking for solutions to $$x_1 + x_2 + x_3 = 98\\x_1+x_2 + x_3-10 = 88\\
x_1 + x_2 + y_3 = 88
$$
with $x_1, x_2, y_3\geq 0$ as the only restriction. Stars and bars gives $\binom{90}2$, so that's what you subtract away from the $\binom{100}2$ unrestricted solutions.
A: A generating function approach. We are looking for the number of non-negative solutions of
\begin{align*}
&\color{blue}{x_1+x_2+x_3=98}\tag{1}\\
&\color{blue}{x_1,x_2\geq 0, 0\leq x_3\leq 9}
\end{align*}
We represent the solutions of a variable $x_1, x_2\geq 0$ as generating function
\begin{align*}
1+z+z^2+z^3+\cdots=\frac{1}{1-z}
\end{align*}
and the solutions of $x_3$ with $0\leq x_3\leq 9$ as generating function
\begin{align*}
1+z+z^2+\cdots+z^9=\frac{1-z^{10}}{1-z}
\end{align*}
where we use the finite geometric summation formula. We use the coefficient of operator $[z^n]$ to denote the coefficient of $z^n$ of a series.

The number of solutions of (1) is
\begin{align*}
\color{blue}{[z^{98}]\left(\frac{1}{1-z}\right)^2\,\frac{1-z^{10}}{1-z}}&=[z^{98}]\frac{1-z^{10}}{(1-z)^3}\\
&=\left([z^{98}]-[z^{88}]\right)\sum_{k=0}^{\infty}\binom{-3}{k}(-z)^k\tag{2}\\
&=\left([z^{98}]-[z^{88}]\right)\sum_{k=0}^{\infty}\binom{k+2}{k}z^k\tag{3}\\
&=\left([z^{98}]-[z^{88}]\right)\sum_{k=0}^{\infty}\binom{k+2}{2}z^k\tag{4}\\
&\,\,\color{blue}{=\binom{100}{2}-\binom{90}{2}}
\end{align*}
according to the claim.

Comment:

*

*In (2) we apply the rule $[z^{p-q}]A(z)=[z^p]z^qA(z)$ and apply the binomial series expansion.


*In (3) we use the binomial identity $\binom{-p}{q}=\binom{p+q-1}{q}(-1)^q$.


*In (4) we use $\binom{p}{q}=\binom{p}{p-q}$ and select the coefficients in the next line accordingly.
