## Projection of a Vector Onto Another Vector in Higher Dimensions

We can find the projection of a vector onto another vector in any dimension, not just in two and three dimensional space.
The general formula for the projection of a vector
$\mathbf{x}$
onto a vector
$\mathbf{y}$
is
$Proj_{\mathbf{y}} \mathbf{x} = \frac{\mathbf{x} \cdot \mathbf{y}}{| \mathbf{y} |} \mathbf{y}$

Example: Take
$\mathbf{x} = \begin{pmatrix}1\\0\\2\\3\end{pmatrix} \: \mathbf{y} = \begin{pmatrix}-3\\2\\1\\0\end{pmatrix}$

$\mathbf{x} \cdot \mathbf{y} = \begin{pmatrix}1\\0\\2\\3\end{pmatrix} \cdot \begin{pmatrix}-3\\2\\1\\0\end{pmatrix}=-3+0+2+0=-1$

$| \mathbf{y} | = \sqrt{(-3)^2+2^2+1^2+0^2} = \sqrt{14}$

Then
$Proj_{\mathbf{y}} \mathbf{x} = \frac{-1}{\sqrt{14}} = - \frac{\sqrt{14}}{14}$