Writing a vector as a linear combination of the vectors of an orthogonal basis

Result: Let {\bf v_1},{\bf v_2},\cdots,{\bf v_n}, be an orthogonal basis of a vector space. Let {\bf w} be some vector. Then:

{\bf w}=\frac{<{\bf w},{\bf v_1}>}{\|\bf v_1\|^2}{\bf v_1}+\frac{<{\bf w},{\bf v_2}>}{\|\bf v_2\|^2}{\bf v_2}+\cdots+\frac{<{\bf w},{\bf v_n}>}{\|\bf v_n\|^2}{\bf v_n}

Derivation: Let {\bf w} be a linear combination of the basis vectors.

\begin{aligned}{\bf w}&=\alpha_1{\bf v_1}+\alpha_2{\bf v_2}+\cdots+\alpha_n{\bf v_n}\text{ (where }\alpha_i\in F\ \forall i=1,2,\cdots,n)\\<{\bf w},{\bf v_i}>&=\alpha_1<{\bf v_1},{\bf v_i}>+\alpha_2<{\bf v_2},{\bf v_i}>+\cdots+\alpha_n<{\bf v_n},{\bf v_i}>\forall i=1,2,\cdots,n\\&=\alpha_1(0)+\alpha_2(0)+\cdots+\alpha_i<{\bf v_i},{\bf v_i}>+\cdots+\alpha_n(0)\text{ (since the basis vectors are orthogonal)}\\&=\alpha_i\|{\bf v_i}\|^2\\\therefore \alpha_i&=\frac{<{\bf w},{\bf v_i}>}{\|{\bf v_i}\|^2}\end{aligned}

Hence:

{\bf w}=\frac{<{\bf w},{\bf v_1}>}{\|\bf v_1\|^2}{\bf v_1}+\frac{<{\bf w},{\bf v_2}>}{\|\bf v_2\|^2}{\bf v_2}+\cdots+\frac{<{\bf w},{\bf v_n}>}{\|\bf v_n\|^2}{\bf v_n}.

Moreover, when the basis vector are of unit length, we have the next results, which follows directly from the previous one, since the norm of each vector is equal to 1.

Result: Let {\bf v_1},{\bf v_2},\cdots,{\bf v_n}, be an orthonormal basis of a vector space. Let {\bf w} be some vector. Then:

{\bf w}=<{\bf w},{\bf v_1}>{\bf v_1}+<{\bf w},{\bf v_2}>{\bf v_2}+\cdots+<{\bf w},{\bf v_n}>{\bf v_n}

Example: Consider the vector space \mathbb{R}^3 and the orthogonal basis vectors {\bf v_1}=(-1,1,0)^t,\ {\bf v_2}=(1,1,0)^t and {\bf v_3}=(0,0,-1)^t. Let us write the vector {\bf w}=(3,2,4)^t as a linear combination of the basis vectors.

<{\bf w},{\bf v_1}>=\begin{pmatrix}3\\2\\4\end{pmatrix}\cdot\begin{pmatrix}-1\\1\\0\end{pmatrix}=-1

<{\bf w},{\bf v_2}>=\begin{pmatrix}3\\2\\4\end{pmatrix}\cdot\begin{pmatrix}1\\1\\0\end{pmatrix}=5

<{\bf w},{\bf v_3}>=\begin{pmatrix}3\\2\\4\end{pmatrix}\cdot\begin{pmatrix}0\\0\\-1\end{pmatrix}=-4

\|{\bf v_1}\|^2=<{\bf v_1},{\bf v_1}>=\begin{pmatrix}-1\\1\\0\end{pmatrix}\cdot\begin{pmatrix}-1\\1\\0\end{pmatrix}=2

\|{\bf v_2}\|^2=<{\bf v_2},{\bf v_2}>=\begin{pmatrix}1\\1\\0\end{pmatrix}\cdot\begin{pmatrix}1\\1\\0\end{pmatrix}=2

\|{\bf v_3}\|^2=<{\bf v_3},{\bf v_3}>=\begin{pmatrix}0\\0\\-1\end{pmatrix}\cdot\begin{pmatrix}0\\0\\-1\end{pmatrix}=1

Hence:

\begin{aligned}{\bf w}&=\frac{<{\bf w},{\bf v_1}>}{\|\bf v_1\|^2}{\bf v_1}+\frac{<{\bf w},{\bf v_2}>}{\|\bf v_2\|^2}{\bf v_2}+\frac{<{\bf w},{\bf v_3}>}{\|\bf v_3\|^2}{\bf v_3}\\\begin{pmatrix}3\\2\\4\end{pmatrix}&=-\frac{1}{2}\begin{pmatrix}-1\\1\\0\end{pmatrix}+\frac{5}{2}\begin{pmatrix}1\\1\\0\end{pmatrix}-4\begin{pmatrix}0\\0\\-1\end{pmatrix}\end{aligned}