Gram-Schmidt orthogonalization generates an orthonormal basis from an arbitrary basis. An orthonormal basis is a basis, , for which
In Mathematica a Gram-Schmidt orthogonalization can be computed from a set of vectors with the package function GramSchmidt, which is defined in the package LinearAlgebra`Orthogonalization`.
This loads the package.
This creates a set of three vectors that form a basis for .
A plot visualizes the vectors; they all tend to lie in the same direction.
This computes an orthonormal basis.
The orthonormal vectors are obviously much more spread out.
The vectors v1, v2, and v3 are orthonormal, thus the dot product of each vector with itself is 1.
In addition, the dot product of a vector with another vector is 0.
This uses Outer to compare all vectors with all other vectors.