TITLE: How do you use the Gram-Schmidt process to generate an orthonormal basis of $\mathbb{R}^3$?
QUESTION [5 upvotes]: These vectors form a basis on $\mathbb R^3$: $$\begin{bmatrix}1\\0\\-1\\\end{bmatrix},\begin{bmatrix}2\\-1\\0\\\end{bmatrix} ,\begin{bmatrix}1\\2\\1\\\end{bmatrix}$$
Can someone show how to use the Gram-Schmidt process to generate an orthonormal basis of $\mathbb R^3$?

REPLY [3 votes]: Let $u_1=\begin{bmatrix}1\\0\\-1\\\end{bmatrix} ,u_2=\begin{bmatrix}2\\-1\\0\\\end{bmatrix} ,u_3=\begin{bmatrix}1\\2\\1\\\end{bmatrix}$. To find the required orthonormal basis $\{w_1,w_1,w_3\}$, first we have
$$w_1=\frac{u_1}{\|u_1\|}=\begin{bmatrix}\frac{1}{\sqrt{2}}\\0\\-\frac{1}{\sqrt{2}}\\\end{bmatrix}.$$
Second, find $u_2-(w_1\cdot u_2)w_1$ as follows:
$$u_2-(w_1\cdot u_2)w_1=\begin{bmatrix}2\\-1\\0\\\end{bmatrix}-\sqrt{2}\begin{bmatrix}\frac{1}{\sqrt{2}}\\0\\-\frac{1}{\sqrt{2}}\\\end{bmatrix}=\begin{bmatrix}1\\-1\\1\\\end{bmatrix}.$$
By taking the dot product, you can see that $w_1$ is orthogonal to the above vector:
$$w_1\cdot[u_2-(w_1\cdot u_2)w_1]=w_1\cdot u_2-(w_1\cdot u_2)w_1\cdot w_1=0$$
since $w_1$ is an unit vector. So we can take
$$w_2=\frac{u_2-(w_1\cdot u_2)w_1}{\|u_2-(w_1\cdot u_2)w_1\|}=\begin{bmatrix}\frac{1}{\sqrt3}\\-\frac{1}{\sqrt3}\\\frac{1}{\sqrt3}\\\end{bmatrix}.$$
Finally, find $u_3-(w_1\cdot u_3)w_1-(w_2\cdot u_3)w_2$ as follows:
$$u_3-(w_1\cdot u_3)w_1-(w_2\cdot u_3)w_2=\begin{bmatrix}1\\2\\1\\\end{bmatrix}-0\cdot\begin{bmatrix}\frac{1}{\sqrt3}\\-\frac{1}{\sqrt3}\\\frac{1}{\sqrt3}\\\end{bmatrix}-0\cdot\begin{bmatrix}\frac{1}{\sqrt{2}}\\0\\-\frac{1}{\sqrt{2}}\\\end{bmatrix}=\begin{bmatrix}1\\2\\1\\\end{bmatrix}.$$
By taking the dot product, you can again see that $w_1$ and $w_2$ and  is orthogonal to the above vector. So we can take
$$w_3=\frac{u_3-(w_1\cdot u_3)w_1-(w_2\cdot u_3)w_2}{\|u_3-(w_1\cdot u_3)w_1-(w_2\cdot u_3)w_2\|}=\begin{bmatrix}\frac{1}{\sqrt6}\\\frac{2}{\sqrt6}\\\frac{1}{\sqrt6}\\\end{bmatrix}.$$