<s>[INST] Find the largest volume of a cuboid inside a sphere with radius $3m$ I've solved this one by using geometry, but is there a way of finding the max by using derivatives?
My work:
So, because of geometry it has to be a cube.
The diagonal of a cube is equal to $a\sqrt{3}$ and also to $2r$
So: $a\sqrt{3}=2r$
$a=\dfrac{2r}{\sqrt{3}}$
The volume of a cube is $a^3$, so by  replacing $a$ with the above result, we get:
$V=\dfrac{8r^3}{3\sqrt{3}}$, replace $r$ with $3m$ and we get $V=24\sqrt{3} \;m^3$
Any help would be appreciated!
 [/INST] Consider a sphere with the equation $x^2 + y^2 + z^2 = 9m^2$ with volume generated by $V = 8|x||y||z|$.
Consider $0 \leq A \leq 3m$ such that $x^2 + y^2 = A^2$
To maximize $xy$, it is clear that since $xy =\frac{(x+y)^2 - A^2}{2}$ that a maximum occurs when $x + y$ is maximized.
Since $\frac{d}{dx} (x+y) = \frac{d}{dx}(x + \sqrt{A^2-x^2}) = 1 - \frac{x}{y}$, a maximum occurs when $x = y$
Then $2x^2 + z^2 = 9m^2$ and $V^2 = x^4(9m^2 - 2x^2)$
$\frac{dV^2}{dx} =  x^3(36m^2 - 12x^2)$
$\frac{dV^2}{dx} = 0$ when $x = 0$ or $x^2 = 3m^2$, and clearly since $V = 0$ when $x = 0$, a maximum occurs at $x = \pm \sqrt{3}m$. From the equations found previously, $y = \pm\sqrt{3}m$ and $z = \pm\sqrt{3}m$
Thus $V = 8 \cdot 3\sqrt{3} \cdot m^3 = 24\sqrt{3} \cdot m^3$
(Note: You can also differentiate $xy$ directly to obtain $\sqrt{A^2-x^2} - \frac{x^2}{\sqrt{A^2-x^2}} = y - \frac{x^2}{y}$ which also results in $x = y$)
</s>