Combinatorics using averages 
How many solutions exist for $$x+2y+4z=100$$ in non-negative integers?

The author, Martin Erickson, in his book, Aha! Solutions, published by MAA, gives the following brief solution :

There are $26$ choices for $z$, namely, all integers from $0$ to $25$. Among these choices, the average value of $4z$ is $50$. So, on average, $x+2y=50$. In this equation, there are $26$ choices for $y$, namely, all integers from $0$ to $25$. The value of $x$ is determined by the value of $y$. Hence, altogether there are $26^2=676$ solutions to the original equation.

Can somebody explain to me why this mindblowing solution works using averages?

There are $26$ choices for $z$ in $\{0,1,\ldots,25\}$.
Given $z$, we have $x+2y=100-4z$, which leaves $\frac{1}{2}(100-4z)+1=51-2z$ choices for $y$ in $\{0,1,\ldots,\frac{1}{2}(100-4z)\}$. Having fixed $y$, we must have $x=100-4z-2y$.
The total number of solutions is therefore
$$\sum_{z=0}^{25} (51-2z) = 1 + 3 + \cdots + 49 + 51.$$
Note that the average value of the addends here is $26$. Because the addends form an arithmetic sequence, you can replace the addends with $26$ via
$$1 + 3 + \cdots + 49 + 51 = 26 + 26 + \cdots + 26 + 26 = 26 \cdot 26.$$
This can be seen by noting that $1+51=26+26$ and $3 + 49 = 26 + 26$, and so on.
Although the solution in the book is correct, it omits justification of several steps.
