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

Answer: 
If $a+b = 23$ then $b=23-a$. So just maximize and minimize $2a^2-46a+23^2$ (for $0\le a \le 23$) using calculus.
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$.