math and physics play

Evaluating a sum using a contour integral.

December 18, 2024 math and physics play 1 comment , , , , , , , , ,

[Click here for a PDF version of this post]

One of my favorite Dover books, [1], is a powerhouse of a reference, and has a huge set of the mathematical tricks and techniques.  Probably most of the tricks that any engineer or physicist would ever want.

Reading it a bit today, I encountered the following interesting looking theorem for evaluating sums using contour integrals.

Theorem 1.1:

Given a meromorphic function \( f(z) \) that shares no poles with \( \cot( \pi z ) \), where \( C \) encloses the zeros of \( \sin( \pi z \), located at \( z = a, a+1, \cdots b \), then
\begin{equation*}
\sum_{m=a}^b f(m) = \inv{2 \pi i} \oint_C \pi \cot( \pi z ) f(z) dz -\quad \sum_{\mbox{poles of \( f(z) \) in \( C \)}} \mathrm{Res}\lr{ \pi \cot( \pi z ) f(z) }.
\end{equation*}

The enclosing contour may look like fig. 1.

fig. 1. Sample contour

Start proof:

We basically want to evaluate
\begin{equation}\label{eqn:sumUsingContour:20}
\oint_C \pi \cot( \pi z ) f(z) dz,
\end{equation}
using residues. To see why this works, observe that \( \cot( \pi z ) \) is periodic, as plotted in fig. 2.

fig. 2. Cotangent.

In particular, if \( z = m + \epsilon \), we have
\begin{equation}\label{eqn:sumUsingContour:40}
\begin{aligned}
\cot(\pi z)
&= \frac{\cos(\pi(m + \epsilon))}{\sin(\pi(m + \epsilon))} \\
&= \frac{(-1)^m \cos(\pi \epsilon)}{(-1)^m \sin(\pi \epsilon)} \\
&= \cot(\pi \epsilon).
\end{aligned}
\end{equation}
The residue of \( \pi \cot(\pi z) \), at \( z = 0 \), or at any other integer point, is
\begin{equation}\label{eqn:sumUsingContour:60}
\frac{\pi}{
\pi z – (\pi z)^3/6 + \cdots
}
= 1.
\end{equation}
This means that we have
\begin{equation}\label{eqn:sumUsingContour:80}
\oint_C \pi \cot( \pi z ) f(z) dz = 2 \pi i \sum_{m = a}^b f(m) + 2 \pi i \quad \sum_{\mbox{poles of \( f(z) \) in \( C \)}} \mathrm{Res}\lr{ \pi \cot( \pi z ) f(z) }.
\end{equation}
We just have to rearrange and scale to complete the proof.

End proof.

In the book the sample application was to use this to show that
\begin{equation}\label{eqn:sumUsingContour:100}
\coth x – \inv{x} = \sum_{m=1}^\infty \frac{2x}{x^2 + m^2 \pi^2}.
\end{equation}
That’s then integrated to show that
\begin{equation}\label{eqn:sumUsingContour:120}
\frac{\sinh x}{x} = \prod_{m = 1}^\infty \lr{ 1 + \frac{x^2}{m^2 \pi^2} },
\end{equation}
or with \( x = i \theta \),
\begin{equation}\label{eqn:sumUsingContour:140}
\sin \theta = \theta \prod_{m = 1}^\infty \lr{ 1 – \frac{\theta^2}{m^2 \pi^2} },
\end{equation}
and finally equating \( \theta^3 \) terms in this infinite product, we find
\begin{equation}\label{eqn:sumUsingContour:160}
\sum_{m = 1}^\infty \inv{m^2} = \frac{\pi^2}{6},
\end{equation}
which is \( \zeta(2) \), a specific value of the Riemann zeta function.

All this is done in a couple spectacularly dense pages of calculation, and illustrates the kind of gems in this book. At about 700 pages, it’s got a lot of gems.

References

[1] F.W. Byron and R.W. Fuller. Mathematics of Classical and Quantum Physics. Dover Publications, 1992.

Shortest distance between lines

December 14, 2024 math and physics play 2 comments , , , , , , ,

[Click here for a PDF version of this post]

Motivation.

Having just worked one of Karl’s problems for the distance between two parallel planes, I recalled that when I was in high school, I had trouble with the intuition for the problem of shortest distance between two lines.

In this post, I’ll revisit that ancient trouble and finally come to terms with it.

Distance from origin to a line.

Before doing the two lines problem, let’s look at a similar simpler problem, the shortest distance from the origin to a line. The parametric representation of a line going through point \( \Bp \) with (unit) direction vector \( \mathbf{\hat{d}} \) is
\begin{equation}\label{eqn:shortestDistanceBetweenLines:40}
L: \Bx(r) = \Bp + r \mathbf{\hat{d}}.
\end{equation}
If we want to solve this the dumb but mechanical way, we have only to minimize a length-squared function for the distance to a point on the line
\begin{equation}\label{eqn:shortestDistanceBetweenLines:60}
\begin{aligned}
D
&= \Norm{\Bx}^2 \\
&= \Bp^2 + r^2 + 2 r \Bp \cdot \mathbf{\hat{d}}.
\end{aligned}
\end{equation}
The minimum will occur where the first derivative is zero
\begin{equation}\label{eqn:shortestDistanceBetweenLines:80}
\begin{aligned}
0
&= \PD{r}{D} \\
&= 2 r + 2 \Bp \cdot \mathbf{\hat{d}},
\end{aligned}
\end{equation}
so at the minimum we have
\begin{equation}\label{eqn:shortestDistanceBetweenLines:100}
r = -\Bp \cdot \mathbf{\hat{d}}.
\end{equation}
This means the vector to the nearest point on the line is
\begin{equation}\label{eqn:shortestDistanceBetweenLines:120}
\begin{aligned}
\Bx
&= \Bp – \lr{ \Bp \cdot \mathbf{\hat{d}} }\mathbf{\hat{d}} \\
&= \Bp \mathbf{\hat{d}}^2 – \lr{ \Bp \cdot \mathbf{\hat{d}}}\mathbf{\hat{d}} \\
&= \lr{ \Bp \wedge \mathbf{\hat{d}} } \mathbf{\hat{d}},
\end{aligned}
\end{equation}
or for \(\mathbb{R}^3\)
\begin{equation}\label{eqn:shortestDistanceBetweenLines:140}
\Bx
= -\lr{ \Bp \cross \mathbf{\hat{d}} } \cross \mathbf{\hat{d}}.
\end{equation}

fig. 1. Directed distance from origin to line.

The geometry of the problem is illustrated in fig. 1.

Observe that all the calculation above was superfluous, as observation of the geometry shows that we just wanted the rejection of \( \mathbf{\hat{d}} \) (green) from \( \Bp \) (blue), and could have stated the result directly.

Distance between two lines.

Suppose that we have two lines, specified with a point and direction vector for each line, as illustrated in fig. 2
\begin{equation}\label{eqn:shortestDistanceBetweenLines:20}
\begin{aligned}
L_1&: \Bx(r) = \Bp_1 + r \mathbf{\hat{d}}_1 \\
L_2&: \Bx(s) = \Bp_2 + s \mathbf{\hat{d}}_2 \\
\end{aligned}
\end{equation}

fig. 2. Two lines, not intersecting.

 

The geometry of the problem becomes more clear if we augment this figure, adding a line with the direction \( \mathbf{\hat{d}}_2 \) to \( L_1 \), and adding a line with the direction \( \mathbf{\hat{d}}_1 \) to \( L_2 \), as illustrated in fig. 3, and then visually extending each of those lines to planes that pass through the respective points. We can now rotate our viewpoint so that we look at those planes on edge, which shows that the problem to solve is really just the distance between two parallel planes.

fig 3a. Augmenting the lines with alternate direction vectors to form planes.

fig 3b. Rotation to view planes edge on.

The equations of these planes are just
\begin{equation}\label{eqn:shortestDistanceBetweenLines:160}
\begin{aligned}
P_1&: \Bx(r, s) = \Bp_1 + r \mathbf{\hat{d}}_1 + s \mathbf{\hat{d}}_2 \\
P_2&: \Bx(t, u) = \Bp_2 + t \mathbf{\hat{d}}_2 + u \mathbf{\hat{d}}_1,
\end{aligned}
\end{equation}
or with
\begin{equation}\label{eqn:shortestDistanceBetweenLines:180}
\mathbf{\hat{n}} = \frac{\mathbf{\hat{d}}_1 \cross \mathbf{\hat{d}}_2}{\Norm{\mathbf{\hat{d}}_1 \cross \mathbf{\hat{d}}_2}},
\end{equation}
the normal form for these planes are
\begin{equation}\label{eqn:shortestDistanceBetweenLines:200}
\begin{aligned}
P_1&: \Bx \cdot \mathbf{\hat{n}} = \Bp_1 \cdot \mathbf{\hat{n}} \\
P_2&: \Bx \cdot \mathbf{\hat{n}} = \Bp_2 \cdot \mathbf{\hat{n}}.
\end{aligned}
\end{equation}
Now we can state the distance between the planes trivially, using the results from our previous posts, finding
\begin{equation}\label{eqn:shortestDistanceBetweenLines:220}
d = \Abs{ \Bp_2 \cdot \mathbf{\hat{n}} – \Bp_1 \cdot \mathbf{\hat{n}} },
\end{equation}
or, encoding the triple product in it’s determinant form, the shortest distance between the lines (up to a sign), is
\begin{equation}\label{eqn:shortestDistanceBetweenLines:240}
\boxed{
d = \frac{
\begin{vmatrix}
\Bp_2 – \Bp_1 & \mathbf{\hat{d}}_1 & \mathbf{\hat{d}}_2
\end{vmatrix}
}{
\Norm{ \mathbf{\hat{d}}_1 \cross \mathbf{\hat{d}}_2 }
}.
}
\end{equation}

As a minimization problem.

Trying this as a minimization problem is actually kind of fun, albeit messy. Doing that calculation will give us the directed shortest distance between the lines.
We can form any number of vectors \( \Bm \) connecting the two lines
\begin{equation}\label{eqn:shortestDistanceBetweenLines:260}
\Bp_1 + s \mathbf{\hat{d}}_1 + \Bm = \Bp_2 + t \mathbf{\hat{d}}_2,
\end{equation}
or, with \( \Delta = \Bp_2 – \Bp_1 \), that directed distance is
\begin{equation}\label{eqn:shortestDistanceBetweenLines:280}
\Bm = \Delta + t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1.
\end{equation}
We seek to minimize the squared length of this vector
\begin{equation}\label{eqn:shortestDistanceBetweenLines:300}
D = \Norm{\Bm}^2 = \Delta^2 + \lr{ t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1 }^2 + 2 \Delta \cdot \lr{ t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1 }.
\end{equation}
The minimization constraints are
\begin{equation}\label{eqn:shortestDistanceBetweenLines:320}
\begin{aligned}
0 &= \PD{s}{D} = 2 \lr{ t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1 } \cdot \lr{ -\mathbf{\hat{d}}_1 } + 2 \Delta \cdot \lr{ – \mathbf{\hat{d}}_1 } \\
0 &= \PD{t}{D} = 2 \lr{ t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1 } \cdot \lr{ \mathbf{\hat{d}}_2 } + 2 \Delta \cdot \lr{ \mathbf{\hat{d}}_2 }.
\end{aligned}
\end{equation}
With \( \alpha = \mathbf{\hat{d}}_1 \cdot \mathbf{\hat{d}}_2 \), our solution for \( s, t \) is
\begin{equation}\label{eqn:shortestDistanceBetweenLines:340}
\begin{bmatrix}
s \\
t
\end{bmatrix}
=
{
\begin{bmatrix}
1 & -\alpha \\
-\alpha & 1
\end{bmatrix}
}^{-1}
\begin{bmatrix}
\Delta \cdot \mathbf{\hat{d}}_1 \\
-\Delta \cdot \mathbf{\hat{d}}_2 \\
\end{bmatrix},
\end{equation}
so
\begin{equation}\label{eqn:shortestDistanceBetweenLines:360}
\begin{aligned}
t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1
&=
\begin{bmatrix}
-\mathbf{\hat{d}}_1 & \mathbf{\hat{d}}_2
\end{bmatrix}
\begin{bmatrix}
s \\
t
\end{bmatrix} \\
&=
\inv{1 – \alpha^2}
\begin{bmatrix}
-\mathbf{\hat{d}}_1 & \mathbf{\hat{d}}_2
\end{bmatrix}
\begin{bmatrix}
1 & \alpha \\
\alpha & 1
\end{bmatrix}
\begin{bmatrix}
\Delta \cdot \mathbf{\hat{d}}_1 \\
-\Delta \cdot \mathbf{\hat{d}}_2 \\
\end{bmatrix} \\
&=
\inv{1 – \alpha^2}
\begin{bmatrix}
-\mathbf{\hat{d}}_1 & \mathbf{\hat{d}}_2
\end{bmatrix}
\begin{bmatrix}
\Delta \cdot \mathbf{\hat{d}}_1 – \alpha \Delta \cdot \mathbf{\hat{d}}_2 \\
\alpha \Delta \cdot \mathbf{\hat{d}}_1 -\Delta \cdot \mathbf{\hat{d}}_2 \\
\end{bmatrix} \\
&=
\inv{1 – \alpha^2}
\lr{
-\lr{ \Delta \cdot \mathbf{\hat{d}}_1} \mathbf{\hat{d}}_1 + \alpha \lr{ \Delta \cdot \mathbf{\hat{d}}_2} \mathbf{\hat{d}}_1
+
\alpha \lr{ \Delta \cdot \mathbf{\hat{d}}_1} \mathbf{\hat{d}}_2 – \lr{ \Delta \cdot \mathbf{\hat{d}}_2} \mathbf{\hat{d}}_2
} \\
&=
\inv{1 – \alpha^2}
\lr{
\lr{ \Delta \cdot \mathbf{\hat{d}}_1} \lr{
-\mathbf{\hat{d}}_1 + \alpha \mathbf{\hat{d}}_2
}
+
\lr{ \Delta \cdot \mathbf{\hat{d}}_2} \lr{
-\mathbf{\hat{d}}_2 + \alpha \mathbf{\hat{d}}_1
}
}.
\end{aligned}
\end{equation}
This might look a bit hopeless to simplify, but note that
\begin{equation}\label{eqn:shortestDistanceBetweenLines:380}
\begin{aligned}
\lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2}^2
&=
\lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} \cdot \lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} \\
&=
\mathbf{\hat{d}}_1 \cdot \lr{ \mathbf{\hat{d}}_2 \cdot \lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} } \\
&=
\mathbf{\hat{d}}_1 \cdot \lr{ \alpha \mathbf{\hat{d}}_2 – \mathbf{\hat{d}}_1 } \\
&=
\alpha^2 – 1,
\end{aligned}
\end{equation}
and
\begin{equation}\label{eqn:shortestDistanceBetweenLines:400}
\begin{aligned}
\mathbf{\hat{d}}_2 \cdot \lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} &= \alpha \mathbf{\hat{d}}_2 – \mathbf{\hat{d}}_1 \\
-\mathbf{\hat{d}}_1 \cdot \lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} &= -\mathbf{\hat{d}}_2 + \alpha \mathbf{\hat{d}}_1.
\end{aligned}
\end{equation}
Let’s write \( B = \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2 \), and plug in our bivector expressions
\begin{equation}\label{eqn:shortestDistanceBetweenLines:420}
\begin{aligned}
t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1
&=
-\inv{B^2}
\lr{
\lr{ \Delta \cdot \mathbf{\hat{d}}_1} \mathbf{\hat{d}}_2 \cdot B
-\lr{ \Delta \cdot \mathbf{\hat{d}}_2} \mathbf{\hat{d}}_1 \cdot B
} \\
&=
-\inv{B^2}
\lr{
\lr{ \Delta \cdot \mathbf{\hat{d}}_1} \mathbf{\hat{d}}_2
-\lr{ \Delta \cdot \mathbf{\hat{d}}_2} \mathbf{\hat{d}}_1
}
\cdot B \\
&=
-\inv{B^2}
\lr{
\Delta \cdot \lr{ \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2}
}
\cdot B \\
&=
-\inv{B^2} \lr{ \Delta \cdot B } \cdot B \\
&=
-\inv{B^2} \gpgradeone{ \lr{ \Delta \cdot B } B } \\
&=
-\inv{B^2} \gpgradeone{ \lr{ \Delta B – \Delta \wedge B } B } \\
&=
-\Delta + \inv{B^2} \lr{ \Delta \wedge B } \cdot B.
\end{aligned}
\end{equation}
The minimum directed distance between the lines is now reduced to just
\begin{equation}\label{eqn:shortestDistanceBetweenLines:440}
\begin{aligned}
\Bm
&= \Delta + t \mathbf{\hat{d}}_2 – s \mathbf{\hat{d}}_1 \\
&= \lr{ \Delta \wedge B } \inv{B}.
\end{aligned}
\end{equation}
Again, had we used the geometry effectively, illustrated in fig. 4, we could have skipped directly to this result. This is the rejection of the plane \( B \) from \( \Delta \), that is, rejection of both \( \mathbf{\hat{d}}_1, \mathbf{\hat{d}}_2 \) from the difference \( \Bp_2 – \Bp_1 \), leaving just the perpendicular shortest connector between the lines.

fig. 4. Projection onto the normal to the parallel planes.

We can also conceptualize this as computing the trivector volume (parallelepiped with edges \( \Bp_2 – \Bp_1, \mathbf{\hat{d}}_1, \mathbf{\hat{d}}_2 \)), and then dividing out the bivector (parallelogram with edges \(\mathbf{\hat{d}}_1, \mathbf{\hat{d}}_2 \)), to find the vector (height) of the parallelepiped.

Observe that rejecting from the plane, is equivalent to projecting onto the normal, so for \(\mathbb{R}^3\) we may translate this to conventional vector algebra, as a projection
\begin{equation}\label{eqn:shortestDistanceBetweenLines:500}
\Bm = \lr{\Delta \cdot \mathbf{\hat{n}}} \mathbf{\hat{n}},
\end{equation}
where \( \mathbf{\hat{n}} = \lr{ \mathbf{\hat{d}}_1 \cross \mathbf{\hat{d}}_2 }/\Norm{\mathbf{\hat{d}}_1 \cross \mathbf{\hat{d}}_2 } \).

If we want the magnitude of this vector, it’s just
\begin{equation}\label{eqn:shortestDistanceBetweenLines:480}
\begin{aligned}
\Norm{\Bm}^2
&=
\inv{B^4} \lr{ \lr{ \Delta \wedge B } B } \lr{ B \lr{ B \wedge \Delta } } \\
&=
\inv{B^2} \lr{ \Delta \wedge B }^2,
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:shortestDistanceBetweenLines:460}
\boxed{
\Norm{\Bm} = \frac{ \Norm{ \lr{\Bp_2 – \Bp_1} \wedge \mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2 } }{ \Norm{\mathbf{\hat{d}}_1 \wedge \mathbf{\hat{d}}_2} },
}
\end{equation}
which, for \(\mathbb{R}^3\), is equivalent to the triple product result we found above.

Equation of a hyperplane, and shortest distance between two hyperplanes.

December 13, 2024 math and physics play No comments , , , , , , ,

[Click here for a PDF version of this post]

Scalar equation for a hyperplane.

In our last post, we found, in a round about way, that

Theorem 1.1:

The equation of a \(\mathbb{R}^N\) hyperplane, with distance \( d \) from the origin, and normal \( \mathbf{\hat{n}} \) is
\begin{equation*}
\Bx \cdot \mathbf{\hat{n}} = d.
\end{equation*}

Start proof:

Let \( \beta = \setlr{ \mathbf{\hat{f}}_1, \cdots \mathbf{\hat{f}}_{N-1} } \) be an orthonormal basis for the hyperplane normal to \( \mathbf{\hat{n}} \), and \( \Bd = d \mathbf{\hat{n}} \) be the vector in that hyperplane, closest to the origin, as illustrated in fig. 1.

 

fig 1. R^3 plane with normal n-cap

The hyperplane \( d \) distant from the origin with normal \( \mathbf{\hat{n}} \) has the parametric representation
\begin{equation}\label{eqn:hyperplaneGeometry:40}
\Bx(a_1, \cdots, a_{N-1}) = d \mathbf{\hat{n}} + \sum_{i = 1}^{N-1} a_i \mathbf{\hat{f}}_i.
\end{equation}
Equivalently, suppressing the parameterization, with \( \Bx = \Bx(a_1, \cdots, a_{N-1}) \), representing any vector in that hyperplane, by dotting with \( \mathbf{\hat{n}} \), we have
\begin{equation}\label{eqn:hyperplaneGeometry:60}
\Bx \cdot \mathbf{\hat{n}} = d \mathbf{\hat{n}} \cdot \mathbf{\hat{n}},
\end{equation}
where all the \( \mathbf{\hat{f}}_i \cdot \mathbf{\hat{n}} \) dot products are zero by construction. Since \( \mathbf{\hat{n}} \cdot \mathbf{\hat{n}} = 0 \), the proof is complete.

End proof.

Incidentally, observe we can also write the hyperplane equation in dual form, as
\begin{equation}\label{eqn:hyperplaneGeometry:220}
\Bx \wedge (\mathbf{\hat{n}} I) = d I,
\end{equation}
where \( I \) is an \(\mathbb{R}^N\) pseudoscalar (such as \( I = \mathbf{\hat{n}} \mathbf{\hat{f}}_1 \cdots \mathbf{\hat{f}}_{N-1} \)).

Our previous parallel plane separation problem.

The standard \(\mathbb{R}^3\) scalar form for an equation of a plane is
\begin{equation}\label{eqn:hyperplaneGeometry:80}
a x + b y + c z = d,
\end{equation}
where \( d \) looses it’s geometrical meaning. If we form \( \Bn = (a,b,c) \), then we can rewrite this as
\begin{equation}\label{eqn:hyperplaneGeometry:100}
\Bx \cdot \Bn = d,
\end{equation}
for this representation of an equation of a plane, we see that \( d/\Norm{\Bn} \) is the shortest distance from the origin to the plane. This means that if we have a pair of parallel plane equations
\begin{equation}\label{eqn:hyperplaneGeometry:120}
\begin{aligned}
\Bx \cdot \Bn &= d_1 \\
\Bx \cdot \Bn &= d_2,
\end{aligned}
\end{equation}
then the distance between those planes, by inspection, is
\begin{equation}\label{eqn:hyperplaneGeometry:140}
\Abs{ \frac{d_2}{\Norm{\Bn}} – \frac{d_1}{\Norm{\Bn}} },
\end{equation}
which reduces to just \( \Abs{d_2 – d_1} \) if \( \Bn \) is a unit normal for the plane. In our previous post, the problem to solve was to find the shortest distance between the parallel planes given by
\begin{equation}\label{eqn:hyperplaneGeometry:160}
\begin{aligned}
x – y + 2 z &= -3 \\
3 x – 3 y + 6 z &= 1.
\end{aligned}
\end{equation}
The more natural geometrical form for these plane equations is
\begin{equation}\label{eqn:hyperplaneGeometry:180}
\begin{aligned}
\Bx \cdot \mathbf{\hat{n}} &= -\frac{3}{\sqrt{6}} \\
\Bx \cdot \mathbf{\hat{n}} &= \inv{3 \sqrt{6}},
\end{aligned}
\end{equation}
where \( \mathbf{\hat{n}} = (1,-1,2)/\sqrt{6} \), as illustrated in fig. 2.

fig. 2. The two planes.

 

Given that representation, we can find the distance between the planes just by taking the absolute difference of the respective distances to the origin
\begin{equation}\label{eqn:hyperplaneGeometry:200}
\begin{aligned}
\Abs{ -\frac{3}{\sqrt{6}} – \inv{3 \sqrt{6}} }
&= \frac{\sqrt{6}}{6} \lr{ 3 + \inv{3} } \\
&= \frac{10}{18} \sqrt{6} \\
&= \frac{5}{9} \sqrt{6}.
\end{aligned}
\end{equation}

Shortest distance between two parallel planes.

December 13, 2024 math and physics play No comments , , ,

[Click here for a PDF version of this post]

The problem.

Helping Karl with his linear algebra exam prep, he asked me about this problem

Problem:

Find the shortest distance between the two parallel planes, \( P_1 \), and \( P_2 \), with respective equations:
\begin{equation*}
\begin{aligned}
x – y + 2 z &= -3 \\
3 x – 3 y + 6 z &= 1.
\end{aligned}
\end{equation*}

A numerical way to tackle the problem.

A fairly straightforward way to tackle this problem is illustrated in the sketch of fig. 1. If we can find a point in the first plane, we can follow the normal to the plane to the next, and compute the length of that connecting vector.

fig. 1. Distance between two planes.

fig. 1. Distance between two planes.

For this problem, let
\begin{equation}\label{eqn:distanceBetweenPlanes:20}
\Bn = (1,-1,2),
\end{equation}
and rescale the two plane equations to use the same normal. That is
\begin{equation}\label{eqn:distanceBetweenPlanes:40}
\begin{aligned}
\Bx_1 \cdot \Bn &= -3 \\
\Bx_2 \cdot \Bn &= \inv{3},
\end{aligned}
\end{equation}
where \( \Bx_1 \) are vectors in the first plane, and \( \Bx_2 \) are vectors in the second plane. Finding a vector in one of the planes isn’t hard. Suppose, for example, that \( \Bx_0 = (\alpha, \beta, \gamma) \) is a vector in the first plane, then
\begin{equation}\label{eqn:distanceBetweenPlanes:60}
\alpha – \beta + 2 \gamma = -3.
\end{equation}
One solution is \( \alpha = -3, \beta = 0, \gamma = 0 \), or \( \Bx_0 = (-3, 0, 0) \). We can follow the normal from that point to the closest point in the second plane by forming
\begin{equation}\label{eqn:distanceBetweenPlanes:80}
\By_0 = \Bx_0 + k \Bn,
\end{equation}
where \( k \) is to be determined. If \( \By_0 \) is a point in the second plane, we must have
\begin{equation}\label{eqn:distanceBetweenPlanes:100}
\begin{aligned}
\inv{3}
&=
\By_0 \cdot \Bn \\
&=
\lr{ \Bx_0 + k \Bn } \cdot \Bn \\
&=
(-3, 0, 0 ) \cdot (1,-1,2) + k (1,-1,2) \cdot (1,-1,2) \\
&=
-3 + 6 k,
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:distanceBetweenPlanes:120}
k = \frac{10}{18} = \frac{5}{9}.
\end{equation}
This means the point in plane two closest to \( \Bx_0 = (-3,0,0) \) is
\begin{equation}\label{eqn:distanceBetweenPlanes:140}
\begin{aligned}
\By_0
&= (-3, 0, 0 ) + \frac{5}{9} (1,-1,2) \\
&= \inv{9} (-27 + 5, -5, 10) \\
&= \inv{9} (-22, -5, 10),
\end{aligned}
\end{equation}
and the vector distance between the planes is
\begin{equation}\label{eqn:distanceBetweenPlanes:160}
\begin{aligned}
\By_0 – \Bx_0
&= \inv{9} (-22, -5, 10) – (-3, 0, 0 ) \\
&= \inv{9} (-22 + 27, -5, 10) \\
&= \inv{9} (5, -5, 10).
\end{aligned}
\end{equation}
This vector’s length is \( \sqrt{150}/9 = (5/9) \sqrt{6} \), which is the shortest distance between the planes.

A symbolic approach.

Generally, we get more clarity if we avoid plugging in numbers until the very end, so let’s try a generalization of this problem.

Problem:

Find the shortest distance between the two parallel planes, \( P_1 \), and \( P_2 \), with respective equations:
\begin{equation*}
\begin{aligned}
\Bx_1 \cdot \Bn_1 &= d_1 \\
\Bx_2 \cdot \Bn_2 &= d_2.
\end{aligned}
\end{equation*}

We can use the same approach, but first, let’s rescale the two normals. Let
\begin{equation}\label{eqn:distanceBetweenPlanes:180}
\Bn_2 = t \Bn_1,
\end{equation}
or
\begin{equation}\label{eqn:distanceBetweenPlanes:200}
\Bn_1 \cdot \Bn_2 = t \Bn_1^2,
\end{equation}
so
\begin{equation}\label{eqn:distanceBetweenPlanes:220}
\Bn_2 = \frac{\Bn_1 \cdot \Bn_2}{\Bn_1^2} \Bn_1,
\end{equation}
which means that our plane equations are
\begin{equation}\label{eqn:distanceBetweenPlanes:240}
\begin{aligned}
\Bx_1 \cdot \Bn_1 &= d_1 \\
\Bx_2 \cdot \Bn_1 &= \frac{\Bn_1^2}{\Bn_1 \cdot \Bn_2} d_2,
\end{aligned}
\end{equation}
We can further streamline our plane equation representation, setting \( \ncap = \Bn_1/\Norm{\Bn_1} \), which gives us
\begin{equation}\label{eqn:distanceBetweenPlanes:260}
\begin{aligned}
\Bx_1 \cdot \ncap &= \frac{d_1}{\Norm{\Bn_1}} \\
\Bx_2 \cdot \ncap &= \frac{d_2}{\ncap \cdot \Bn_2}.
\end{aligned}
\end{equation}

This time, let’s assume that we can find a point \( \Bx_0 \) in the first plane, but not actually try to find it. We can still follow the normal to the second plane from that point
\begin{equation}\label{eqn:distanceBetweenPlanes:280}
\By_0 = \Bx_0 + k \ncap,
\end{equation}
but since we only care about the vector distance between the planes, we seek
\begin{equation}\label{eqn:distanceBetweenPlanes:300}
\By_0 -\Bx_0 = k \ncap.
\end{equation}
Now, the constant \( k \), once we find it, is exactly the distance between the planes that we seek. Plugging \( \By_0 \) into the \( P_2 \) equation, we find
\begin{equation}\label{eqn:distanceBetweenPlanes:320}
\begin{aligned}
\frac{d_2}{\ncap \cdot \Bn_2}
&=
\lr{ \Bx_0 + k \ncap } \cdot \ncap \\
&=
\Bx_0 \cdot \ncap + k \\
&=
\frac{d_1}{\Norm{\Bn_1}} + k,
\end{aligned}
\end{equation}
or
\begin{equation}\label{eqn:distanceBetweenPlanes:340}
\boxed{
\Abs{k} = \Norm{\By_0 – \Bx_0} = \Abs{ \frac{d_2}{\ncap \cdot \Bn_2} – \frac{d_1}{\ncap \cdot \Bn_1} }.
}
\end{equation}
If \( \Bn_2 = \Bn_1 = \Bn \), then we have
\begin{equation}\label{eqn:distanceBetweenPlanes:360}
\begin{aligned}
\Norm{\By_0 – \Bx_0} &=
\Abs{
\frac{d_2}{\Bn_1^2/\Norm{\Bn_1}} – \frac{d_1}{\Norm{\Bn_1}}
} \\
&=
\frac{\Abs{d_2 – d_1}}{\Norm{\Bn}},
\end{aligned}
\end{equation}
and if \( \Bn \) is a unit normal, this further reduces to just \( \Abs{d_2 – d_1} \).

Let’s try this for the specific problem originally given. We have \( \Bn_1 = \Bn_2 \), so the distance between the planes is
\begin{equation}\label{eqn:distanceBetweenPlanes:380}
\begin{aligned}
\Norm{\By_0 – \Bx_0}
&= \frac{\Abs{1/3 + 3}}{\sqrt{6}} \\
&= \frac{10}{3 \times 6} \sqrt{6} \\
&= \frac{5}{9} \sqrt{6},
\end{aligned}
\end{equation}
as previously calculated.

Eigenvalues of 2×2 matrix: another identity seen on twitter.

December 11, 2024 math and physics play No comments , , , ,

[Click here for a PDF version of this post]

Here’s another interesting looking twitter math post, this time about 2×2 matrix eigenvalues:

Theorem 1.1: Eigenvalues of a 2×2 matrix.

Let \( m \) be the mean of the diagonal elements, and \( p \) be the determinant. The eigenvalues of the matrix are given by
\begin{equation*}
m \pm \sqrt{ m^2 – p }.
\end{equation*}

This is also not hard to verify.

Start proof:

Let
\begin{equation}\label{eqn:2x2eigen:20}
A =
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix},
\end{equation}
where we are looking for \( \lambda \) that satisfies the usual zero determinant condition
\begin{equation}\label{eqn:2x2eigen:40}
\begin{aligned}
0
&= \Abs{ A – \lambda I } \\
&=
\begin{vmatrix}
a – \lambda & b \\
c & d – \lambda
\end{vmatrix} \\
&=
\lr{ a – \lambda } \lr{ d – \lambda } – b c \\
&=
a d – b c – \lambda \lr{ a + d } + \lambda^2 \\
&=
\mathrm{Det}{A} – \lambda \mathrm{Tr}{A} + \lambda^2 \\
&=
\lr{ \lambda – \frac{\mathrm{Tr}{A}}{2} }^2 + \mathrm{Det}{A} – \lr{ \frac{\mathrm{Tr}{A}}{2}}^2,
\end{aligned}
\end{equation}
so
\begin{equation}\label{eqn:2x2eigen:n}
\lambda = \frac{\mathrm{Tr}{A}}{2} \pm \sqrt{ \lr{ \frac{\mathrm{Tr}{A}}{2}}^2 – \mathrm{Det}{A} }.
\end{equation}
substitution of the variables in the problem statement finishes the proof.

End proof.

Clearly the higher dimensional characteristic equation will also have both a trace and determinant dependency as well, but the cross terms will be messier (and nobody wants to solve cubic or higher equations by hand anyways.)