Math Algebra
posted by Traxx on .
Transform the basis {[1, 0, 1], [0, 1, 2], [2, 1, 0]} for R^3 into an orthonormal basis, using the GramSchmidt process.

Define proj(u, v) to be the projection of u onto v. proj(u, v) = v*(u dot v)/(v dot v)
u = norm u
From the 3 given vectors, we want to form a basis such that each basis vector is orthogonal to every other and an unit vector.
Take e1 = [1,0,1] = (1/sqrt(2))[1,0,1]. The first basis vector is arbitrary.
e2 = [0,1,2]  proj([0,1,2], [1,0,1]). We remove the nonorthogonal part to ensure e2 is orthogonal. Then take the norm to make it an unit vector.
e3 = [2,1,0]  proj([2,1,0], [0,1,2])  proj([2,1,0], [1,0,1]). As with e2, remove every part orthogonal to e1 or e2 to ensure orthogonality. Then take the norm to make it an unit vector.