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!
 A: For simplicity let our sphere be centred on the origin where $r=3m$, this gives us: $$f(x,y,z): x^2+y^2+z^2=r^2$$
for our constraint funtion, with
$$V(B)  =\prod_{i=1}^n (b_i -a_i)\to V(3)=2^3xyz$$
for the volume of a cuboid centred at the origin.
Using these we define our Lagrangian to be:
$$\mathcal{L}(x,y,z)=2^3xyz-\lambda(x^2+y^2+z^2-9m^2)$$
Now solving for $\Delta\mathcal{L}(x,y,z)=0$ we obtain
$$\frac{\partial\mathcal{L}}{\partial x}=0 \to4yz=\lambda x \ \ (1)$$
$$\frac{\partial\mathcal{L}}{\partial y}=0 \to4xz=\lambda y \ \ (2)$$
$$\frac{\partial\mathcal{L}}{\partial z}=0 \to4xy=\lambda z \ \ (3)$$
and our final constraint equation $x^2+y^2+z^2=9m^2$. We begin by computing
$$\frac{(1)}{(2)} \to \frac{y}{x}=\frac{x}{y} \to x^2=y^2$$
Similarly, computing
$$\frac{(2)}{(3)}\to y^2=z^2$$
Which then leaves us with $x^2=y^2=z^2$. Now, returning to our constraint equation we get:
$$3x^2=9m^2 \ \text{which leaves us with} \ x=\sqrt{3}m$$
Thus, the maximal volume is given by $f(\sqrt{3}m,\sqrt{3}m,\sqrt{3}m)=24\sqrt{3}m^3$, thereby verifying your answer using LGM.
A: 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$)
