Finding the angle between subspace and a vector.

linear algebrasolution-verification

Find the angle between the vector $x=(2,2,1,1)$ and the space formed by the linear combination of the vectors $a_1 = (3,4,-4,-1)$ and $a_2=(0,1,-1,2)$.

I found the vector $y=(3,1,3,1)$ that is perpendicular to both $a_1$ and $a_2$. Then found the angle between $x$ and $y$:
$$\varphi = \arccos\frac{\langle x,y \rangle}{|x||y|}=\arccos\frac{3\sqrt 2}{5}$$
As the answer I took $\pi/2 – \varphi$. Is this correct?


Update: I found this duplicate but could you please help me understand the difference between my solution and that in the link I provided? Why should we find an orthonormal basis as the accepted answer states? It would be appreciated.

Best Answer

EDIT (my original answer was incorrect)

To see why your solution is not correct, I will consider a simpler example. Let $a_1 , a_2$ be such that $span\{ a_1 , a_2 \} = span \{ (1,0,0,0) , (0,1,0,0) \}$. Let $x=(0,0,1,0)$. Then any vector that is perpendicular to combinations of $a_1 , a_2$ is of the form $y = (0,0, y_3 , y_4)$. I will show that your solution can lead to different answers:

  • If you found that $y = (0,0,1,0)$, then $\cos \varphi = \langle y,x\rangle /(\|y \| \| x \|)=1$

  • If you found that $y = (0,0,1,1)$, then $\cos \varphi = \langle y,x\rangle /(\|y \| \| x \|)=1/\sqrt{2}$


To see why the linked answer is correct, notice that they simply compute the orthogonal projection of $x$ onto $span \{ a_1 , a_2 \}$. Denote this projection $y$. Then the angle between $x$ and $y$ is exactly what you are looking for. Note that in order to compute the projection, you need an orthonormal basis (this is how projection is defined)