Rectangular boxes: handle with care

A rectangular box (aka parallelepiped) looks like a sturdy object:

Rainbow sheep inside
Rainbow sheep inside

But this particular box, with dimensions 7.147 by 6.021 by 4.095, took me the better part of an hour to figure out.

It was a part of a numerical methods assignment: find the dimensions of a box with given volume {V}, surface area {S}, and diameter {D} (i.e., space diagonal). Algebraic approach leads to pretty ugly expressions, which is the motivation for a numerical method. Specifically, the task was to apply the Newton-Raphson method to the map

\displaystyle    F(x,y,z) = \begin{pmatrix} xyz-V  \\ 2(xy+yz+xz)-S  \\ x^2+y^2+z^2-D^2 \end{pmatrix}

Of course, I understood that not every triple {(V,S,D)} is attainable. Also realized that the Jacobian of {F} is degenerate when two of the coordinates coincide, which is a problem for the method. So I thought: let’s generate some random {x,y,z} values that are not too close to one another, and give students the resulting parameters {V,S,D}.

With {x=7.147}, {y=6.021}, and {z=4.095} the parameters are {V=176.216}, {S=193.91}, and {D=10.203}. Sure, a little rounding can’t hurt when numbers are of this size and we are quite far from the critical points of {F}. So I put {V=176}, {S=194} and {D=10} in one of the versions of the assignment.

But the Newton-Raphson method would not converge… because no such box exists! The rounding did hurt after all.

This motivated me to describe all attainable triples {(V,S,D)} explicitly, which ended up being less of a chore than I expected. It helps to realize that {(x+y+z)^2 = D^2+S}, which reduces the search to the intersection of the sphere {x^2+y^2+z^2=D^2} with the plane {x+y+z=\sqrt{D^2+S}}. This is a circle (called {C} below), and the allowed range for {V} is between the minimum and maximum of {xyz} on {C}.

This goes into Calculus 3 territory. Using Lagrange multipliers with two constraints looks like a tedious job. Instead, I decided to parametrize {C}. Its center is {(c,c,c)} where {c=\dfrac13\sqrt{D^2+S}}. The radius is {\displaystyle r = \sqrt{ D^2 - \frac13(D^2+S)}=\frac13 \sqrt{6D^2-3S}}. We also need an orthonormal basis of the subspace {x+y+z=0}: the vectors

\displaystyle  \frac{1}{\sqrt{6}} \langle 2, -1, -1\rangle \quad \text{and}\quad \frac{1}{\sqrt{2}} \langle 0, 1, -1\rangle

do the job.

So, the circle {C} is parametrized by

\displaystyle    x  = c+\frac{2r}{\sqrt{6}} \cos t \\   y  = c-\frac{r}{\sqrt{6}} \cos t +\frac{r}{\sqrt{2}} \sin t \\   z  = c-\frac{r}{\sqrt{6}} \cos t -\frac{r}{\sqrt{2}} \sin t

This is not as bad as it looks: the product {xyz} simplifies to

\displaystyle xyz = c^3 - \frac{cr^2}{2} + \frac{r^3\sqrt{6}}{18} \cos 3t

which tells us right away that the volume {V} lies within

\displaystyle  c^3 - \frac{cr^2}{2} \pm \frac{r^3\sqrt{6}}{18}

In terms of the original data {S,D} the bounds for {V} take the form

\displaystyle    \frac{5S-4D^2}{54}\sqrt{S+D^2} \pm \frac{\sqrt{2}}{54} (2D^2-S)^{3/2}

(And of course, {V} cannot be negative even if the lower bound is.) It is easy to see that {2D^2-S\ge 0} with equality only for a cube; however {2D^2-S} can be relatively small even when the box does not look very cube-ish. For the box pictured above, the tolerance {\frac{\sqrt{2}}{54} (2D^2-S)^{3/2}} is approximately {1.4}; after rounding {S\approx 194 } and {D\approx 10} this drops to {0.38}, and the desired volume of {176} is way out of the allowable range {181\pm 0.38}.

Yes, the set of attainable triples {(V,S,D)} is quite thin. Parallelepipeds are fragile objects: handle them with care.

Attainable (V,S,D)
Attainable (V,S,D)

Intrinsic diameter

The length of a circle is L. What is its diameter? The answer could be L/\pi if one uses the metric induced by the standard embedding into the plane. But a geometer is more likely to answer L/2, referring to the intrinsic distance: the infimal length of paths joining two points. From this point of view, all simple closed curves of length L are isometric, and in particular all of them have length L/2.

Intrinsic diameter of a closed curve

In this post, the words distance and diameter will always refer to the intrinsic version.

Here’s a less smooth but still very reasonable (Lipschitz) curve: boundary of a rectangle. Once again, the diameter is half of the perimeter. Such is the distance between two diagonally opposite vertices, marked red and green below.

A pair of opposite vertices realizes the diameter

Let’s move one dimension up: multiply a curve of length L by a line segment of length h to obtain a cylinder. The diameter is \sqrt{L^2/4+h^2}, as one sees by cutting the cylinder and flattening it.

The 2-dimensional analog of the rectangulary boundary is the surface of a rectangular box, denoted S. Let a\le b\le c be its dimensions. Any two points on S lie in a cylinder with height h\in\lbrace a,b,c\rbrace and circumference 2(a+b+c-h). The diameter of such a cylinder is greatest when h=a, which yields \mathrm{diam}\,S\le \sqrt{a^2+(b+c)^2}. On the other hand, the endpoints of any spatial diagonal of the box are at distance \sqrt{(a+b)^2+c^2} from each other, as one can see by cutting a few edges and flattening the box. Thus,

\displaystyle (*) \qquad \sqrt{(a+b)^2+c^2}\le \mathrm{diam}\,S\le \sqrt{a+(b+c)^2}

In particular, the cube a=b=c has diameter a\sqrt{5}, attained by any pair of centrally symmetric vertices. This can be seen directly from the sketch below (by symmetry, one of two points may be assumed to be within the orange triangle).

Unwrapped cube

But for boxes other than cubes the estimate (*) has some room in it. Intuition may suggests that centrally symmetric vertices is where the diameter is to be found, i.e., that \sqrt{a+(b+c)^2} is the true value. However, this is disproved by french fry 1\times \epsilon\times \epsilon. The distance between opposite vertices is \sqrt{1+4\epsilon^2}=1+O(\epsilon^2) while the distance between the centers of square faces is 1+\epsilon.

French fry

For more general boxes one can think of other candidates for diameters, such as this pair of black points, which are at distance \sqrt{(a+c)^2+(b-a)^2}. Unfortunately I don’t have the right degree to handle this stuff.


So, what is the intrinsic diameter of the surface of a box? The answer was given by Ю.Г. Никоноров and Ю.В. Никонорова in The intrinsic diameter of the surface of a parallelepiped (2008), and it’s a bit more complicated than one could have expected:

Intrinsic diameter of a box