It is well known that for a given volume $V$, a sphere is the shape that minimizes the surface area. I am interested in the same problem under the constraint that the shape must lie between the planes $x=-a$ and $x=a$, i.e. all its points $(x,y,z)$ must have $-a \leq x \leq a$. Obviously, if $V\leq\frac{4}{3}\pi(2a)^3$ then the shape is still a sphere since the sphere with the right volume fits entirely between the planes. However if the volume becomes larger, the sphere can not fit between the planes and it will have to be flattened. **My question is: what is this shape?** This question is about the 3 dimensional case.

From here I'll describe what I have found out so far.

Since the problem is completely symmetric in the $y,z$ directions, the solution can be represented as the rotation of the graph of a function $r(x)$ around the $x$ axis. Then the volume of this function rotated around the $x$ axis will be:

$$V=\int_{-a}^a\pi r(x)^2 dx$$

and the area will be:

$$A = \pi r(-a)^2 + \pi r(a)^2 + \int_{-a}^a2\pi r(x)\sqrt{1+r'(x)^2}dx$$

(the first two terms are for the disk shaped sides pressed against the plane, and the last term is for the surface of revolution between the planes)

Numerical minimization by discretizing $r$ into a piecewise linear function has produced these results:

The final 3D shapes are these 2D shapes rotated around the horizontal axis. From left to right the distance $a$ is decreasing, thus constraining the shapes more and more. The solution appears to be of the form $r(x) = \sqrt{a^2-x^2}+b$, but on closer inspection it seems that this is not the case. The top and bottom are not exact half circles. For the almost spherical case, *and* for the very elongated case (with $a$ small), they are very close to half circles, but in the intermediate case there is quite a bit of difference.

By the method of calculus of variations I have derived a differential equation that $r$ should satisfy:

$$\sqrt{1+r'^2} + \lambda r = \frac{d}{dx} \frac{rr'}{\sqrt{1+r'^2}}$$

Where $\lambda$ is some real number dependent on the parameters of the problem ($V$ and $a$). And indeed, the function $r(x) = \sqrt{a^2-x^2}$ satisfies this equation as expected (indicating that with no constraint the minimal surface is a sphere), but $r(x) = \sqrt{a^2-x^2}+b$ unfortunately does not for $b\neq0$.

It would of course be awesome to have a complete solution, but I would also be very happy with asymptotic special cases, particularly the case where the sphere is only a little compressed (so the case where $V$ is only a little greater than $\frac{4}{3}\pi(2a)^3$, i.e. the green shape in the picture).

Thanks for your help!