How to find number of solutions of an equation? Given $n$, how to count the number of solutions to the equation $$x + 2y + 2z = n$$ where $x, y, z, n$ are non-negative integers?

We can restate this as:
$$x=n-2y-2z=n-2(y+z)$$
$y$ and $z$ are non-negative integers, so $y+z \geq 0$. We also have $x$ is a non-negative integer, so $n-2(y+z) \geq 0$, or $y+z \leq \lfloor \frac{n}{2} \rfloor$. Thus, we need to figure out the number of positive integers $y, z$ that satisfy:
$$0 \leq y+z \leq \left\lfloor \frac{n}{2} \right\rfloor$$
Now, if $y+z=0$, we have only one solution: $0+0$
If $y+z=1$, we have two solutions: $0+1=1+0$
If $y+z=2$, we have three solutions: $0+2=1+1=2+0$
From this pattern, we find that if $y+z=m$, we have $m+1$ solutions.
We need to sum $m+1$ from $m=0$ to $m=\lfloor \frac{n}{2} \rfloor$ since those are the possible values for $y+z$, so our answer is:
$$\sum_{m=0}^{\lfloor \frac{n}{2} \rfloor} m+1$$
We can say $k=m+1$ to change this sum to:
$$\sum_{k=1}^{\lfloor \frac{n}{2} \rfloor+1} k$$
Using the sum of consecutive positive integers identity, we get:
$$\frac{\left(\lfloor \frac{n}{2} \rfloor+1\right)\left(\lfloor \frac{n}{2} \rfloor+1+1\right)}{2}={\lfloor \frac{n}{2} \rfloor+2 \choose 2}$$
