GramSchmidt
GramSchmidt is an algorithm in linear algebra used to convert a finite sequence of vectors into an orthogonal (or orthonormal) sequence that spans the same subspace. Given a linearly independent set {v1, v2, ..., vk} in an inner product space such as R^n, the GramSchmidt process constructs vectors {u1, u2, ..., uk} satisfying u_i · u_j = 0 for i ≠ j and ||u_i|| > 0. In real spaces the inner product is the dot product; in complex spaces it is the Hermitian inner product.
The procedure proceeds sequentially. Start with u1 = v1. For i from 2 to k, compute w_i =
If none of the w_i is zero, the resulting set {u1, ..., uk} is orthonormal and spans the