[Math] Find the closest point and the distance from vector v to the subspace spanned by the vectors a, b and c

linear algebramatricesvectors

$$ v = \begin{pmatrix} 1 \\ 1 \\ 2 \\ -2\end{pmatrix} $$
$$ a = \begin{pmatrix} 1 \\ 2 \\ -1 \\ 0\end{pmatrix} $$
$$ b = \begin{pmatrix} 0 \\ 1 \\ -2 \\ -1\end{pmatrix}$$
$$ c = \begin{pmatrix} 1 \\ 0 \\ 3 \\ 2\end{pmatrix}$$

according to my textbook, I can find the closest point by using these formulas below

(x is equal to the closest point and A is equal to the matrix that has the vectors a,b and c in it)

x = A * r

r = k^-1 * f

k = A^T * A

f = A^T * v

I found the matrix K, which is written below

$$ k = \begin{pmatrix} 6 & 4 & -2 \\ 4 & 6 & -8 \\ -2 & -8 & 14\end{pmatrix}$$

however, the k matrix does not have an inverse because its determinant is zero, so because it has no inverse, i can't find the closest point x.

Im not sure what else i can do here, is there no point that is close enough to the vector v? or am i misunderstanding something?

Best Answer

The distance minimizer of $v$ to the subspace $W = \operatorname{span}\,\{a, b, c\}$ is precisely the orthogonal projection of $v$ to $W$. Let's find it.

First notice that $c = a - 2b$ so the subspace $W$ is spanned by $\{a,b\}$. Now use the Gram-Schmidt process on $\{a, b\}$ to obtain an orthonormal basis $\{e_1, e_2\}$ for $W$.

$$e_1 = \frac{1}{\sqrt{6}}\begin{pmatrix} 1 \\ 2 \\ -1 \\ 0\end{pmatrix} $$

$$e_2 = -\frac{1}{\sqrt{30}}\begin{pmatrix} 2 \\ 1 \\ 4 \\ 3\end{pmatrix} $$

The orthogonal projection of $v$ to $W$ is given by:

$$Pv = \langle v, e_1\rangle e_1 + \langle v, e_2\rangle e_2 = \frac12 \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1\end{pmatrix}$$

The distance from $v$ to $W$ is precisely the distance from $v$ to $Pv$ since it is the minimizer:

$$\|v - Pv\|_2 = \frac12\left\|\begin{pmatrix} 1 \\ 1 \\ 3 \\ 5\end{pmatrix}\right\|_2 = 3$$