Question: What two nonnegative real numbers $a$ and $b$ whose sum is 23 maximize $a^2+b^2$? Minimize $a^2+b^2$?

Answer: 
Hint:

$$2(a^2 + b^2) = (a + b)^2 + (a - b)^2 = 23^2 + (a - b)^2.$$

So to maximize (minimize) $a^2 + b^2$, you should maximize (minimize) $(a - b)^2$.
Hint:
$$a^2+b^2=(a+b)^2-2ab=23^2-2ab$$Now, it is enough to find the maximum and minimum value of $ab$.