Combinatorics with repetition - is my textbook right? I am suspicious that my textbook is incorrect.
Here's the question:
In how many ways can we distribute 20 candies among 6 children so that the youngest gets at most 2 candies?
My solution:
There are 20 candies (identical) and 6 children.
This is a combinations with repetition question so it can be represented by $x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 20$
And we can consider the cases where $x_1 = 0, 1, \text{or } 2$ where $x_1$ is the youngest child.
$x_1 = 0$: No candies for the youngest one. Then $r=20$ and $n = 5$ and so there are $\binom{20+5-1}{20}$ combinations.
$x_1 = 1$: We give one candy to the youngest one. Then $r=19$ and $n = 5$ and so there are $\binom{19+5-1}{19}$ combinations.
$x_1 = 2$: We give two candies to the youngest one. Then $r=18$ and $n = 5$ and so there are $\binom{18+5-1}{18}$ combinations.
The number of ways we can distribute the candies is $\binom{24}{20} + \binom{23}{19} + \binom{22}{18} = 26,796$.
Textbook solution:

Who is right?
 A: You are correct.  The flaw in the textbook's solution is that if the youngest child gets $0$, $1$, or $2$ candies, only the number of candies the other children may receive can vary.  In the textbook's solution, $y_1$ should be $0$ in each case.
That said, there is another way to do this problem.
If we ignore the restriction that the youngest child can receive at most two candies, the number of ways to distribute the indistinguishable candies to the children is the number of solutions of the equation
$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 20 \tag{1}$$
in the nonnegative integers.  A particular solution corresponds to the placement of $6 - 1 = 5$ addition signs in a row of $20$ ones.  The number of such solutions is
$$\binom{20 + 6 - 1}{6 - 1} = \binom{25}{5} = \binom{25}{20}$$
since we must choose which five of the $25$ positions required for twenty ones and five addition signs will be filled with addition signs or, equivalently, which $20$ of those $25$ positions will be filled with ones.
From these, we must subtract those cases in which the youngest child receives more than two candies.  Suppose the youngest child does receive at least three candies.  Let $x_1' = x_1 - 3$.  Then $x_1$ is a nonnegative integer.  Substituting $x_1' + 3$ for $x_1$ in equation 1 yields
\begin{align*}
x_1' + 3 + x_2 + x_3 + x_4 + x_5 + x_6 & = 20\\
x_1' + x_2 + x_3 + x_4 + x_5 + x_6 & = 17 \tag{2}
\end{align*}
Equation 2 is an equation in the nonnegative integers with
$$\binom{17 + 6 - 1}{6 - 1} = \binom{22}{5} = \binom{22}{17}$$
solutions.
Hence, the number of ways the candies can be distributed to the six children so that the youngest child receives at most two candies is
$$\binom{25}{5} - \binom{22}{5} = 26,796$$
as you found.
