# Using Gram-Scmidt to obtain an orthonormal basis for the column space

How would I use the method of Gram-Schmidt to obtain an orthonormal basis for the column space of the matrix? $$A = \begin{bmatrix} 2 & 3 & 1 \\ -1 & -1 & 1 \\ 1 & 0 & 1 \\ 2 & 4 & 1 \end{bmatrix}$$

Take first column vector, $v_1 =v_1' = (2, -1, 1, 2)$.Then take second vector, $v_2 = (3, -1, 0,4)$. Then from $v_2$ subtract the component of $v_2$ along $v_1$ and denote it by $v_2'$. i.e. $$v_2' = v_2 - \frac{\langle v_1', v_2\rangle}{\langle v_1', v_1'\rangle} v_1'$$ Then again take $v_3 = (1,1,1,1)$ and subtract it's component of $v_1'$ and $v_2'$ from $v_3$ and denote it by $v_3'$. $$v_3' = v_3 - \frac{\langle v_3, v_1'\rangle}{\langle v_1', v_1'\rangle} v_1-\frac{\langle v_3, v_2'\rangle}{\langle v_2', v_2'\rangle} v_2$$
You get the orthogonal system of vectors $v_1', v_2', v_3'$. Then finally normalize it, you will get set of orthonormal column vector and it is the orthonormal basis of your column space.