Distance between two affine subspaces¶
Theorem 7.59 (Related exercises: Exercise 7.23)
Let \(X = v+ W\), \(X' = v' + W'\) be two affine subspaces. Let us write \(d := v-v'\) and \(Z := W + W'\) (Definition 3.36). Let
be the orthogonal projection of \(d\) onto \(Z^\bot\) (Corollary 7.34).
For two points \(x \in X\) and \(x' \in X'\) the following are equivalent:
-
\(x - x' = m\).
-
\(d(x,x') = |\hspace{-0.5mm}| {m} |\hspace{-0.5mm}|\).
-
\(x\) and \(x'\) realize the minimal distance of \(X\) and \(X'\), i.e., \(d(x, x') = d(X, X')\).
-
The vector \(x - x'\) is orthogonal to \(W\) and to \(W'\) (i.e., \(x-x'\) is orthogonal to any \(w \in W\), \(w' \in W'\)).
In particular, \(X\) intersects \(X'\) if and only if \(d \in Z\).
Proof. Here is a picture of the geometric ideas in the proof. For simplicity of the picture, we choose \(v' = 0\), so that \(X' = W'\) and \(d = v\).

1. \(\Rightarrow\) 2. is obvious since \(d(x,x') = |\hspace{-0.5mm}| {x-x'} |\hspace{-0.5mm}|\).
We next prove the equivalence 3. \(\Leftrightarrow\) 2.. We write a point \(x \in X\) as \(x = v + w\) with an arbitrary vector \(w \in W\). Likewise, \(x' = v' + w'\). We then have
The vector \(w-w'\) is an arbitrary vector in the sum \(Z = W + W'\) (notice that for any \(w' \in W'\), also \(-w' \in W'\)).
Therefore, we are seeking the point \(z \in Z = W + W'\) such that \(|\hspace{-0.5mm}| {d+z} |\hspace{-0.5mm}|\) is minimal. This is just the distance of the affine subspace \(d + Z\) to the origin. According to Proposition 7.45, this distance is given by \(|\hspace{-0.5mm}| {m} |\hspace{-0.5mm}| = |\hspace{-0.5mm}| {p_{Z^\bot}(d)} |\hspace{-0.5mm}| = |\hspace{-0.5mm}| {d - p_Z(d)} |\hspace{-0.5mm}|\), and \(m\) is the unique vector in \(Z\) realizing that minimal distance. This shows the equivalence of 3. and 2..
3. \(\Rightarrow\) 4.: let \(x \in X\) and \(x' \in X'\) be two points realizing that minimal distance: \(d(x,x') = |\hspace{-0.5mm}| {m} |\hspace{-0.5mm}|\). In particular, this means that \(x' \in X'\) is the point realizing the minimal distance to \(x\). Again by Proposition 7.45, \(x'-x\) is therefore orthogonal to \(W'\). Switching the role of \(X\) and \(X'\) we obtain similarly that \(x-x'\) is orthogonal to \(W\).
4. \(\Rightarrow\) 1.: Our assumption means that
To see the latter equality note that some vector is orthogonal to \(W + W'\) precisely if it is orthogonal to \(W\) and to \(W'\), by the bilinearity of \({\left \langle -, - \right \rangle}\). We use this remark as follows: from
we get
By the unicity of the representation of \(d\) as a sum of a vector in \(Z^\bot\) and one in \(Z\), this means that \(x-x' = p_{Z^\bot}(d) = m\). ◻
Example 7.60
We consider the two lines in \({\bf R}^3\)
The general vectors of \(X\) and \(X'\) are of the following form, for \(a, b \in {\bf R}\).
We compute the minimal distance of \(X\) and \(X'\) by considering the condition \(x - x' \bot (1,1,-2)\) and \(x - x' \bot (0,2,4)\). This gives the following homogeneous linear system
This can be solved to \(b = \frac 47\) and \(a = - \frac 5 {21}\). The points \(x\) and \(x'\) and their distance is then readily computed.