Problem. Approximate the function f (x) = ex on
the interval [−1, 1] by a quadratic polynomial .
The best approximation would be a polynomial p (x)
that minimizes the distance relative to the uniform
norm:

However there is no analytic way to find such a
polynomial. Another approach is to find a “least
squares” approximation that minimizes the integral
norm

The norm
is induced by the inner product

Therefore
is minimal if p is the
orthogonal projection of the function f on the
subspace
of quadratic polynomials.
We should apply the Gram-Schmidt process to the
polynomials 1, x, x2 which form a basis for
.
This would yield an orthogonal basis 
Then

Orthogonal polynomials
P: the vector space of all polynomials with real
coefficients :
Basis for P: 
Suppose that P is endowed with an inner product.
Definition. Orthogonal polynomials (relative to
the inner product) are polynomials 
such that deg
(
is a non zero constant )
and 
Orthogonal polynomials can be obtained by applying
the Gram-Schmidt orthogonalization process
to the basis 1, x, x2, . . . :

Then
are orthogonal
polynomials.
Theorem (a) Orthogonal polynomials always exist.
(b) The orthogonal polynomial of a fixed degree is
unique up to scaling.
(c) A polynomial p ≠ 0 is an orthogonal
polynomial if and only if <p, q> = 0 for any
polynomial q with deg q < deg p.
(d) A polynomial p ≠ 0 is an orthogonal
polynomial if and only if
for any
0 ≤ k < deg p.
Example. 
Note that
if m + n is
odd.
Hence
contains only even powers of x while
contains only odd powers of x.

are called the
Legendre polynomials.
Instead of normalization, the orthogonal
polynomials are subject to standardization.
The standardization for the Legendre polynomials is
. In particular,


Problem. Find 
Let
We know that
and
for
0 ≤ k ≤ 3.


Thus 

Legendre polynomials
Problem. Find a quadratic polynomial that is the
best least squares fit to the function f (x) = |x| on
the interval [−1, 1].
The best least squares fit is a polynomial p(x) that
minimizes the distance relative to the integral norm

over all polynomials of degree 2.
The norm
is minimal if
p is the orthogonal
projection of the function f on the subspace
of
polynomials of degree at most 2.
The Legendre polynomials
form an orthogonal basis
for
. Therefore

In general, 
Problem. Find a quadratic polynomial that is the
best least squares fit to the function f (x) = |x| on
the interval [−1, 1].
Solution :


Recurrent formula for the Legendre polynomials:

For example, 
