[Math] Calculate orthonormal basis using Gram-Schmidt

inner-productslegendre polynomialsorthogonal-polynomialsorthonormalpolynomials

Our professor gave this exercise to help us review the topic we covered in class, but it seems my knowledge is not sufficient (or we didn't cover it in enough detail during class).

Assume we are working with the inner product space $$\langle u,v \rangle = \int_I [u(x) v(x)] w(x) dx,$$ where $w$ is the weight function and $I$ is some interval. We are supposed to find a orthonormal basis for the following three different sets of assumptions:

  1. $w(x) = 1, I = [-1,1]$
  2. $w(x) = \frac{1}{\sqrt{2\pi}} e^{-\frac{-x^2}{2}}, I = (-\infty,\infty)$
  3. $w(x) = e^{-x}x^\alpha, I = [0,\infty)$.

Note that I'm assuming that we're working on $L^2$ with the monomials $(1,x,x^2,…)$.

Based on my search on math.SE and books on orthogonal polynomials, I believe that the solution for 1 is connected to the Legendre polynomials, for 2 it is connected to Hermite polynomials and for the last one, the Laguerre polynomials.

However, in my search I was unable to find a direct calculation for these polynomials – they always seem to be derived from an associated differential equation. I am looking for solutions where Gram-Schmidt orthogonalization is used for the weight functions, or some references for textbooks where this is done.

Best Answer

The polynomials obtained from (1) are the normalized Legendre polynomials. For all three cases, it is possible to calculate them by hand, but (especially for (3)) the calculation can be quite cumbersome. So, I've used the following Mathematica code for the Gram-Schmidt (including normalization) procedure:

Clear[f, g, ip];
ip[f_, g_] := Integrate[f*g*1, {x, -1, 1}];
proj[g_, f_] := g*ip[f, g]/ip[g, g];
normalized[f_] := f/Sqrt[ip[f, f]];
gs[fs_List] := Module[{u}, normalized /@ 
Table[u[k] = fs[[k]] - Sum[proj[u[j], fs[[k]]], {j, 1, k - 1}],
{k, 1, Length[fs]}]];

lps = Expand[gs[Table[x^k, {k, 0, 4}]]]

This is the code for the first part of the question - if you want to do it for (2) and (3), just replace the part in the second line after f * g with the appropriate weight function and the correct interval.

Related Question