[Math] Finding distance between a vector and a subspace

linear algebra

Let the inner product of $V=M_3(\mathbb{R})$ to be $\langle A,B\rangle =\mathrm{trace} (A^tB)$.

I need to fine the distance between $X= \begin{pmatrix}
2 & 1 &0 \\
0&-1 &2 \\
1& 0 & 1
\end{pmatrix}$ and the subspace $U= \bigl\{A\mid \mathrm{trace}(A)=0\bigr\}$ of $V$.

From what I know I can find it by calculating $\left\lVert\frac{\langle w,A\rangle w}{\lVert w\rVert^2}\right\rVert$ where $\mathrm{span}(w)=U^\perp $, but how can I find $w$, and why should it be only one vector only?

Best Answer

The trace is a linear map from $V$ onto $\mathbb{R}$; that means that $U$ has dimension $8$, since it is equal to the kernel of this map.

The orthogonal complement will then be spanned by a single vector. You can find such a vector by finding one which is orthogonal to each vector in a basis for $U$. For example, you can take as your basis $E_{12}$, $E_{13}$, $E_{21}$, $E_{23}$, $E_{31}$, $E_{32}$, $E_{11}-E_{22}$, and $E_{11}-E_{13}$. This will give you information about $w$.

For instance, the fact that $\langle E_{12},w\rangle = 0$ tells you that the $(1,2)$ entry of $w$ must be equal to $0$. Using the rest of the basis, you should get all the information you need about the structure of $w$.

Or you could realize that there is a very special set of matrices $M$ such that for all $A$, $\mathrm{trace}(A)=0$ if and only if $\mathrm{trace}(M^tA) = 0$, and go from there. Hint. Do you know some family of matrices for which it is easy to compute the trace of $M^tA$ in terms of the trace of $A$?

Related Question