Find the angle between a vector and a linear subspace spanned by vectors I need to find the angle between a vector:
$$(2,2,1,1)$$
and a linear subspace spanned by vectors:
$$(3,4,-4,-1)$$ and $$(0,1,-1,2)$$
I know how to find the angle between two vectors using  scalar product. But not a linear subspace. 
I tried this:
I found a basis of that linear subspace:
$$(3,4)$$
$$(0,1)$$
And then tried to find angle between vector x and any vector constructed with that basis, but it didn't work out
Its from task book, so i know the answer, its 60
 A: Call the vectors that span your subspace $a$ and $b$. Call $X$ the matrix whose columns are those vectors.Then, the projection of the given vector $y=(2,2,1,1)$ onto the subspace is given by
$$
w=X(X^TX)^{-1}X^Ty
$$
Finally, just find the angle between $y$ and $w$ using the dot product.
A: Here is a quite computationally heavy approach:


*

*Let $V$ be the linear span of the vectors $\vec{v}_{1}:=(3,4,−4,−1)$ and $\vec{v}_{2}:=(0,1,−1,2)$. Let $\vec{v}$ be the vector $(2,2,1,1)$.



*Compute an orthonormal basis $(\vec{e}_{1},\vec{e}_{2})$ of $V$ using Gram-Schmidt:
$$\vec{e}_{1}:=\frac{\vec{v}_{1}}{\|\vec{v}_{1}\|},\qquad\vec{e}_{2}:=\frac{\vec{v}_{2}-\frac{\langle\vec{v}_{1},\vec{v}_{2}\rangle}{\langle\vec{v}_{1},\vec{v}_{1}\rangle}\vec{v}_{1}}{\left\|\vec{v}_{2}-\frac{\langle\vec{v}_{1},\vec{v}_{2}\rangle}{\langle\vec{v}_{1},\vec{v}_{1}\rangle}\vec{v}_{1}\right\|}.$$

*Then $p\colon\mathbb{R}^{4}\to\mathbb{R}^{4}$ defined by
$$p(\vec{x}):=\langle\vec{x},\vec{e}_{1}\rangle\vec{e}_{1}+\langle\vec{x},\vec{e}_{2}\rangle\vec{e}_{2}$$
is the orthogonal projection onto $V$.

*The angle $\theta$ between $\vec{v}$ and $V$ is then given by the angle $\theta$ between $\vec{v}$ and $p(\vec{v})$, i.e. 
$$\theta=\arccos\left(\frac{\langle\vec{v},p(\vec{v})\rangle}{\|\vec{v}\|\|p(\vec{v})\|}\right).$$
