Textbook Question:
Determine the number of integer solutions of $$x_1 + x_2 + x_3 + x_4 = 32,$$ where
$x_1, x_2, x_3 > 0 , 0 <x_4 \leq 25.$
Textbook Solution:
Question:
I understand that this question is involving combination with repetitions and the equation is $n + r - 1\choose r $, but I don't understand where r = 28 and r = 3 come from in the the given solution ? Also why there is a subtraction of $6 \choose 3$?

We learn from earlier example that the system
$$\begin{cases} a_1+a_2+\dots+a_r=n\\0<a_1\\0<a_2\\\vdots\\0<a_r\end{cases}$$
has a total of $\binom{n-1}{r-1}=\binom{n-1}{n-r}$ solutions.
Alternatively we learn from earlier example that the system
$$\begin{cases} b_1+b_2+\dots+b_r=n\\ 0\leq b_1\\0\leq b_2\\\vdots\\0\leq b_r\end{cases}$$
has a total of $\binom{n+r-1}{r-1}=\binom{n+r-1}{n}$ solutions
The original system
$$\begin{cases} x_1+x_2+x_3+x_4=32\\ 0<x_1\\ 0<x_2\\ 0<x_3\\ 0< x_4\color{red}{\leq 25}\end{cases}$$
we note that the solutions to the system where the $\leq 25$ is removed will contain all of the solutions we are interested in counting, but it will also include solutions we did not want to count. Specifically it will include the solutions where $x_4\not\leq 25$ which we would need to remove from our count in order to correct it.
If we were to remove the $\leq 25$, by the above formulae we have $\binom{31}{3}$ solutions (the book writes $\binom{31}{28}$, note that these are the same number).
However, the number $\binom{31}{3}$ included in it the unnecessary solutions to the system
$$\begin{cases}x_1+x_2+x_3+x_4=32\\0<x_1\\0<x_2\\0<x_3\\25<x_4\end{cases}$$
This could be converted via a change of variable setting $x_1=y_1,x_2=y_2,x_3=y_3,x_4-25=y_4$
$$\begin{cases} y_1+y_2+y_3+y_4=7\\0<y_1\\0<y_2\\0<y_3\\0<y_4\end{cases}$$
This system has $\binom{6}{3}$ solutions which is the amount we need to remove from our earlier count to correct it.
As such the correct total is
$$\binom{31}{3}-\binom{6}{3}$$