Distance between matrix and vector subspace

linear algebrasolution-verification

Consider a vector space of matrices $V=M_2(\mathbb R)$ with inner product $\langle A,B\rangle=tr(B^tA)$.

Given a subspace $W=\text{Span}\left\{ \left [ \begin{matrix}
0 & 1 \\
-1 & 0 \\
\end{matrix} \right ] , \left [ \begin{matrix}
1 & 0 \\
0 & 1 \\
\end{matrix} \right ] \right\}$
,
and a matrix
$A= \left [ \begin{matrix}
1 & 2 \\
3 & 4 \\
\end{matrix} \right ] \in V,$
find the distance of $A$ from $W$.

My solution :

An orthonormal basis of $W$ is $\left\{w_{1}= \left [ \begin{matrix}
0 & \frac{1}{\sqrt{2}} \\
-\frac{1}{\sqrt{2}} & 0 \\
\end{matrix} \right ] w_{2}=\left [ \begin{matrix}
\frac{1}{\sqrt{2}} & 0 \\
0 & \frac{1}{\sqrt{2}} \\
\end{matrix} \right ] \right\}.$

Find another $2$ matrices for basis of $V – W$ :
$\left\{w_{3}=\left [ \begin{matrix}
0 & \color{}{-}\frac{1}{\sqrt{2}} \\
\frac{1}{\sqrt{2}} & 0 \\
\end{matrix} \right ] w_{4}=\left [ \begin{matrix}
\frac{-1}{\sqrt{2}} & 0 \\
0 & \frac{1}{\sqrt{2}} \\
\end{matrix} \right ] \right\}.$

The projection of $A$ onto $W$ is $xw_1+yw_2$, with coefficients $x=\langle w_{1},A\rangle = \sqrt2$ and $y=\langle w_{2},A\rangle = \frac{5}{\sqrt 2}.$

So we have the squared distance between of $A$ from $W$ being $D_{A_W}^2=||{A}-x w_{1} -y w_{2}||^2 = ||{A}||^2-|x|^2-|y|^2=30-2-\frac{25}{2}=\frac{31}{2}$, giving $D_{A_W}=\sqrt\frac{31}{2}.$

Is it correct?

Best Answer

Your method is correct. However, you made an error when computing a coefficient ($x$).

The correct coefficient should be $x = -\frac{1}{\sqrt{2}}$.

Thus the squared distance should turn out to be $30 - \frac12 - \frac{25}{2} = 17$. (So $d(A, W) = \sqrt{17})$

Finding the basis for $V - W$ was unnecessary. (You made an error there anyway: your $w_3$ is parallel to $w_1$.

As a side (but important) note, please explain your notation with words and not just formulas. I have edited your question for clarity.