# "Shortcut" to find the projection of a vector onto a subspace

I understand that to project a vector $$v$$ onto a subspace, I must find an orthogonal basis for the subspace before projecting $$v$$ onto each of the orthogonal vectors and add them all up. However, for higher dimension subspaces, I find it rather cumbersome to apply the Gran Schmidt process to find the orthonormal basis.

I was wondering if there is a method to find the projection of $$v$$ onto a subspace?

For example:

Find the projection of $$v_{1} = (-5, 3, 18)$$ onto the subspace W spanned by $$v_{2} = (-7, 6, 2)$$ and $$v_{3} = (-1, -2, 1)$$

Instead of finding the orthonormal basis using the Gran Schmidt process, I simply found the cross product $$v_{4} = v_{2} \times v_{3}$$ and subtracted the projection of $$v_{1}$$ onto $$v_{4}$$ from $$v_{1}$$ to get the answer.

Are there similar shortcuts when projecting onto higher dimensions subspaces with more than two basis vectors?

What you did is actually to project $$v_1$$ onto the null-space of $$v_2, v_3$$ and deduct the projection .
If the subspace is exactly $$n-1$$ dimensional, you can use the same trick. What you need is a generalization of the cross product. An operation that takes $$n-1$$ vectors of dimension $$n$$, and returns a single vector orthogonal to their subspace.
You write the $$n-1$$ vectors as row vectors of a matrix, to which you add an additional row of "free terms". Eg. in our case we have: $$M = \begin{pmatrix} -7 & 6 & 2\\ -1 & -2 & 1\\ \vec{t}_{1} & \vec{t}_{2} & \vec{t}_{3} \end{pmatrix}$$
We have: $$\det(M) = 10 \vec{t}_{1} + 5 \vec{t}_{2} + 20 \vec{t}_{3}\\ v_{2} \times v_{3} = (10, 5,20)$$
This generalizes to any number of dimensions. Ie. with $$3$$ vectors of dimension $$4$$ you can make a $$M$$ as a $$4\times 4$$ matrix.