Approximation Chap
Approximation Chap
Levy
4 Approximations
4.1 Background
In this chapter we are interested in approximation problems. Generally speaking, start-
ing from a function f(x) we would like to nd a dierent function g(x) that belongs
to a given class of functions and is close to f(x) in some sense. As far as the class
of functions that g(x) belongs to, we will typically assume that g(x) is a polynomial
of a given degree (though it can be a trigonometric function, or any other function).
A typical approximation problem, will therefore be: nd the closest polynomial of
degree n to f(x).
What do we mean by close? There are dierent ways of measuring the distance
between two functions. We will focus on two such measurements (among many): the L
-
norm and the L
2
-norm. We chose to focus on these two examples because of the dierent
mathematical techniques that are required to solve the corresponding approximation
problems.
We start with several denitions. We recall that a norm on a vector space V over
R is a function | | : V R with the following properties:
1. |f| = [[|f|, R and f V .
2. |f| 0, f V . Also |f| = 0 i f is the zero element of V .
3. The triangle inequality: |f +g| |f| +|g|, f, g V .
We assume that the function f(x) C
0
[a, b] (continuous on [a, b]). A continuous
function on a closed interval obtains a maximum in the interval. We can therefore dene
the L
= max
axb
[f(x)[. (4.1)
The L
= max
axb
[f(x) g(x)[. (4.2)
We note that the denition of the L
_
b
a
[f(x)[
2
dx. (4.3)
1
4.1 Background D. Levy
The L
2
function space is the collection of functions f(x) for which |f|
2
< . Of
course, we do not have to assume that f(x) is continuous for the denition (4.3) to
make sense. However, if we allow f(x) to be discontinuous, we then have to be more
rigorous in terms of the denition of the interval so that we end up with a norm (the
problem is, e.g., in dening what is the zero element in the space). We therefore limit
ourselves also in this case to continuous functions only. The L
2
-distance between two
functions f(x) and g(x) is
|f g|
2
=
_
b
a
[f(x) g(x)[
2
dx. (4.4)
At this point, a natural question is how important is the choice of norm in terms of
the solution of the approximation problem. It is easy to see that the value of the norm
of a function may vary substantially based on the function as well as the choice of the
norm. For example, assume that |f|
_
b
a
[f[
2
dx (b a)|f|
.
On the other hand, it is easy to construct a function with an arbitrary small |f|
2
and
an arbitrarily large |f|
n
, such that x [a, b]
[f(x) P
n
(x)[ < , n N.
2
D. Levy 4.1 Background
We will provide a constructive proof of the Weierstrass approximation theorem: rst,
we will dene a family of polynomials, known as the Bernstein polynomials, and then
we will show that they uniformly converge to f(x).
We start with the denition. Given a continuous function f(x) in [0, 1], we dene
the Bernstein polynomials as
(B
n
f)(x) =
n
j=0
f
_
j
n
__
n
j
_
x
j
(1 x)
nj
, 0 x 1.
We emphasize that the Bernstein polynomials depend on the function f(x).
Example 4.2
Three Bernstein polynomials B
6
(x), B
10
(x), and B
20
(x) for the function
f(x) =
1
1 + 10(x 0.5)
2
on the interval [0, 1] are shown in Figure 4.1. Note the gradual convergence of B
n
(x) to
f(x).
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x
f(x)
B
6
(x)
B
10
(x)
B
20
(x)
Figure 4.1: The Bernstein polynomials B
6
(x), B
10
(x), and B
20
(x) for the function f(x) =
1
1+10(x0.5)
2
on the interval [0, 1]
We now state and prove several properties of B
n
(x) that will be used when we prove
Theorem 4.1.
3
4.1 Background D. Levy
Lemma 4.3 The following relations hold:
1. (B
n
1)(x) = 1
2. (B
n
x)(x) = x
3. (B
n
x
2
)(x) =
n 1
n
x
2
+
x
n
.
Proof.
(B
n
1)(x) =
n
j=0
_
n
j
_
x
j
(1 x)
nj
= (x + (1 x))
n
= 1.
(B
n
x)(x) =
n
j=0
j
n
_
n
j
_
x
j
(1 x)
nj
= x
n
j=1
_
n 1
j 1
_
x
j1
(1 x)
nj
= x
n1
j=0
_
n 1
j
_
x
j
(1 x)
n1j
= x[x + (1 x)]
n1
= x.
Finally,
_
j
n
_
2
_
n
j
_
=
j
n
(n 1)!
(n j)!(j 1)!
=
n 1
n 1
j 1
n
(n 1)!
(n j)!(j 1)!
+
1
n
(n 1)!
(n j)!(j 1)!
=
n 1
n
_
n 2
j 2
_
+
1
n
_
n 1
j 1
_
.
Hence
(B
n
x
2
)(x) =
n
j=0
_
j
n
_
2
_
n
j
_
x
j
(1 x)
nj
=
n 1
n
x
2
n
j=2
_
n 2
j 2
_
x
j2
(1 x)
nj
+
1
n
x
n
j=1
_
n 1
j 1
_
x
j1
(1 x)
nj
=
n 1
n
x
2
(x + (1 x))
n2
+
1
n
x(x + (1 x))
n1
=
n 1
n
x
2
+
x
n
.
In the following lemma we state several additional properties of the Bernstein poly-
nomials. The proof is left as an exercise.
Lemma 4.4 For all functions f(x), g(x) that are continuous in [0, 1], and R
1. Linearity.
(B
n
(f +g))(x) = (B
n
f)(x) + (B
n
g)(x).
4
D. Levy 4.1 Background
2. Monotonicity. If f(x) g(x) x [0, 1], then
(B
n
f)(x) (B
n
g)(x).
Also, if [f(x)[ g(x) x [0, 1] then
[(B
n
f)(x)[ (B
n
g)(x).
3. Positivity. If f(x) 0 then
(B
n
f)(x) 0.
We are now ready to prove the Weierstrass approximation theorem, Theorem 4.1.
Proof. We will prove the theorem in the interval [0, 1]. The extension to [a, b] is left as
an exercise. Since f(x) is continuous on a closed interval, it is uniformly continuous.
Hence x, y [0, 1], such that [x y[ ,
[f(x) f(y)[ . (4.5)
In addition, since f(x) is continuous on a closed interval, it is also bounded. Let
M = max
x[0,1]
[f(x)[.
Fix any point a [0, 1]. If [x a[ then (4.5) holds. If [x a[ > then
[f(x) f(a)[ 2M 2M
_
x a
_
2
.
(at rst sight this seems to be a strange way of upper bounding a function. We will
use it later on to our advantage). Combining the estimates for both cases we have
[f(x) f(a)[ +
2M
2
(x a)
2
.
We would now like to estimate the dierence between B
n
f and f. The linearity of B
n
and the property (B
n
1)(x) = 1 imply that
B
n
(f f(a))(x) = (B
n
f)(x) f(a).
Hence using the monotonicity of B
n
and the mapping properties of x and x
2
, we have,
[B
n
f(x) f(a)[ B
n
_
+
2M
2
(x a)
2
_
= +
2M
2
_
n 1
n
x
2
+
x
n
2ax +a
2
_
= +
2M
2
(x a)
2
+
2M
2
x x
2
n
.
5
4.2 The Minimax Approximation Problem D. Levy
Evaluating at x = a we have (observing that max
a[0,1]
(a a
2
) =
1
4
)
[B
n
f(a) f(a)[ +
2M
2
a a
2
n
+
M
2
2
n
. (4.6)
The point a was arbitrary so the result (4.6) holds for any point a [0, 1]. Choosing
N
M
2
2
we have n N,
|B
n
f f|
+
M
2
2
N
2.
Is interpolation a good way of approximating functions in the -norm? Not
necessarily. Discuss Runges example...
4.2 The Minimax Approximation Problem
We assume that the function f(x) is continuous on [a, b], and assume that P
n
(x) is a
polynomial of degree n. We recall that the L
= max
axb
[f(x) P
n
(x)[. (4.7)
Clearly, we can construct polynomials that will have an arbitrary large distance from
f(x). The question we would like to address is how close can we get to f(x) (in the L
(4.8)
The goal is to nd a polynomial P
n
(x) for which the inmum (4.8) is actually ob-
tained, i.e.,
d
n
(f) = |f P
n
(x)|
. (4.9)
We will refer to a polynomial P
n
(x) that satises (4.9) as a polynomial of best
approximation or the minimax polynomial. The minimal distance in (4.9) will
be referred to as the minimax error.
The theory we will explore in the following sections will show that the minimax
polynomial always exists and is unique. We will also provide a characterization of
the minimax polynomial that will allow us to identify it if we actually see it. The
general construction of the minimax polynomial will not be addressed in this text as it
is relatively technically involved. We will limit ourselves to simple examples.
6
D. Levy 4.2 The Minimax Approximation Problem
Example 4.5
We let f(x) be a monotonically increasing and continuous function on the interval [a, b]
and are interested in nding the minimax polynomial of degree zero to f(x) in that
interval. We denote this minimax polynomial by
P
0
(x) c.
Clearly, the smallest distance between f(x) and P
0
in the L
0
will be attained at both edges and will be
equal to
f(b) f(a)
2
.
4.2.1 Existence of the minimax polynomial
The existence of the minimax polynomial is provided by the following theorem.
Theorem 4.6 (Existence) Let f C
0
[a, b]. Then for any n N there exists P
n
(x)
n
, that minimizes |f(x) P
n
(x)|
i=0
i
x
i
n
.
We also let
() = (
0
, . . . ,
n
) = |f P
n
|
.
Our goal is to show that obtains a minimum in R
n+1
, i.e., that there exists a point
= (
0
, . . . ,
n
) such that
(
) = min
R
n+1
().
Step 1. We rst show that () is a continuous function on R
n+1
. For an arbitrary
= (
0
, . . . ,
n
) R
n+1
, dene
q
n
(x) =
n
i=0
i
x
i
.
7
4.2 The Minimax Approximation Problem D. Levy
Then
( +) = |f (P
n
+q
n
)|
|f P
n
|
+|q
n
|
= () +|q
n
|
.
Hence
( +) () |q
n
|
max
x[a,b]
([
0
[ +[
1
[[x[ +. . . +[
n
[[x[
n
).
For any > 0, let
= /(1 +c +. . . +c
n
), where c = max([a[, [b[). Then for any
= (
0
, . . . ,
n
) such that max [
i
[
, 0 i n,
( +) () . (4.10)
Similarly
() = |fP
n
|
= |f(P
n
+q
n
)+q
n
|
|f(P
n
+q
n
)|
+|q
n
|
= (+)+|q
n
|
,
which implies that under the same conditions as in (4.10) we also get
() ( +) ,
Altogether,
[( +) ()[ ,
which means that is continuous at . Since was an arbitrary point in R
n+1
, is
continuous in the entire R
n+1
.
Step 2. We now construct a compact set in R
n+1
on which obtains a minimum. We
let
S =
_
R
n+1
() |f|
_
.
We have
(0) = |f|
,
hence, 0 S, and the set S is nonempty. We also note that the set S is bounded and
closed (check!). Since is continuous on the entire R
n+1
, it is also continuous on S,
and hence it must obtain a minimum on S, say at
R
n+1
, i.e.,
min
S
() = (
).
8
D. Levy 4.2 The Minimax Approximation Problem
Step 3. Since 0 S, we know that
min
S
() (0) = |f|
.
Hence, if R
n+1
but , S then
() > |f|
min
S
().
This means that the minimum of over S is the same as the minimum over the entire
R
n+1
. Therefore
P
n
(x) =
n
i=0
i
x
i
, (4.11)
is the best approximation of f(x) in the L
, P
n
(x)
n
.
A lower bound is provided by the following theorem.
Theorem 4.7 (de la Vallee-Poussin) Let a x
0
< x
1
< < x
n+1
b. Let P
n
(x)
be a polynomial of degree n. Suppose that
f(x
j
) P
n
(x
j
) = (1)
j
e
j
, j = 0, . . . , n + 1,
where all e
j
,= 0 and are of an identical sign. Then
min
j
[e
j
[ d
n
(f).
Proof. By contradiction. Assume for some Q
n
(x) that
|f Q
n
|
< min
j
[e
j
[.
Then the polynomial
(Q
n
P
n
)(x) = (f P
n
)(x) (f Q
n
)(x),
is a polynomial of degree n that has the same sign at x
j
as does f(x) P
n
(x). This
implies that (Q
n
P
n
)(x) changes sign at least n + 2 times, and hence it has at least
n + 1 zeros. Being a polynomial of degree n this is possible only if it is identically
zero, i.e., if P
n
(x) Q
n
(x), which contradicts the assumptions on Q
n
(x) and P
n
(x).
9
4.2 The Minimax Approximation Problem D. Levy
4.2.3 Characterization of the minimax polynomial
The following theorem provides a characterization of the minimax polynomial in terms
of its oscillations property.
Theorem 4.8 (The oscillating theorem) Suppose that f(x) is continuous in [a, b].
The polynomial P
n
(x)
n
is the minimax polynomial of degree n to f(x) in [a, b] if
and only if f(x) P
n
(x) assumes the values |f P
n
|
n
)(x
i
) = (1)
i
|f P
n
|
, 0 i n + 1.
Let
D
= |f P
n
|
,
and let
d
n
(f) = min
Pnn
|f P
n
|
.
We replace the inmum in the original denition of d
n
(f) by a minimum because we
already know that a minimum exists. de la Vallee-Poussins theorem (Theorem 4.7)
implies that D
d
n
. On the other hand, the denition of d
n
implies that d
n
D
.
Hence D
= d
n
and P
n
(x) is the minimax polynomial.
Remark. In view of these theorems it is obvious why the Taylor expansion is a poor
uniform approximation. The sum is non oscillatory.
4.2.4 Uniqueness of the minimax polynomial
Theorem 4.9 (Uniqueness) Let f(x) be continuous on [a, b]. Then its minimax poly-
nomial P
n
(x)
n
is unique.
Proof. Let
d
n
(f) = min
Pnn
|f P
n
|
.
Assume that Q
n
(x) is also a minimax polynomial. Then
|f P
n
|
= |f Q
n
|
= d
n
(f).
10
D. Levy 4.2 The Minimax Approximation Problem
The triangle inequality implies that
|f
1
2
(P
n
+Q
n
)|
1
2
|f P
n
|
+
1
2
|f Q
n
|
= d
n
(f).
Hence,
1
2
(P
n
+Q
n
)
n
is also a minimax polynomial. The oscillating theorem
(Theorem 4.8) implies that there exist x
0
, . . . , x
n+1
[a, b] such that
[f(x
i
)
1
2
(P
n
(x
i
) +Q
n
(x
i
))[ = d
n
(f), 0 i n + 1. (4.12)
Equation (4.12) can be rewritten as
[f(x
i
) P
n
(x
i
) +f(x
i
) Q
n
(x
i
)[ = 2d
n
(f), 0 i n + 1. (4.13)
Since P
n
(x) and Q
n
(x) are both minimax polynomials, we have
[f(x
i
) P
n
(x
i
)[ |f P
n
|
= d
n
(f), 0 i n + 1. (4.14)
and
[f(x
i
) Q
n
(x
i
)[ |f Q
n
|
= d
n
(f), 0 i n + 1. (4.15)
For any i, equations (4.13)(4.15) mean that the absolute value of two numbers that
are d
n
(f) add up to 2d
n
(f). This is possible only if they are equal to each other, i.e.,
f(x
i
) P
n
(x
i
) = f(x
i
) Q
n
(x
i
), 0 i n + 1,
i.e.,
(P
n
Q
n
)(x
i
) = 0, 0 i n + 1.
Hence, the polynomial (P
n
Q
n
)(x)
n
has n + 2 distinct roots which is possible for
a polynomial of degree n only if it is identically zero. Hence
Q
n
(x) P
n
(x),
and the uniqueness of the minimax polynomial is established.
4.2.5 The near-minimax polynomial
We now connect between the minimax approximation problem and polynomial interpo-
lation. In order for f(x) P
n
(x) to change its sign n + 2 times, there should be n + 1
points on which f(x) and P
n
(x) agree with each other. In other words, we can think
of P
n
(x) as a function that interpolates f(x) at (least in) n + 1 points, say x
0
, . . . , x
n
.
What can we say about these points?
11
4.2 The Minimax Approximation Problem D. Levy
We recall that the interpolation error is given by (??),
f(x) P
n
(x) =
1
(n + 1)!
f
(n+1)
()
n
i=0
(x x
i
).
If P
n
(x) is indeed the minimax polynomial, we know that the maximum of
f
(n+1)
()
n
i=0
(x x
i
), (4.16)
will oscillate with equal values. Due to the dependency of f
(n+1)
() on the intermediate
point , we know that minimizing the error term (4.16) is a dicult task. We recall that
interpolation at the Chebyshev points minimizes the multiplicative part of the error
term, i.e.,
n
i=0
(x x
i
).
Hence, choosing x
0
, . . . , x
n
to be the Chebyshev points will not result with the minimax
polynomial, but nevertheless, this relation motivates us to refer to the interpolant at
the Chebyshev points as the near-minimax polynomial. We note that the term near-
minimax does not mean that the near-minimax polynomial is actually close to the
minimax polynomial.
4.2.6 Construction of the minimax polynomial
The characterization of the minimax polynomial in terms of the number of points in
which the maximum distance should be obtained with oscillating signs allows us to
construct the minimax polynomial in simple cases by a direct computation.
We are not going to deal with the construction of the minimax polynomial in the
general case. The algorithm for doing so is known as the Remez algorithm, and we refer
the interested reader to [?] and the references therein.
A simple case where we can demonstrate a direct construction of the polynomial is
when the function is convex, as done in the following example.
Example 4.10
Problem: Let f(x) = e
x
, x [1, 3]. Find the minimax polynomial of degree 1, P
1
(x).
Solution: Based on the characterization of the minimax polynomial, we will be looking
for a linear function P
1
(x) such that its maximal distance between P
1
(x) and f(x) is
obtained 3 times with alternative signs. Clearly, in the case of the present problem,
since the function is convex, the maximal distance will be obtained at both edges and
at one interior point. We will use this observation in the construction that follows.
The construction itself is graphically shown in Figure 4.2.
12
D. Levy 4.2 The Minimax Approximation Problem
1 a 3
x
e
1
f(a)
y
l
1
(a)
e
3
l
2
(x)
e
x
l
1
(x)
P
1
(x)
Figure 4.2: A construction of the linear minimax polynomial for the convex function e
x
on [1, 3]
We let l
1
(x) denote the line that connects the endpoints (1, e) and (3, e
3
), i.e.,
l
1
(x) = e +m(x 1).
Here, the slope m is given by
m =
e
3
e
2
. (4.17)
Let l
2
(x) denote the tangent to f(x) at a point a that is identied such that the slope
is m. Since f
(x) = e
x
, we have e
a
= m, i.e.,
a = log m.
Now
f(a) = e
log m
= m,
and
l
1
(a) = e +m(log m1).
Hence, the average between f(a) and l
1
(a) which we denote by y is given by
y =
f(a) +l
1
(a)
2
=
m +e +mlog mm
2
=
e +mlog m
2
.
13
4.3 Least-squares Approximations D. Levy
The minimax polynomial P
1
(x) is the line of slope m that passes through (a, y),
P
1
(x)
e +mlog m
2
= m(x log m),
i.e.,
P
1
(x) = mx +
e mlog m
2
,
where the slope m is given by (4.17). We note that the maximal dierence between
P
1
(x) and f(x) is obtained at x = 1, a, 3.
4.3 Least-squares Approximations
4.3.1 The least-squares approximation problem
We recall that the L
2
-norm of a function f(x) is dened as
|f|
2
=
_
b
a
[f(x)[
2
dx.
As before, we let
n
denote the space of all polynomials of degree n. The least-
squares approximation problem is to nd the polynomial that is the closest to f(x)
in the L
2
-norm among all polynomials of degree n, i.e., to nd Q
n
n
such that
|f Q
n
|
2
= min
Qnn
|f Q
n
|
2
.
4.3.2 Solving the least-squares problem: a direct method
Our goal is to nd a polynomial in
n
that minimizes the distance |f(x) Q
n
(x)|
2
among all polynomials Q
n
n
. We thus consider
Q
n
(x) =
n
i=0
a
i
x
i
.
For convenience, instead of minimizing the L
2
norm of the dierence, we will minimize
its square. We thus let denote the square of the L
2
-distance between f(x) and Q
n
(x),
i.e.,
(a
0
, . . . , a
n
) =
_
b
a
(f(x) Q
n
(x))
2
dx
=
_
b
a
f
2
(x)dx 2
n
i=0
a
i
_
b
a
x
i
f(x)dx +
n
i=0
n
j=0
a
i
a
j
_
b
a
x
i+j
dx.
14
D. Levy 4.3 Least-squares Approximations
is a function of the n + 1 coecients in the polynomial Q
n
(x). This means that we
want to nd a point a
= (a
0
, . . . , a
n
) R
n+1
for which obtains a minimum. At this
point
a
k
a=a
= 0. (4.18)
The condition (4.18) implies that
0 = 2
_
b
a
x
k
f(x)dx +
n
i=0
a
i
_
b
a
x
i+k
dx +
n
j=0
a
j
_
b
a
x
j+k
dx (4.19)
= 2
_
n
i=0
a
i
_
b
a
x
i+k
dx
_
b
a
x
k
f(x)dx
_
.
This is a linear system for the unknowns (a
0
, . . . , a
n
):
n
i=0
a
i
_
b
a
x
i+k
dx =
_
b
a
x
k
f(x), k = 0, . . . , n. (4.20)
We thus know that the solution of the least-squares problem is the polynomial
Q
n
(x) =
n
i=0
a
i
x
i
,
where the coecients a
i
, i = 0, . . . , n, are the solution of (4.20), assuming that this
system can be solved. Indeed, the system (4.20) always has a unique solution, which
proves that not only the least-squares problem has a solution, but that it is also unique.
We let H
n+1
(a, b) denote the (n+1) (n+1) coecients matrix of the system (4.20)
on the interval [a, b], i.e.,
(H
n+1
(a, b))
i,k
=
_
b
a
x
i+k
dx, 0 i, k n.
For example, in the case where [a, b] = [0, 1],
H
n
(0, 1) =
_
_
_
_
_
1/1 1/2 . . . 1/n
1/2 1/3 . . . 1/(n + 1)
.
.
.
.
.
.
1/n 1/(n + 1) . . . 1/(2n 1)
_
_
_
_
_
(4.21)
The matrix (4.21) is known as the Hilbert matrix.
Lemma 4.11 The Hilbert matrix is invertible.
15
4.3 Least-squares Approximations D. Levy
Proof. We leave it is an exercise to show that the determinant of H
n
is given by
det(H
n
) =
(1!2! (n 1)!)
4
1!2! (2n 1)!
.
Hence, det(H
n
) ,= 0 and H
n
is invertible.
Is inverting the Hilbert matrix a good way of solving the least-squares problem? No.
There are numerical instabilities that are associated with inverting H. We demonstrate
this with the following example.
Example 4.12
The Hilbert matrix H
5
is
H
5
=
_
_
_
_
_
_
1/1 1/2 1/3 1/4 1/5
1/2 1/3 1/4 1/5 1/6
1/3 1/4 1/5 1/6 1/7
1/4 1/5 1/6 1/7 1/8
1/5 1/6 1/7 1/8 1/9
_
_
_
_
_
_
The inverse of H
5
is
H
5
=
_
_
_
_
_
_
25 300 1050 1400 630
300 4800 18900 26880 12600
1050 18900 79380 117600 56700
1400 26880 117600 179200 88200
630 12600 56700 88200 44100
_
_
_
_
_
_
The condition number of H
5
is 4.77 10
5
, which indicates that it is ill-conditioned. In
fact, the condition number of H
n
increases with the dimension n so inverting it becomes
more dicult with an increasing dimension.
4.3.3 Solving the least-squares problem: with orthogonal polynomials
Let P
k
n
k=0
be polynomials such that
deg(P
k
(x)) = k.
Let Q
n
(x) be a linear combination of the polynomials P
k
n
k=0
, i.e.,
Q
n
(x) =
n
j=0
c
j
P
j
(x). (4.22)
Clearly, Q
n
(x) is a polynomial of degree n. Dene
(c
0
, . . . , c
n
) =
_
b
a
[f(x) Q
n
(x)]
2
dx.
16
D. Levy 4.3 Least-squares Approximations
We note that the function is a quadratic function of the coecients of the linear
combination (4.22), c
k
. We would like to minimize . Similarly to the calculations
done in the previous section, at the minimum, c
= (c
0
, . . . , c
n
), we have
0 =
c
k
c=c
= 2
_
b
a
P
k
(x)f(x)dx + 2
n
j=0
c
j
_
b
a
P
j
(x)P
k
(x)dx,
i.e.,
n
j=0
c
j
_
b
a
P
j
(x)P
k
(x)dx =
_
b
a
P
k
(x)f(x)dx, k = 0, . . . , n. (4.23)
Note the similarity between equation (4.23) and (4.20). There, we used the basis func-
tions x
k
n
k=0
(a basis of
n
), while here we work with the polynomials P
k
(x)
n
k=0
instead. The idea now is to choose the polynomials P
k
(x)
n
k=0
such that the system
(4.23) can be easily solved. This can be done if we choose them in such a way that
_
b
a
P
i
(x)P
j
(x)dx =
ij
=
_
1, i = j,
0, j ,= j.
(4.24)
Polynomials that satisfy (4.24) are called orthonormal polynomials. If, indeed, the
polynomials P
k
(x)
n
k=0
are orthonormal, then (4.23) implies that
c
j
=
_
b
a
P
j
(x)f(x)dx, j = 0, . . . , n. (4.25)
The solution of the least-squares problem is a polynomial
Q
n
(x) =
n
j=0
c
j
P
j
(x), (4.26)
with coecients c
j
, j = 0, . . . , n, that are given by (4.25).
Remark. Polynomials that satisfy
_
b
a
P
i
(x)P
j
(x)dx =
_
_
_
_
b
a
(P
i
(x))
2
, i = j,
0, i ,= j,
with
_
b
a
(P
i
(x))
2
dx that is not necessarily 1 are called orthogonal polynomials. In
this case, the solution of the least-squares problem is given by the polynomial Q
n
(x) in
(4.26) with the coecients
c
j
=
_
b
a
P
j
(x)f(x)dx
_
b
a
(P
j
(x))
2
dx
, j = 0, . . . , n. (4.27)
17
4.3 Least-squares Approximations D. Levy
4.3.4 The weighted least squares problem
A more general least-squares problem is the weighted least squares approximation
problem. We consider a weight function, w(x), to be a continuous on (a, b), non-
negative function with a positive mass, i.e.,
_
b
a
w(x)dx > 0.
Note that w(x) may be singular at the edges of the interval since we do not require
it to be continuous on the closed interval [a, b]. For any weight w(x), we dene the
corresponding weighted L
2
-norm of a function f(x) as
|f|
2,w
=
_
b
a
(f(x))
2
w(x)dx.
The weighted least-squares problem is to nd the closest polynomial Q
n
n
to f(x),
this time in the weighted L
2
-norm sense, i.e., we look for a polynomial Q
n
(x) of degree
n such that
|f Q
n
|
2,w
= min
Qnn
|f Q
n
|
2,w
. (4.28)
In order to solve the weighted least-squares problem (4.28) we follow the methodology
described in Section 4.3.3, and consider polynomials P
k
n
k=0
such that deg(P
k
(x)) = k.
We then consider a polynomial Q
n
(x) that is written as their linear combination:
Q
n
(x) =
n
j=0
c
j
P
j
(x).
By repeating the calculations of Section 4.3.3, we obtain for the coecients of the
minimizer Q
n
,
n
j=0
c
j
_
b
a
w(x)P
j
(x)P
k
(x)dx =
_
b
a
w(x)P
k
(x)f(x)dx, k = 0, . . . , n, (4.29)
(compare with (4.23)). The system (4.29) can be easily solved if we choose P
k
(x) to
be orthonormal with respect to the weight w(x), i.e.,
_
b
a
P
i
(x)P
j
(x)w(x)dx =
ij
.
Hence, the solution of the weighted least-squares problem is given by
Q
n
(x) =
n
j=0
c
j
P
j
(x), (4.30)
18
D. Levy 4.3 Least-squares Approximations
where the coecients are given by
c
j
=
_
b
a
P
j
(x)f(x)w(x)dx, j = 0, . . . , n. (4.31)
Remark. In the case where P
k
(x) are orthogonal but not necessarily normalized,
the solution of the weighted least-squares problem is given by
Q
n
(x) =
n
j=0
c
j
P
j
(x)
with
c
j
=
_
b
a
P
j
(x)f(x)w(x)dx
_
b
a
(P
j
(x))
2
w(x)dx
, j = 0, . . . , n.
4.3.5 Orthogonal polynomials
At this point we already know that orthogonal polynomials play a central role in the
solution of least-squares problems. In this section we will focus on the construction of
orthogonal polynomials. The properties of orthogonal polynomials will be studies in
Section 4.4.2.
We start by dening the weighted inner product between two functions f(x) and
g(x) (with respect to the weight w(x)):
f, g)
w
=
_
b
a
f(x)g(x)w(x)dx.
To simplify the notations, even in the weighted case, we will typically write f, g) instead
of f, g)
w
. Some properties of the weighted inner product include
1. f, g) = f, g) = f, g) , R.
2. f
1
+f
2
, g) = f
1
, g) +f
2
, g).
3. f, g) = g, f)
4. f, f) 0 and f, f) = 0 i f 0. Here we must assume that f(x) is continuous
in the interval [a, b]. If it is not continuous, we can have f, f) = 0 and f(x) can
still be non-zero (e.g., in one point).
The weighted L
2
-norm can be obtained from the weighted inner product by
|f|
2,w
=
_
f, f)
w
.
19
4.3 Least-squares Approximations D. Levy
Given a weight w(x), we are interested in constructing orthogonal (or orthonor-
mal) polynomials. This can be done using the Gram-Schmidt orthogonalization
process, which we now describe in detail.
In the general context of linear algebra, the Gram-Schmidt process is being used to
convert one set of linearly independent vectors to an orthogonal set of vectors that spans
the same subspace as the original set. In our context, we should think about the process
as converting one set of polynomials that span the space of polynomials of degree n
to an orthogonal set of polynomials that spans the same space
n
. Accordingly, we
set the initial set of polynomials as 1, x, x
2
, . . . , x
n
, which we would like to convert to
orthogonal polynomials (of an increasing degree) with respect to the weight w(x).
We will rst demonstrate the process with the weight w(x) 1. We will generate a
set of orthogonal polynomials P
0
(x), . . . , P
n
(x) from 1, x, . . . , x
n
. The degree of the
polynomials P
i
is i.
We start by setting
P
0
(x) = 1.
We then let
P
1
(x) = x c
0
1
P
0
(x) = x c
0
1
.
The orthogonality condition
_
b
a
P
1
P
0
dx = 0, implies that
_
b
a
1 (x c
0
1
)dx = 0,
from which c= (a+b)/2, and thus
P
1
(x) = x
a +b
2
.
The computation continues in a similar fashion. We set
P
2
(x) = x
2
c
0
2
P
0
(x) c
1
2
(x).
The two unknown coecients, c
0
2
and c
1
2
, are computed from the orthogonality condi-
tions. This time, P
2
(x) should be orthogonal to P
0
(x) and to P
1
(x), i.e.,
_
b
a
P
2
(x)P
0
(x)dx = 0, and
_
b
a
P
2
(x)P
1
(x)dx = 0,
and so on. If, in addition to the orthogonality condition, we would like the polynomials
to be orthonormal, all that remains is to normalize:
P
n
(x) =
P
n
(x)
|P
n
(x)|
=
P
n
(x)
_
_
b
a
(P
n
(x))
2
dx
, n.
The orthogonalization process is identical to the process that we described even when
the weight w(x) is not uniformly one. In this case, every integral will contain the weight.
20
D. Levy 4.4 Examples of orthogonal polynomials
4.4 Examples of orthogonal polynomials
This section includes several examples of orthogonal polynomials and a very brief sum-
mary of some of their properties.
1. Legendre polynomials. We start with the Legendre polynomials. This is a
family of polynomials that are orthogonal with respect to the weight
w(x) 1,
on the interval [1, 1].
In addition to deriving the Legendre polynomials through the Gram-Schmidt or-
thogonalization process, it can be shown that the Legendre polynomials can be
obtained from the recurrence relation
(n + 1)P
n+1
(x) (2n + 1)xP
n
(x) +nP
n1
(x) = 0, n 1, (4.32)
starting from the rst two polynomials:
P
0
(x) = 1, P
1
(x) = x.
Instead of calculating these polynomials one by one from the recurrence relation,
they can be obtained directly from Rodrigues formula
P
n
(x) =
1
2
n
n!
d
n
dx
n
_
(x
2
1)
n
, n 0. (4.33)
The Legendre polynomials satisfy the orthogonality condition
P
n
, P
m
) =
2
2n + 1
nm
. (4.34)
2. Chebyshev polynomials. Our second example is of the Chebyshev polynomials.
These polynomials are orthogonal with respect to the weight
w(x) =
1
1 x
2
,
on the interval [1, 1]. They satisfy the recurrence relation
T
n+1
(x) = 2xT
n
(x) T
n1
(x), n 1, (4.35)
together with T
0
(x) = 1 and T
1
(x) = x (see (??)). They and are explicitly given
by
T
n
(x) = cos(ncos
1
x), n 0. (4.36)
21
4.4 Examples of orthogonal polynomials D. Levy
(see (??)). The orthogonality relation that they satisfy is
T
n
, T
m
) =
_
_
0, n ,= m,
, n = m = 0,
2
, n = m ,= 0.
(4.37)
3. Laguerre polynomials. We proceed with the Laguerre polynomials. Here the
interval is given by [0, ) with the weight function
w(x) = e
x
.
The Laguerre polynomials are given by
L
n
(x) =
e
x
n!
d
n
dx
n
(x
n
e
x
), n 0. (4.38)
The normalization condition is
|L
n
| = 1. (4.39)
A more general form of the Laguerre polynomials is obtained when the weight is
taken as
e
x
x
,
for an arbitrary real > 1, on the interval [0, ).
4. Hermite polynomials. The Hermite polynomials are orthogonal with respect
to the weight
w(x) = e
x
2
,
on the interval (, ). The can be explicitly written as
H
n
(x) = (1)
n
e
x
2 d
n
e
x
2
dx
n
, n 0. (4.40)
Another way of expressing them is by
H
n
(x) =
[n/2]
k=0
(1)
k
n!
k!(n 2k)!
(2x)
n2k
, (4.41)
where [x] denotes the largest integer that is x. The Hermite polynomials satisfy
the recurrence relation
H
n+1
(x) 2xH
n
(x) + 2nH
n1
(x) = 0, n 1, (4.42)
22
D. Levy 4.4 Examples of orthogonal polynomials
together with
H
0
(x) = 1, H
1
(x) = 2x.
They satisfy the orthogonality relation
_
e
x
2
H
n
(x)H
m
(x)dx = 2
n
n!
nm
. (4.43)
4.4.1 Another approach to the least-squares problem
In this section we present yet another way of deriving the solution of the least-squares
problem. Along the way, we will be able to derive some new results. We recall that our
goal is to minimize |f(x) Q
n
(x)|
2,w
, Q
n
n
, i.e., to minimize the integral
_
b
a
w(x)(f(x) Q
n
(x))
2
dx (4.44)
among all the polynomials Q
n
(x) of degree n. The minimizer of (4.44) is denoted by
Q
n
(x).
Assume that P
k
(x)
k0
is an orthogonal family of polynomials with respect to w(x),
and let
Q
n
(x) =
n
j=0
c
j
P
j
(x).
Then
|f Q
n
|
2
2,w
=
_
b
a
w(x)
_
f(x)
n
j=0
c
j
P
j
(x)
_
2
dx.
Hence
0
_
f
n
j=0
c
j
P
j
, f
n
j=0
c
j
P
j
_
w
= f, f)
w
2
n
j=0
c
j
f, P
j
)
w
+
n
i=0
n
j=0
c
i
c
j
P
i
, P
j
)
w
= |f|
2
2,w
2
n
j=0
c
j
f, P
j
)
w
+
n
j=0
c
2
j
|P
j
|
2
2,w
= |f|
2
2,w
n
j=0
f, P
j
)
2
w
|P
j
|
2
2,w
+
n
j=0
_
f, P
j
)
w
|P
j
|
2,w
c
j
|P
j
|
2,w
_
2
.
The last expression is minimal i
f, P
j
)
w
|P
j
|
2,w
c
j
|P
j
|
2,w
= 0, 0 j n,
23
4.4 Examples of orthogonal polynomials D. Levy
i.e., if
c
j
=
f, P
j
)
w
|P
j
|
2
2,w
.
Hence, there exists a unique least-squares approximation which is given by
Q
n
(x) =
n
j=0
f, P
j
)
w
|P
j
|
2
2,w
P
j
(x). (4.45)
If the polynomials P
j
(x) are also normalized so that |P
j
|
2,w
= 1, then the minimizer
Q
n
(x) in (4.45) becomes
Q
n
(x) =
n
j=0
f, P
j
)
w
P
j
(x).
Remarks.
1. We can write
|f Q
n
|
2
2,w
=
_
b
a
w(x)
_
f(x)
n
j=0
c
j
P
j
(x)
_
2
dx =
= |f|
2
2,w
2
n
j=0
f, P
j
)
w
c
j
+
n
j=0
|P
j
|
2
2,w
c
2
j
.
Since |P
j
|
2,w
= 1, c
j
= f, P
j
)
w
, so that
|f Q
n
|
2
2,w
= |f|
2
2,w
n
j=0
f, P
j
)
2
w
.
Hence
n
j=0
f, P
j
)
2
w
= |f|
2
|f Q
n
|
2
|f|
2
,
i.e.,
n
j=0
f, P
j
)
2
w
|f|
2
2,w
. (4.46)
The inequality (4.46) is called Bessels inequality.
24
D. Levy 4.4 Examples of orthogonal polynomials
2. Assuming that [a, b] is nite, we have
lim
n
|f Q
n
|
2,w
= 0.
Hence
|f|
2
2,w
=
j=0
f, P
j
)
2
w
, (4.47)
which is known as Parsevals equality.
Example 4.13
Problem: Let f(x) = cos x on [1, 1]. Find the polynomial in
2
, that minimizes
_
1
1
[f(x) Q
2
(x)]
2
dx.
Solution: The weight w(x) 1 on [1, 1] implies that the orthogonal polynomials we
need to use are the Legendre polynomials. We are seeking for polynomials of degree
2 so we write the rst three Legendre polynomials
P
0
(x) 1, P
1
(x) = x, P
2
(x) =
1
2
(3x
2
1).
The normalization factor satises, in general,
_
1
1
P
2
n
(x) =
2
2n + 1
.
Hence
_
1
1
P
2
0
(x)dx = 2,
_
1
1
P
1
(x)dx =
2
3
,
_
1
1
P
2
2
(x)dx =
2
5
.
We can then replace the Legendre polynomials by their normalized counterparts:
P
0
(x)
1
2
, P
1
(x) =
_
3
2
x, P
2
(x) =
5
2
2
(3x
2
1).
We now have
f, P
0
) =
_
1
1
cos x
1
2
dx =
1
2
sin x
1
1
=
2 sin 1.
Hence
Q
0
(x) sin 1.
25
4.4 Examples of orthogonal polynomials D. Levy
We also have
f, P
1
) =
_
1
1
cos x
_
3
2
xdx = 0.
which means that Q
1
(x) = Q
0
(x). Finally,
f, P
2
) =
_
1
1
cos x
_
5
2
3x
2
1
2
=
1
2
_
5
2
(12 cos 1 8 sin 1),
and hence the desired polynomial, Q
2
(x), is given by
Q
2
(x) = sin 1 +
_
15
2
cos 1 5 sin 1
_
(3x
2
1).
In Figure 4.3 we plot the original function f(x) = cos x (solid line) and its approximation
Q
2
(x) (dashed line). We zoom on the interval x [0, 1].
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.5
0.55
0.6
0.65
0.7
0.75
0.8
0.85
0.9
0.95
1
x
Figure 4.3: A second-order L
2
-approximation of f(x) = cos x. Solid line: f(x); Dashed
line: its approximation Q
2
(x)
If the weight is w(x) 1 but the interval is [a, b], we can still use the Legendre
polynomials if we make the following change of variables. Dene
x =
b +a + (b a)t
2
.
26
D. Levy 4.4 Examples of orthogonal polynomials
Then the interval 1 t 1 is mapped to a x b. Now, dene
F(t) = f
_
b +a + (b a)t
2
_
= f(x).
Hence
_
b
a
[f(x) Q
n
(x)]
2
dx =
b a
2
_
1
1
[F(t) q
n
(t)]
2
dt.
Example 4.14
Problem: Let f(x) = cos x on [0, ]. Find the polynomial in
1
that minimizes
_
0
[f(x) Q
1
(x)]
2
dx.
Solution:
_
0
(f(x) Q
1
(x))
2
dx =
2
_
1
1
[F(t) q
n
(t)]
2
dt.
Letting
x =
+t
2
=
2
(1 +t),
we have
F(t) = cos
_
2
(1 +t)
_
= sin
t
2
.
We already know that the rst two normalized Legendre polynomials are
P
0
(t) =
1
2
, P
1
(t) =
_
3
2
t.
Hence
F, P
0
) =
_
1
1
1
2
sin
t
2
dt = 0,
which means that Q
0
(t) = 0. Also
F, P
1
) =
_
1
1
sin
t
2
_
3
2
tdt =
_
3
2
_
sin
t
2
_
2
_
2
t cos
t
2
2
_
1
1
=
_
3
2
8
2
.
Hence
q
1
(t) =
3
2
8
2
t =
12
2
t = Q
1
(x) =
12
2
_
2
x 1
_
.
In Figure 4.4 we plot the original function f(x) = cos x (solid line) and its approximation
Q
1
(x) (dashed line).
27
4.4 Examples of orthogonal polynomials D. Levy
! !"# $ $"# % %"# &
$
!"#
!
!"#
$
x
Figure 4.4: A rst-order L
2
-approximation of f(x) = cos x on the interval [0, ]. Solid
line: f(x), Dashed line: its approximation Q
1
(x)
Example 4.15
Problem: Let f(x) = cos x in [0, ). Find the polynomial in
1
that minimizes
_
0
e
x
[f(x) Q
1
(x)]
2
dx.
Solution: The family of orthogonal polynomials that correspond to this weight on
[0, ) are Laguerre polynomials. Since we are looking for the minimizer of the
weighted L
2
norm among polynomials of degree 1, we will need to use the rst two
Laguerre polynomials:
L
0
(x) = 1, L
1
(x) = 1 x.
We thus have
f, L
0
)
w
=
_
0
e
x
cos xdx =
e
x
(cos x + sin x)
2
0
=
1
2
.
Also
f, L
1
)
w
=
_
0
e
x
cos x(1x)dx =
1
2
_
xe
x
(cos x + sin x)
2
e
x
(2 sin x)
4
_
0
= 0.
This means that
Q
1
(x) = f, L
0
)
w
L
0
(x) +f, L
1
)
w
L
1
(x) =
1
2
.
28
D. Levy 4.4 Examples of orthogonal polynomials
4.4.2 Properties of orthogonal polynomials
We start with a theorem that deals with some of the properties of the roots of orthogonal
polynomials. This theorem will become handy when we discuss Gaussian quadratures
in Section ??. We let P
n
(x)
n0
be orthogonal polynomials in [a, b] with respect to the
weight w(x).
Theorem 4.16 The roots x
j
, j = 1, . . . , n of P
n
(x) are all real, simple, and are in
(a, b).
Proof. Let x
1
, . . . , x
r
be the roots of P
n
(x) in (a, b). Let
Q
r
(x) = (x x
1
) . . . (x x
r
).
Then Q
r
(x) and P
n
(x) change their signs together in (a, b). Also
deg(Q
r
(x)) = r n.
Hence (P
n
Q
r
)(x) is a polynomial with one sign in (a, b). This implies that
_
b
a
P
n
(x)Q
r
(x)w(x)dx ,= 0,
and hence r = n since P
n
(x) is orthogonal to polynomials of degree less than n.
Without loss of generality we now assume that x
1
is a multiple root, i.e.,
P
n
(x) = (x x
1
)
2
P
n2
(x).
Hence
P
n
(x)P
n2
(x) =
_
P
n
(x)
x x
1
_
2
0,
which implies that
_
b
a
P
n
(x)P
n2
(x)dx > 0.
This is not possible since P
n
is orthogonal to P
n2
. Hence roots can not repeat.
Another important property of orthogonal polynomials is that they can all be written
in terms of recursion relations. We have already seen specic examples of such relations
for the Legendre, Chebyshev, and Hermite polynomials (see (4.32), (4.35), and (4.42)).
The following theorem states such relations always hold.
29
4.4 Examples of orthogonal polynomials D. Levy
Theorem 4.17 (Triple Recursion Relation) Any three consecutive orthonormal poly-
nomials are related by a recursion formula of the form
P
n+1
(x) = (A
n
x +B
n
)P
n
(x) C
n
P
n1
(x).
If a
k
and b
k
are the coecients of the terms of degree k and degree k 1 in P
k
(x), then
A
n
=
a
n+1
a
n
, B
n
=
a
n+1
a
n
_
b
n+1
a
n+1
b
n
a
n
_
, C
n
=
a
n+1
a
n1
a
2
n
.
Proof. For
A
n
=
a
n+1
a
n
,
let
Q
n
(x) = P
n+1
(x) A
n
xP
n
(x)
= (a
n+1
x
n+1
+b
n+1
x
n
+. . .)
a
n+1
a
n
x(a
n
x
n
+b
n
x
n1
+. . .)
=
_
b
n+1
a
n+1
b
n
a
n
_
x
n
+. . .
Hence deg(Q(x)) n, which means that there exists
0
, . . . ,
n
such that
Q(x) =
n
i=0
i
P
i
(x).
For 0 i n 2,
i
=
Q, P
i
)
P
i
, P
i
)
= Q, P
i
) = P
n+1
A
n
xP
n
, P
i
) = A
n
xP
n
, P
i
) = 0.
Hence
Q
n
(x) =
n
P
n
(x) +
n1
P
n1
(x).
Set
n
= B
n
and
n1
= C
n
. Then, since
xP
n1
=
a
n1
a
n
P
n
+q
n1
,
we have
C
n
= A
n
xP
n
, P
n1
) = A
n
P
n
, xP
n1
) = A
n
_
P
n
,
a
n1
a
n
P
n
+q
n1
_
= A
n
a
n1
a
n
.
30
D. Levy 4.4 Examples of orthogonal polynomials
Finally
P
n+1
= (A
n
x +B
n
)P
n
C
n
P
n1
,
can be explicitly written as
a
n+1
x
n+1
+b
n+1
x
n
+. . . = (A
n
x+B
n
)(a
n
x
n
+b
n
x
n1
+. . .)C
n
(a
n1
x
n1
+b
n1
x
n2
+. . .).
The coecient of x
n
is
b
n+1
= A
n
b
n
+B
n
a
n
,
which means that
B
n
= (b
n+1
A
n
b
n
)
1
a
n
.
31