Gram-Schmidt Orthonormalization

Gram-Schmidt orthogonalization, also called the Gram-Schmidt process, is a procedure which takes a nonorthogonal set of linearly independent functions and constructs an orthogonal basis over an arbitrary interval with respect to an arbitrary weighting function w(x).

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)
(1)
phi_0(x)=(psi_0(x))/(sqrt(intpsi_0^2(x)w(x)dx)).
(2)

Then take

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

where we require

intpsi_1phi_0wdx=intu_1phi_0wdx+a_(10)intphi_0^2wdx
(4)
=0.
(5)

By definition,

 intphi_0^2wdx=1,
(6)

so

 a_(10)=-intu_1phi_0wdx.
(7)

The first orthogonalized function is therefore

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

and the corresponding normalized function is

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

By mathematical induction, it follows that

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

where

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

and

 a_(ij)=-intu_iphi_jwdx.
(12)

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

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

Orthogonal polynomials are especially easy to generate using Gram-Schmidt orthonormalization. Use the notation

<x_i|x_j>=<x_i|w|x_j>
(16)
=int_a^bx_i(x)x_j(x)w(x)dx,
(17)

where w(x) is a weighting function, and define the first few polynomials,

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

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

<p_0|p_1>=<[x-(<xp_0|p_0>)/(<p_0|p_0>)]p_0>
(20)
=<xp_0>-(<xp_0|p_0>)/(<p_0|p_0>)<p_0>
(21)
=<xp_0>-<xp_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)

to construct all higher order polynomials.

To verify that this procedure does indeed produce orthogonal polynomials, examine

<p_(i+1)|p_i>=<[x-(xp_i|p_i)/(p_i|p_i)]p_i|p_i>-<(p_i|p_i)/(p_(i-1)|p_(i-1))p_(i-1)|p_i>
(25)
=<xp_i|p_i>-(<xp_i|p_i>)/(<p_i|p_i>)<p_i|p_i>-(<p_i|p_i>)/(<p_(i-1)|p_(i-1)>)<p_(i-1)|p_i>
(26)
=-(<p_i|p_i>)/(<p_(i-1)|p_(i-1)>)<p_(i-1)|p_i>
(27)
=-(<p_i|p_i>)/(<p_(i-1)|p_(i-1)>)[-(<p_(i-1)|p_(j-1)>)/(<p_(j-2)|p_(j-2)>)<p_(j-2)|p_(j-1)>]
(28)
=...
(29)
=(-1)^j(<p_j|p_j>)/(<p_0|p_0>)<p_0|p_1>
(30)
=0,
(31)

since <p_0|p_1>=0. Therefore, all the polynomials p_i(x) are orthogonal.

Many common orthogonal polynomials of mathematical physics can be generated in this manner. Unfortunately, the process turns out to be numerically unstable (Golub and Van Loan 1996).

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.