Legendre Polynomials



    We have seen how Newton polynomials and Lagrange polynomials are used to approximate [Graphics:Images/LegendrePolyMod_gr_1.gif] on an interval [Graphics:Images/LegendrePolyMod_gr_2.gif].  The constructions were based on a discrete set of interpolation points in the interval.  We will now consider "least squares" approximations where the polynomial is "close" to the function throughout the interval [Graphics:Images/LegendrePolyMod_gr_3.gif].  Our final construction will use Legendre polynomials that were first studied by the French mathematician Adrien-Marie Legendre (1752-1833).
    Given a set of interpolation points [Graphics:Images/LegendrePolyMod_gr_4.gif] the Newton polynomial and Lagrange polynomial are algebraically equivalent, and they are equivalent to the polynomial constructed with Mathematica's built in subroutine "InterpolatingPolynomial."  The subroutine "Fit" can be used to construct the discrete least squares fit polynomial.


Definition (Discrete Least Squares Approximation)  Given a function  [Graphics:Images/LegendrePolyMod_gr_5.gif] on  [Graphics:Images/LegendrePolyMod_gr_6.gif]and [Graphics:Images/LegendrePolyMod_gr_7.gif] equally spaced nodes [Graphics:Images/LegendrePolyMod_gr_8.gif]  and interpolation points [Graphics:Images/LegendrePolyMod_gr_9.gif].  The [Graphics:Images/LegendrePolyMod_gr_10.gif] degree polynomial  [Graphics:Images/LegendrePolyMod_gr_11.gif]  is the discrete least squares interpolation fit provided that the coefficients  [Graphics:Images/LegendrePolyMod_gr_12.gif]  of  [Graphics:Images/LegendrePolyMod_gr_13.gif]  minimize the sum


Theorem (Discrete Least Squares Approximation)  The polynomial  [Graphics:Images/LegendrePolyMod_gr_15.gif]  satisfies the [Graphics:Images/LegendrePolyMod_gr_16.gif] equations  
            [Graphics:Images/LegendrePolyMod_gr_17.gif]    for   [Graphics:Images/LegendrePolyMod_gr_18.gif].  

These equations can be simplified to obtain the normal equations for finding the coefficients [Graphics:Images/LegendrePolyMod_gr_19.gif]  

             [Graphics:Images/LegendrePolyMod_gr_20.gif]    for   [Graphics:Images/LegendrePolyMod_gr_21.gif].   

Remark. This is the degenerate case of a least squares fit (i.e. if there were  [Graphics:Images/LegendrePolyMod_gr_22.gif] data points we would have used  [Graphics:Images/LegendrePolyMod_gr_23.gif]  instead of  [Graphics:Images/LegendrePolyMod_gr_24.gif]).
Information on polynomial curve fitting can be found in the module Least Squares Polynomials.

    The following example shows that if n+1 points are used to find the discrete least squares approximation polynomial of degree n , then it is the same as the Newton (and Lagrange) interpolation polynomial that passes through the n+1 points.  


Example 1.  Compare the "discrete interpolation polynomial" and "discrete least squares approximation" using equally spaced nodes on the interval  [Graphics:Images/LegendrePolyMod_gr_25.gif].  
1 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_26.gif].  
1 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_27.gif].  
Solution 1 (a).
Solution 1 (b).


Example 2.  Compare the "discrete interpolation polynomial" and "discrete least squares approximation" using equally spaced nodes.  
2 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_46.gif]  on the interval  [Graphics:Images/LegendrePolyMod_gr_47.gif].  
2 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_48.gif]  on the interval  [Graphics:Images/LegendrePolyMod_gr_49.gif].  
Solution 2 (a).
Solution 2 (b).


Continuous Least Squares Approximation

    Another method for approximating  [Graphics:Images/LegendrePolyMod_gr_68.gif]  on an interval  [Graphics:Images/LegendrePolyMod_gr_69.gif]  is to find a polynomial  [Graphics:Images/LegendrePolyMod_gr_70.gif] with a small average error over the entire interval.  This can be accomplished by integrating the square of the difference  [Graphics:Images/LegendrePolyMod_gr_71.gif]  over  [Graphics:Images/LegendrePolyMod_gr_72.gif].  The following derivation is done on an arbitrary interval  [Graphics:Images/LegendrePolyMod_gr_73.gif], but we will soon see that it is advantageous to use the interval  [Graphics:Images/LegendrePolyMod_gr_74.gif].  

Definition (ContinuousLeast Squares Approximation)  Given a function  [Graphics:Images/LegendrePolyMod_gr_75.gif] on  [Graphics:Images/LegendrePolyMod_gr_76.gif].  The nth degree polynomial  [Graphics:Images/LegendrePolyMod_gr_77.gif]  is the continuous least squares fit for [Graphics:Images/LegendrePolyMod_gr_78.gif] provided that the coefficients [Graphics:Images/LegendrePolyMod_gr_79.gif] minimize the integral  


Theorem (Continuous Least Squares Approximation)  The polynomial  [Graphics:Images/LegendrePolyMod_gr_81.gif]  satisfies the [Graphics:Images/LegendrePolyMod_gr_82.gif] equations  
            [Graphics:Images/LegendrePolyMod_gr_83.gif]    for   [Graphics:Images/LegendrePolyMod_gr_84.gif].  

These equations can be simplified to obtain the normal equations for finding the coefficients [Graphics:Images/LegendrePolyMod_gr_85.gif]  

             [Graphics:Images/LegendrePolyMod_gr_86.gif]    for   [Graphics:Images/LegendrePolyMod_gr_87.gif].  

Proof  Legendre Polynomials  

Computer Programs  Legendre Polynomials  


Example 3.  Compare the "discrete least squares approximation" and "continuous least squares approximation," on the interval  [Graphics:Images/LegendrePolyMod_gr_88.gif].  
3 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_89.gif].  
3 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_90.gif].  
Solution 3 (a).
Solution 3 (b).


Example 4.  Compare the "discrete least squares approximation" and "continuous least squares approximation."  
4 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_127.gif],  on the interval  [Graphics:Images/LegendrePolyMod_gr_128.gif].  
4 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_129.gif],  on the interval  [Graphics:Images/LegendrePolyMod_gr_130.gif].  
Solution 4 (a).
Solution 4 (b).


Orthogonal Polynomials

    To start we need some background regarding an the inner product.  

Definition (Inner Product).  Consider the vector space of functions whose domain is the interval [Graphics:Images/LegendrePolyMod_gr_194.gif].  We define the inner product of two functions [Graphics:Images/LegendrePolyMod_gr_195.gif] as follows  


Mathematica Function (Inner Product). To compute the inner product of two real functions over [Graphics:Images/LegendrePolyMod_gr_197.gif].  


Remark.  The inner product is a continuous analog to the ordinary dot product that is studied in linear algebra.  If the integral is zero then [Graphics:Images/LegendrePolyMod_gr_199.gif] are said to be orthogonal to each other on [Graphics:Images/LegendrePolyMod_gr_200.gif].  All the functions we use are assumed to be square-integrable, i. e. [Graphics:Images/LegendrePolyMod_gr_201.gif].  


Example 5 (a).  Find the inner product of   [Graphics:Images/LegendrePolyMod_gr_202.gif]  and  [Graphics:Images/LegendrePolyMod_gr_203.gif]  over [Graphics:Images/LegendrePolyMod_gr_204.gif].  
5 (b).  Find the inner product of   [Graphics:Images/LegendrePolyMod_gr_205.gif]  and  [Graphics:Images/LegendrePolyMod_gr_206.gif]  over [Graphics:Images/LegendrePolyMod_gr_207.gif].   
5 (c).  Find the inner product of   [Graphics:Images/LegendrePolyMod_gr_208.gif]  and  [Graphics:Images/LegendrePolyMod_gr_209.gif]  over [Graphics:Images/LegendrePolyMod_gr_210.gif].   
Solution 5 (a).
Solution 5 (b).
Solution 5 (c).


Example 6.  Show that the Legendre polynomials  [Graphics:Images/LegendrePolyMod_gr_225.gif],  [Graphics:Images/LegendrePolyMod_gr_226.gif],  [Graphics:Images/LegendrePolyMod_gr_227.gif],  [Graphics:Images/LegendrePolyMod_gr_228.gif],  [Graphics:Images/LegendrePolyMod_gr_229.gif]  and  [Graphics:Images/LegendrePolyMod_gr_230.gif]  are orthogonal on [Graphics:Images/LegendrePolyMod_gr_231.gif].  
Solution 6.


Basis Functions

    A basis for a vector space V of functions is a set of linear independent functions [Graphics:Images/LegendrePolyMod_gr_246.gif]  which has the property that any [Graphics:Images/LegendrePolyMod_gr_247.gif] can be written uniquely as a linear combination  

Fact.  The set  [Graphics:Images/LegendrePolyMod_gr_249.gif]  is a basis for the set [Graphics:Images/LegendrePolyMod_gr_250.gif] of all polynomials and power series.

Definition (Orthogonal Basis)  The set  [Graphics:Images/LegendrePolyMod_gr_251.gif]   is said to be an orthogonal basis on [Graphics:Images/LegendrePolyMod_gr_252.gif] provided that  

        [Graphics:Images/LegendrePolyMod_gr_253.gif]   when  [Graphics:Images/LegendrePolyMod_gr_254.gif],
        [Graphics:Images/LegendrePolyMod_gr_255.gif]  when  [Graphics:Images/LegendrePolyMod_gr_256.gif].

In the special case when [Graphics:Images/LegendrePolyMod_gr_257.gif]  for [Graphics:Images/LegendrePolyMod_gr_258.gif] we say that [Graphics:Images/LegendrePolyMod_gr_259.gif] is an orthonormal basis.    

Theorem (Gram-Schmidt Orthogonalization)  Given  [Graphics:Images/LegendrePolyMod_gr_260.gif]  we can construct a set of orthogonal polynomials  [Graphics:Images/LegendrePolyMod_gr_261.gif]  over the interval  [Graphics:Images/LegendrePolyMod_gr_262.gif]  as follows:

        Use the inner product  [Graphics:Images/LegendrePolyMod_gr_263.gif],  and define  




Remark.  A set of orthonormal polynomials over the interval  [Graphics:Images/LegendrePolyMod_gr_267.gif]  is  [Graphics:Images/LegendrePolyMod_gr_268.gif].   

Remark.  When these polynomials are constructed over the interval [Graphics:Images/LegendrePolyMod_gr_269.gif] and normalized so that [Graphics:Images/LegendrePolyMod_gr_270.gif] they are called the Legendre polynomials, and form a basis for the set of polynomials and power series over the interval [Graphics:Images/LegendrePolyMod_gr_271.gif].  

Corollary 1.  The set of orthogonal polynomials [Graphics:Images/LegendrePolyMod_gr_272.gif] is a basis for the set V of all polynomials and power series over the interval [Graphics:Images/LegendrePolyMod_gr_273.gif].  

Corollary 2.  The set of Legendre polynomials [Graphics:Images/LegendrePolyMod_gr_274.gif] is a basis for the set V of all polynomials and power series over the interval [Graphics:Images/LegendrePolyMod_gr_275.gif].  

Proof  Legendre Polynomials  


Example 7.  Start with  [Graphics:Images/LegendrePolyMod_gr_276.gif]  over the interval [Graphics:Images/LegendrePolyMod_gr_277.gif].  Use the Gram-Schmidt orthogonalization to construct a few of the orthogonal polynomials [Graphics:Images/LegendrePolyMod_gr_278.gif]  over the interval [Graphics:Images/LegendrePolyMod_gr_279.gif].  Construct the corresponding Legendre polynomials  [Graphics:Images/LegendrePolyMod_gr_280.gif].
Solution 7.


An Alternate Recursive Formula

    Another way to recursively define the Legendre polynomials is



Efficient Computations

    We now present the efficient way to compute the continuous least squares approximation.  It has an additional feature that each successive term increases the degree of approximation.  Hence, an increasing sequence of of approximations can obtained recursively:  
Theorem (Legendre Series Approximation)  The Legendre series approximation of order [Graphics:Images/LegendrePolyMod_gr_316.gif] for a function [Graphics:Images/LegendrePolyMod_gr_317.gif] over  [Graphics:Images/LegendrePolyMod_gr_318.gif]  is given by

where  [Graphics:Images/LegendrePolyMod_gr_320.gif]  is the [Graphics:Images/LegendrePolyMod_gr_321.gif] Legendre polynomial and


Proof  Legendre Polynomials  

Computer Programs  Legendre Polynomials  


Example 8.  Compare the "discrete interpolation polynomial" and "Legendre series approximation," on the interval  [Graphics:Images/LegendrePolyMod_gr_323.gif].  
8 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_324.gif].   
8 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_325.gif].  
Solution 8 (a).
Solution 8 (b).


The Shifted Legendre Polynomials

    The "shifted Legendre polynomials
        [Graphics:Images/LegendrePolyMod_gr_346.gif]  are orthogonal on [Graphics:Images/LegendrePolyMod_gr_347.gif],  
    where [Graphics:Images/LegendrePolyMod_gr_348.gif] are the Legendre polynomials on [Graphics:Images/LegendrePolyMod_gr_349.gif].   



Theorem (Shifted Legendre Series Interpolation)  The shifted Legendre series approximation of order [Graphics:Images/LegendrePolyMod_gr_362.gif] for a function [Graphics:Images/LegendrePolyMod_gr_363.gif] over  [Graphics:Images/LegendrePolyMod_gr_364.gif]  is given by

where  [Graphics:Images/LegendrePolyMod_gr_366.gif]  is the [Graphics:Images/LegendrePolyMod_gr_367.gif] shifted Legendre polynomial and


Proof  Legendre Polynomials  

Computer Programs  Legendre Polynomials  


Example 9.  Compare the "discrete interpolation polynomial" and "shifted Legendre series approximation"
9 (a).  Use the function  [Graphics:Images/LegendrePolyMod_gr_369.gif],  on the interval  [Graphics:Images/LegendrePolyMod_gr_370.gif].  
9 (b).  Use the function  [Graphics:Images/LegendrePolyMod_gr_371.gif],  on the interval  [Graphics:Images/LegendrePolyMod_gr_372.gif].  
Solution 9 (a).
Solution 9 (b).


Research Experience for Undergraduates

Legendre Polynomials  Internet hyperlinks to web sites and a bibliography of articles.  


Download this Mathematica Notebook Legendre Polynomials



























(c) John H. Mathews 2005