File Exchange

image thumbnail


version (2.84 KB) by Antonio Trujillo-Ortiz
Classical Gram-Schmidt orthogonalization procedure.


Updated 05 Oct 2006

View License

This procedure construct an orthonormal basis from any set of N linearly independent vectors. Obviously, by skipping the normalization step, we could also form simply an orthogonal basis. The key ingredient of this procedure is that each new orthonormal basis vector is obtained by subtracting out the projection of the next linearly independent vector onto the vectors accepted so far into the set. We may say that each new linearly independent vector s_n is projected onto the subspace spanned by the vectors [o_0,...,o_n-1], and any nonzero projection in that subspace is subtracted out of s_n to make the new vector orthogonal to the entire subspace. In other words, we retain only that portion of each new vector s_n which points along a new dimension. The first direction is arbitrary and is determined by whatever vector we choose first (s_0 here). The next vector is forced to be orthogonal to the first. The second is forced to be orthogonal to the first two, and so on.

Orthogonalization methods play a key role in many iterative methods. The Gram-Schmidt process is a method for orthogonalizing a set of vectors in an inner product space. A set of vectors in an inner product space is called an orthogonal set if all pairs of distinct vectors in the set are orthogonal (the angle between them is pi/2). An orthogonal set in which each vector has a norm of 1 is called an orthonormal set.

The method is named for Jørgen Pedersen Gram (a Danish actuary) and Erhard Schmidt (a German mathematician) but it appeared earlier in the work of Laplace and Cauchy. -Gram-Schmidt's orthogonalization process- term appeared by first time in 1936 on the Wong's paper 'An Application of Orthogonalization Process to the Theory of Least Squares'.

A - matrix of n linearly independent vectors of equal size. Here, them must be arranged as columns.

Matrix of n orthogonalized vectors.

Cite As

Antonio Trujillo-Ortiz (2021). cgrscho (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!