Orthonormal matrices are nice. They...
Gram-Schmidt is a simple algorithm for taking a non-orthonormal matrix (
\begin{equation} A=\begin{bmatrix} \begin{array}{cccc{\qquad}1} \mathbf{a_1} & \mathbf{a_2} & \cdots & \mathbf{a_n} \end{array} \end{bmatrix} \end{equation}
- Pick a column (vector); anyone will do so we might as well pick
$\mathbf{a_{i=0}}$ . - Create a unit vector version of
$\mathbf{a_i}$ ($\mathbf{q_i}$ ) by dividing$\mathbf{a_i}$ by its norm ($\frac{\mathbf{a_i}}{||\mathbf{a_i}||}$ ) - Subtract
$\mathbf{q_i}$ from all subsequent vectors$\mathbf{q_{j>i}}$ \begin{equation} \mathbf{a_{j_i}^\prime} = \mathbf{a_j} - (\mathbf{q_i}^T \mathbf{a_j}) \mathbf{q_i} \end{equation} - Increment
$i$ and repeat.
Thus for any column
\begin{eqnarray} \mathbf{a_j^\prime} = \mathbf{a_j} - \sum_{i=1}^{j-1}(\mathbf{q_i}^T \mathbf{a_j}) \mathbf{q_i}\ \mathbf{q_j} = \frac{\mathbf{a_j^\prime}}{||\mathbf{a_j^\prime}||} \end{eqnarray}