TOPICS
Search

Gram-Schmidt Orthonormalization


Gram-Schmidt orthonormalization, also called the Gram-Schmidt process, constructs an orthonormal basis for the span of a linearly independent family in an inner product space, preserving the successive spans. Omitting the normalization steps gives Gram-Schmidt orthogonalization.

For vectors v_0, v_1, ... in a real or complex inner product space, the construction is

r_i=v_i-sum_(j=0)^(i-1)<v_i|q_j>q_j
(1)
q_i=(r_i)/(||r_i||),
(2)

where i>=0 and the sum is empty for i=0. Here <v|w> denotes the given inner product, taken to be linear in its first argument and antilinear in its second, and ||r_i||=sqrt(<r_i|r_i>) is its induced norm. The linear independence of the input vectors ensures that every residual r_i is nonzero, so the normalization is defined (Axler 2024, pp. 183-184 and 201). In the Wolfram Language, Orthogonalize[{v0, v1, ...}] gives an orthonormal basis for a linearly independent list of vectors.

For the real functions considered below, use the weighted inner product

 <f|g>=<f|w|g>=int_a^bf(x)g(x)w(x)dx.
(3)

The nonnegative weight w(x) must make this inner product positive definite on the function space under consideration, and all required integrals must be finite. All subsequent integrals are over the same interval [a,b].

Applying the Gram-Schmidt process to the functions 1, x, x^2, ... on the interval [-1,1] with the usual L^2 inner product gives the Legendre polynomials (up to constant multiples; Reed and Simon 1972, p. 47).

Given an original set of linearly independent functions {u_n}_(n=0)^infty, let {psi_n}_(n=0)^infty denote the orthogonalized (but not normalized) functions, {phi_n}_(n=0)^infty denote the orthonormalized functions, and define

psi_0(x)=u_0(x)
(4)
phi_0(x)=(psi_0(x))/(sqrt(intpsi_0^2(x)w(x)dx)).
(5)

Then take

 psi_1(x)=u_1(x)+a_(10)phi_0(x),
(6)

where we require

intpsi_1phi_0wdx=intu_1phi_0wdx+a_(10)intphi_0^2wdx
(7)
=0.
(8)

By definition,

 intphi_0^2wdx=1,
(9)

so

 a_(10)=-intu_1phi_0wdx.
(10)

The first orthogonalized function is therefore

 psi_1=u_1(x)-[intu_1phi_0wdx]phi_0,
(11)

and the corresponding normalized function is

 phi_1=(psi_1(x))/(sqrt(intpsi_1^2wdx)).
(12)

By mathematical induction, it follows that

 phi_i(x)=(psi_i(x))/(sqrt(intpsi_i^2wdx)),
(13)

where

 psi_i(x)=u_i+a_(i0)phi_0+a_(i1)phi_1+...+a_(i,i-1)phi_(i-1)
(14)

and

 a_(ij)=-intu_iphi_jwdx.
(15)

If the functions are normalized to positive N_j instead of 1, then

 int_a^b[phi_j(x)]^2wdx=N_j^2
(16)
 phi_i(x)=N_i(psi_i(x))/(sqrt(intpsi_i^2wdx))
(17)
 a_(ij)=-(intu_iphi_jwdx)/(N_j^2).
(18)

Orthogonal polynomials are especially easy to generate using the Gram-Schmidt process applied to 1, x, x^2, ..., provided all required moments are finite. In particular,

 <xp_i|p_j>=int_a^bxp_i(x)p_j(x)w(x)dx.
(19)

Choose monic polynomials p_i of degree i, starting with

p_0(x)=1
(20)
p_1(x)=[x-(<xp_0|p_0>)/(<p_0|p_0>)]p_0.
(21)

As defined, p_0 and p_1 are orthogonal polynomials, as can be seen from

<p_0|p_1>=<p_0|xp_0>-(<xp_0|p_0>)/(<p_0|p_0>)<p_0|p_0>
(22)
=0.
(23)

Now use the recurrence relation

 p_(i+1)(x)=[x-(<xp_i|p_i>)/(<p_i|p_i>)]p_i-[(<p_i|p_i>)/(<p_(i-1)|p_(i-1)>)]p_(i-1)
(24)

for i>=1 to construct the remaining monic polynomials.

To verify orthogonality, suppose p_0, ..., p_i are mutually orthogonal, and write the two coefficients in the recurrence relation as alpha_i=<xp_i|p_i>/<p_i|p_i> and beta_i=<p_i|p_i>/<p_(i-1)|p_(i-1)>. Then

 <p_(i+1)|p_j>=<p_i|xp_j>-alpha_i<p_i|p_j>-beta_i<p_(i-1)|p_j>.
(25)

For 0<=j<=i-2, all three terms vanish because xp_j has degree at most i-1. For j=i-1, the polynomial xp_(i-1)-p_i also has degree at most i-1, so

 <p_i|xp_(i-1)>=<p_i|p_i>.
(26)

This cancels the term containing beta_i. For j=i, the first two terms cancel by the definition of alpha_i, and the last term is zero. Thus p_(i+1) is orthogonal to every preceding polynomial, completing the induction.

Many common orthogonal polynomials of mathematical physics can be generated in this manner. In finite-precision arithmetic, the classical process can lose orthogonality (Golub and Van Loan 1996).


See also

Gram Determinant, Gram's Inequality, Inner Product Space, Lattice Reduction, Orthogonal Polynomials, Orthogonalization, Orthonormal Basis

Explore with Wolfram|Alpha

References

Arfken, G. "Gram-Schmidt Orthogonalization." §9.3 in Mathematical Methods for Physicists, 3rd ed. Orlando, FL: Academic Press, pp. 516-520, 1985.Axler, S. Linear Algebra Done Right, 4th ed. Cham, Switzerland: Springer, 2024. https://doi.org/10.1007/978-3-031-41026-0.Cohen, H. A Course in Computational Algebraic Number Theory. New York: Springer-Verlag, 1993.Golub, G. H. and Van Loan, C. F. Matrix Computations, 3rd ed. Baltimore, MD: Johns Hopkins, 1996.Pohst, M. and Zassenhaus, H. "Methods from the Geometry of Numbers." Ch. 3 in Algorithmic Algebraic Number Theory. Cambridge, England: Cambridge University Press, 1989.Reed, M. and Simon, B. Methods of Modern Mathematical Physics, Vol. 1: Functional Analysis. New York: Academic Press, pp. 46-47, 1972.Trefethen, L. N. and Bau, D. III Numerical Linear Algebra. Philadelphia, PA: SIAM, 1997.

Referenced on Wolfram|Alpha

Gram-Schmidt Orthonormalization

Cite this as:

Weisstein, Eric W. "Gram-Schmidt Orthonormalization." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Gram-SchmidtOrthonormalization.html

Subject classifications