Legendre Polynomials
In[2]:=
Table[LegendreP[k,x],{k,0,6}]
Out[2]=
2 3 2 4
-1 + 3 x -3 x + 5 x 3 - 30 x + 35 x
{1, x, ---------, -----------, -----------------,
2 2 8
3 5 2 4 6
15 x - 70 x + 63 x -5 + 105 x - 315 x + 231 x
--------------------, -----------------------------}
8 16
In[3]:=
Plot[Evaluate[Table[LegendreP[k,x],{k,0,6}]],{x,-1,1}];

Legendre's differential equation
(1-x^2)y''-2xy'+Ly=0
can be rewritten as a Sturm-Liouville differential equation
[(1-x^2)y']'+Ly=0.
Here r(x)=1-x^2, q(x)=0, p(x)=1
This is, in fact, a singular S-L problem on [-1,1] since 1-x^2=0 at x=-1 and
x=1.
The eigenvalues are L=n(n+1) for n=0, 1, 2, . . . and the corresponding eigenfunctions are the Legendre polynomials LegendreP[n,x] for n=0, 1, 2, . . . .
Note that the eigenvalues are real and satisfy L->Infinity.
These polynomials DO solve the differential equation. Check one of them.
In[4]:=
Simplify[D[(1-x^2)D[LegendreP[3,x],x],x]+3(3+1)LegendreP[3,x]]
Out[4]=
0
Check the first seven:
In[5]:=
Table[D[(1-x^2)D[LegendreP[k,x],x],x]+k(k+1)LegendreP[k,x],{k,0,6}]
Out[5]=
2 2 2
{0, 0, -6 x + 3 (1 - x ) + 3 (-1 + 3 x ),
2 2 3
15 x (1 - x ) - x (-3 + 15 x ) + 6 (-3 x + 5 x ),
2 2 3
(1 - x ) (-60 + 420 x ) x (-60 x + 140 x )
----------------------- - ------------------ +
8 4
2 4
5 (3 - 30 x + 35 x )
---------------------,
2
2 3 2 4
(1 - x ) (-420 x + 1260 x ) x (15 - 210 x + 315 x )
--------------------------- - ------------------------ +
8 4
3 5
15 (15 x - 70 x + 63 x )
-------------------------,
4
2 2 4
(1 - x ) (210 - 3780 x + 6930 x )
---------------------------------- -
16
3 5
x (210 x - 1260 x + 1386 x )
----------------------------- +
8
2 4 6
21 (-5 + 105 x - 315 x + 231 x )
----------------------------------}
8
In[6]:=
Simplify[%]
Out[6]=
{0, 0, 0, 0, 0, 0, 0}
By one of the major Sturm-Liouville theorems, the Legendre polynomials are orthogonal with respect to the weight p(x)=1. Check one.
In[7]:=
Integrate[LegendreP[1,x]LegendreP[2,x],{x,-1,1}]
Out[7]=
0
It is interesting to see what numerical integration says.
In[8]:=
NIntegrate[LegendreP[1,x]LegendreP[2,x],{x,-1,1}]
NIntegrate::ploss:
Numerical integration stopping due to loss of precision.
Achieved neither the requested PrecisionGoal nor
AccuracyGoal; suspect one of the following: highly
oscillatory integrand or the true value of the integral
is 0.
Out[8]=
0.
Check many at a time:
In[9]:=
Table[Integrate[LegendreP[k,x]LegendreP[m,x],{x,-1,1}],{k,0,6},{m,0,6}];
MatrixForm[%]
Out[9]=
2 0 0 0 0 0 0
2
-
0 3 0 0 0 0 0
2
-
0 0 5 0 0 0 0
2
-
0 0 0 7 0 0 0
2
-
0 0 0 0 9 0 0
2
--
0 0 0 0 0 11 0
2
--
0 0 0 0 0 0 13
There are many interesting facts about Legendre polynomials that we will not get into here. One that will help us, however, is illustrated above. There are some facts will help evaluate the Fourier coefficients in the eigenfunction expansion.
Do you see a pattern?
Why is this helpful in doing eigenfunction expansions? A look at the formulas for the Fourier coefficients would be a good idea.
In[10]:=
Table[Integrate[LegendreP[k,x],{x,-1,1}],{k,0,6}]
Out[10]=
{2, 0, 0, 0, 0, 0, 0}
I think you can see this pattern!
I think you can see this pattern! ...
What about this?
In[11]:=
Table[LegendreP[k,x]-LegendreP[k,-x],{k,0,8}];
Simplify[%]
Out[11]=
3 5
3 15 x - 70 x + 63 x
{0, 2 x, 0, -3 x + 5 x , 0, --------------------, 0,
4
3 5 7
-35 x + 315 x - 693 x + 429 x
--------------------------------, 0}
8
In[12]:=
Table[LegendreP[k,x]+LegendreP[k,-x],{k,0,8}];
Simplify[%]
Out[12]=
2 4
2 3 - 30 x + 35 x
{2, 0, -1 + 3 x , 0, -----------------, 0,
4
2 4 6
-5 + 105 x - 315 x + 231 x
-----------------------------, 0,
8
2 4 6 8
35 - 1260 x + 6930 x - 12012 x + 6435 x
-------------------------------------------}
64
Well?
Rodrigues' Formula is another important property of Legendre polynomials.
LegendreP[k,x]=1/(2^k k!) D[(x^2-1)^k,{x,k}]
Does it seem to work?
![]()
In[13]:=
Table[1/(2^k k!) D[(x^2-1)^k,{x,k}], {k,0,4}];
Simplify[%]
Out[13]=
2 2 2 4
-1 + 3 x x (-3 + 5 x ) 3 - 30 x + 35 x
{1, x, ---------, -------------, -----------------}
2 2 8
In[14]:=
Table[LegendreP[k,x],{k,0,4}]
Out[14]=
2 3 2 4
-1 + 3 x -3 x + 5 x 3 - 30 x + 35 x
{1, x, ---------, -----------, -----------------}
2 2 8
Example 1
Up to Sturm Liouville Theory and Orthogonal Polynomials
Example 2