## Rectangular boxes: handle with care

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

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.

## Diagonal

The diagonal ${D=\{(x,x):0\le x\le 1\}}$ of the unit square ${Q=[0,1]\times [0,1]}$ is a mysterious thing. For one thing, its length is an irrational number. But this is not what I’m writing about.

The diagonal has zero area. Lebesgue integrable functions on ${Q}$ form the normed space ${L^1(Q)}$ which, upon closer inspection, consists not of functions but of their equivalence classes. Two functions ${f,g}$ are equivalent if the set ${\{f\ne g\}}$ has zero area. In particular, changing all the value of ${f}$ on the diagonal ${D}$ does not change ${f}$ as an element of ${L^1(Q)}$. The logical conclusion is that given an element ${f\in L^1(Q)}$, we have no way to give a meaning to the integral of ${f}$ over ${D}$.

But wait a moment. If I take two square integrable function ${u,v\in L^2[0,1]}$, then the expression ${\int_0^1 u(x)v(x)\,dx}$ makes perfect sense. On the other hand, it represents the integral of the function ${f(x,y)=u(x)v(y)}$ over the diagonal ${D}$.

Pushing this further, if an element ${f\in L^1(Q)}$ can be represented as ${f(x,y)=\sum_{k=1}^n u_k(x)v_k(y)}$ for some ${u_k,v_k\in L^2[0,1]}$, then ${\int_D f}$ is naturally defined as ${\sum_{k=1}^n \int_0^1 u_kv_k}$. I can even take infinite sums, assuming that everything converges.

This is confusing. If I pick up an element of ${L^1(Q)}$ off the sidewalk, how will I know if it’s safe to integrate it over the diagonal? The existence or nonexistence of the decomposition into sum of products is not obvious.

I guess a satisfactory answer is given by the notion of a Lebesgue point. Given ${f\in L^1(Q)}$ and a point ${p}$ of ${Q}$, consider the following statement:

$\displaystyle \exists y_0\in \mathbb R \text{ such that } \lim_{r\rightarrow 0} \frac{1}{r^2} \int_{|x-p|

The validity of (1) and the value of ${y_0}$ are not affected by the choice of a representative of ${f}$. If (1) holds, ${p}$ is called a Lebesgue point of ${f}$, and we can think of ${y_0}$ as the “true” value of ${f(p)}$ (whether or not our representative agrees with that value). It’s a theorem that almost every point of the domain of ${f}$ is a Lebesgue point. The meaning of “almost every” corresponds to the measure under consideration: on the plane it’s the area, on a line it’s the length.

The product ${f(x,y)=u(x)v(y)}$ has a special feature. Since almost every ${x\in [0,1]}$ is a Lebesgue point of ${u}$, and a.e. ${y\in[0,1]}$ is a Lebesgue point of ${v}$, it follows that almost every point of the diagonal (in the sense of linear measure) is a Lebesgue point of the product ${f}$. (It helps to integrate over small squares instead of disks in (1), which does not change anything.) This makes it possible to define ${\int_D f}$ unambigiously.

The sums of products also have the property that almost every point of ${D}$ is a Lebesgue point. And other elements of ${L^1(Q)}$ may also have this property: they are safe to integrate diagonally, too.