I’ll try a more geometric optimization problem: what is the largest rectangular prism that can fit in a sphere of radius \(r\text{?}\) I’ll assume that the prism is centrally located in the sphere, which means that its shape is entirely determined by one of its vertices on the edge of the sphere. If that vertex is \((x,y,z)\text{,}\) then the volume of the prism is \(2x \times 2y \times 2z\text{.}\)
I’d like to work in spherical coordinates instead of \(x\text{,}\) \(y\) and \(z\text{.}\) The radius \(r\) is fixed, but \(\theta\) (longitude) and \(\phi\) (colatitude) will vary.
\begin{align*}
h \amp = 2r \cos \phi\\
w \amp = 2r \sin \phi \cos \theta\\
l \amp = 2 r \sin \phi \sin \theta\\
V \amp = hwl = 8r^3 \cos \phi \sin^2 \phi \cos \theta
\sin \theta = 4 r^3 \sin (2\theta) (\cos \phi - \cos^3
\phi)
\end{align*}
Then I can optimize the function \(V(\theta, \phi)\text{.}\)
\begin{align*}
\frac{\del V}{\del \phi} \amp = 4r^3 \sin (2\theta) (-
\sin \phi + 3 \cos^2 \phi \sin \phi)\\
\frac{\del V}{\del \theta} \amp = 8r^3 \cos 2 \theta
(\cos \phi - \cos^3 \phi)\\
\nabla V \amp = 0 \implies (\phi, \theta) = \left(
\arccos \frac{1}{\sqrt{3}}, \frac{\pi}{4} \right)\\
V \amp = 4t^3 \sin \frac{\pi}{2} \left(
\frac{1}{\sqrt{3}} - \frac{1}{3\sqrt{3}} \right) =
\frac{8r^3}{3\sqrt{3}}
\end{align*}
I didn’t do the calcluation, but it is reasonable to check that the critical point represents a maximum. The resulting area is the area of cube of side length \(\frac{2r}{\sqrt{3}}\text{,}\) which seems, intuitively, like the right kind of length.