<s>[INST] If $a + b = 20$, then what is the maximum value of $ab^2$? Knowing that
$$a + b = 20$$
and $a,b \in \mathbb{Z}_{+}$
What is the maximum value that $ab^2$ can take?
If $b$ is even then so is $a$. Hence, let $b = 2k$ and $a = 20 - 2k$, where $k \in \{1, 2, 3, \cdots, 9\}$
$$ab^2 = (20 - 2k)(2k)^2 = 80k^2 - 8k^3$$
The value of $k$ which maximizes $ab^2$ is therefore $k = 7$ which gives $ab^2 = 1176$.
However this only shows that this is the maximum for even values of $a$ and $b$. It turns out that the maximum of $ab^2$ is when both are odd. 
How do I solve this question since my approach is clearly not very elegant? 
My solution:
$$a = 20 - b \Longrightarrow ab^2 = (20 - b)b^2$$
Differentiate to find the maximum value of $b$
$$40b - 3b^2 = b(40-3b) = 0$$ 
$$\Longrightarrow b = \left\lfloor \frac{40}{3} \right\rfloor$$ $$\Longrightarrow b = \left\lceil \frac{40}{3} \right\rceil$$
Therefore $a, b = 7, 13$ or $a, b = 6, 14$. Inspecting these $2$ cases yields the former.
So the maximum value $ab^2$ can take is $1183$.
 [/INST] If $a$ and $b$ are required to be positive, but not integers, then the AM-GM says that
$$
\frac{a+\frac b2+\frac b2}3\geq\sqrt[3]{a\cdot\frac b2\cdot\frac b2}
$$
with equality iff $a=\frac b2=\frac b2$. For $a,b$ integers, you just have to try the integers closest to this equality (i.e. $a=6$ and $a=7$).
</s>