source: #youtube https://www.youtube.com/watch?v=R0juw4faGck
tags: #maximum
course: [[Calculus]]b
status: #solved
### Problem
Given $a, b$ are positive integers and $a+b=20$, find $\max \left(a^{2} b\right)$
#### Solution
##### Calculus
Write $b$ in terms of $a$ $b=20-a$
Now finding max of $\left(a^2(20-a)\right)$ or $20a^2-a^3$
This is a cubic $f(a)=20a^2-a^3$ with negative end behavior, so it may have a [[Relative Maximum]] on the interval $[1,19]$.
(it is certainly possible to just try all 19 values of $a$)
Finding the [[Derivative of a function|derivative]] and finding its zeroes.
$f^\prime(a)=40a-3a^2=0$
$a(40-3a)=0$
$a=0 \quad a=\frac{40}{3}=13.\overline3$
Trying the two nearest integers $a$ near the real location of the relative maximum
$f(13)=13^2\cdot7=1183$
$f(14)=14^2\cdot6=1176$
So the maximum value is $\boxed{1183}$
##### AM-GM Inequality
Break the given sum into 3 parts, and use [[AM-GM Inequality]]
$\begin{aligned}a+b=\frac{a}{2}+\frac{a}{2}+b&=20\\
\frac{a}{2}+\frac{a}{2}+b&\geq3\sqrt[3]{\frac{a^2b}{4}}\\
20&\geq3\sqrt[3]{\frac{a^2b}{4}}\\
8000&\geq27\left(\frac{a^2b}{4}\right)\\
1185.\overline{185}=\frac{32000}{27}&\geq a^2b
\end{aligned}$
So the geometric mean has a maximum value of 1185, occurring when $\frac{a}{2},\frac{a}{2},b$ are are equivalent.
$\frac{a}{2}=b\implies a=2b$
And using this in the given sum,
$a+b=2b+b=3b=20\implies b=\frac{20}{3}=7.\overline3$
So the maximum happens at $\boxed7$