Find an orthogonal basis for the space spanned by the columns of the given matrix. Let $$X = \begin{pmatrix} 
1 & 1 & 4 \\ 
1 & 2 & 1 \\ 
1 & 3 & 0 \\ 
1 & 4 & 0 \\ 
1 & 5 & 1 \\ 
1 & 6 & 4 \end{pmatrix}$$
It is immediately clear to me that the columns of $X$ form a basis for the space spanned by the columns of $X$.
How does one generate an orthogonal basis for the space spanned by the columns of $X$? I know that for each element $x \neq y$ in this basis that $x\cdot y = 0$, but this doesn't help me actually generate the basis.
 A: You use the Gram-Schmidt process.
The Gram-Schmidt process takes a set of vectors and produces from them a set of orthogonal vectors which span the same space.  It is based on projections -- which I'll assume you already are familiar with.
Let's say that we want to orthogonalize the set $\{u_1, u_2, u_3\}$.  So we want a set of at most $3$ vectors $\{v_1, v_2, v_3\}$ (there will be less if the $3$ original vectors don't span a $3$-dimensional space).  Then here's the process:


*

*If $u_1 \ne 0$, then let $v_1=u_1$.  If $u_1 =0$, then throw out $u_1$ and repeat with $u_2$ (and if that's $0$ as well move on to $u_3$, etc).

*Decompose the next nonzero original vector (we'll assume it's $u_2$) into its projection on $\operatorname{span}(v_1)$ and a vector orthogonal to $v_1$:
$$u_2 = \operatorname{proj}_{v_1}u_2 + (u_2)_\bot$$ We want the part that is orthogonal to $v_1$, so let $v_2=(u_2)_\bot = u_2 - \operatorname{proj}_{v_1}u_2$ assuming $(u_2)_\bot \ne 0$.  If $(u_2)_\bot = 0$, then throw out $u_2$ and move on to the next nonzero original vector.

*Decompose the next nonzero original vector (we'll assume it's $u_3$) into its projection onto $\operatorname{span}(v_1)$, it's projection onto $\operatorname{span}(v_2)$, and a vector orthogonal to $v_1$ AND $v_2$: $$u_3 = \operatorname{proj}_{v_1}u_3 + \operatorname{proj}_{v_2}u_3 + (u_3)_\bot$$  If $(u_3)_\bot = u_3 - \operatorname{proj}_{v_1}u_3 - \operatorname{proj}_{v_2}u_3 \ne 0$, then let $v_3 = u_3$.  If it does equal $0$, then throw it out.


Doing this you get a set of orthogonal vectors $\{v_1, v_2, v_3\}$ (though there may be less than $3$ of them).  The next step to get an orthonormal basis is to normalize these vectors -- so just divide them by their norms.  Then you're done.
From this hopefully you get the idea of how to use the Gram-Schmidt process on any set of vectors in an inner product space (even ones outside of $\Bbb R^n$).
A: To apply Gran-Schmidt, I used
$$u_k = v_k - \sum\limits_{j=1}^{k-1}\operatorname{proj}_{u_j}(v_k)$$
where $$\operatorname{proj}_{u_j}(v_k) = \dfrac{v_k \cdot u_j}{u_j \cdot u_j}u_j\text{.}$$
We have $$u_1 = v_1 = \begin{pmatrix} 
1 \\
1 \\
1 \\
1 \\
1 \\
1\end{pmatrix}\text{.}$$
Now $$\operatorname{proj}_{u_1}(v_2) = \dfrac{v_2 \cdot u_1}{u_1 \cdot u_1}u_1 = \dfrac{21}{6}u_1\text{.}$$
Thus, $$u_2 = v_2 - \dfrac{21}{6}u_1 = \begin{pmatrix}
-5/2 \\
-3/2 \\
-1/2 \\
1/2 \\
3/2 \\
5/2\end{pmatrix}\text{.}$$
Also,
\begin{align*}
\operatorname{proj}_{u_1}(v_3) &= \dfrac{v_3 \cdot u_1}{u_1 \cdot u_1}u_1 = \dfrac{10}{6}u_1 \\
\operatorname{proj}_{u_2}(v_3) &= \dfrac{v_3 \cdot u_2}{u_2 \cdot u_2}u_2 = \dfrac{0}{17.5}u_2 = 0\text{.}
\end{align*}
Thus, $$u_3 = v_3 - \dfrac{10}{6}u_1 = \begin{pmatrix}
7/3 \\
-2/3 \\
-5/3 \\
-5/3 \\
-2/3 \\
7/3\end{pmatrix}\text{.}$$
Hence $\{u_1, u_2, u_3\}$ is an orthogonal basis for the space spanned by the columns of $X$.
