What is the maximum volume of a cylinder that can fit in a sphere of a constant radius?

Let $R$ be the radius of the sphere and let $h$ be the height of the cylinder centered on the center of the sphere. By the Pythagorean theorem, the radius of the cylinder is given by $$ r^2 = R^2 - \left(\frac{h}{2}\right)^2. $$

The volume of the cylinder is hence $$ \begin{align} V &= \pi r^2 h\\ &= \pi \left(h R^2 - \frac{h^3}{4}\right). \end{align} $$

Differentiating with respect to $h$ and equating to $0$ to find extrema gives $$ \frac{dV}{dh}=\pi \left(R^2 - \frac{3h^2}{4}\right) = 0\\ \therefore h_0 = \frac{2R}{\sqrt{3}} $$

The second derivative of the volume with respect to $h$ is negative if $h>0$ such that the volume is maximal at $h = h_0$. Substituting gives $$ V_{max}=\frac{4 \pi R^3}{3\sqrt{3}}. $$


Hint: In the context of a calculus course, I think you are first expected to argue informally that such a maximal cylinder must have axis that goes through the center of the circle, and that without loss of generality that axis is the $z$-axis.

So now suppose that the cylinder meets the $x$-$y$ plane in a circle of radius $t$. Find the height of the cylinder in terms of $t$, and hence the volume. Now use the ordinary tools to maximize.