How do I solve this Discrete Math problem in the picture? I am basically stuck at the part where it says w1 + w2 = 7 is equal to the number of integer solutions of x1 + x2 = 5. After that I am not sure how the book got n = 2 and r = 5. I am mainly confused and clueless about how x1 + x2 = 5 is equal to w1 + w2 = 7. Please explain and show me the steps and formulas and such used to figure this out
 A: The key here are the restrictions on $w$'s and $x$'s.  $w$'s are integers greater than $0$, so they are integers greater than or equal to $1$.  They just subtracted $1$ from each $w$, and called it $x$.
A: The equations are not equal. w1,w2 > 0 and x1,x2 => 0.
This way you have for the first equation $\binom{2+6-1}{6}$ solutions (you choose combinations of two numbers from {1,2,3,4,5,6} where you can repeat and those numbers sum 7) and for the second you have the same number of solutions but you choose your two numbers from {0,1,2,3,4,5} and this time they must sum 5.
A: Let us look at the problem concretely. We have $7$ identical candies, and $2$ kids. The number of solutions of $w_1+w_2=7$, with the restriction $w_1\gt 0$, $w_2\gt 0$ is the number of ways to distribute the $7$ candies between $2$ kids, with each kid getting at least $1$ candy.
Give each kid a candy. Now distribute the $5$ remaining candies among the kids, with each kid getting $0$ or more candies. The number of ways to do this is the number of solutions of $x_1+x_2=5$, with $x_1\ge 0$, $x_2\ge 0$.
It follows that the number of solutions of $w_1+w_2=7$ in positive integers is the same as the number of solutions of $x_1+x_2=5$ in non-negative integers.
The same idea works with more candies, and more kids. The number of solutions of $w_1+w_2+w_3+w_4=57$ in positive integers is the same as the number of solutions of $x_1+x_2+x_3+x_4=53$ in non-negative integers. 
