### 9.2 Some properties of orthogonal polynomials

Given any weighted scalar product as in Eq. (9.17), the expansion of a function into
polynomials is optimal in the associated norm if orthogonally projected to the space of polynomials of
degree at most . More precisely, given a function on some interval and an
orthonormal basis of polynomials , where has degree , its orthogonal projection,
onto the subspace spanned by satisfies
or
for all in the span of , that is, it minimizes the error for such .
The operator (9.33) is a projection in the sense that

and it is orthogonal with respect to : the residual satisfies
Notice that, unlike the interpolation problem (discussed below) here, the solution of the above least-squares
problem (9.34) is not required to agree with at any prescribed set of points.
In order to obtain an orthonormal basis of , a Gram–Schmidt procedure could be applied to the
standard basis . However, exploiting properties of polynomials, a more efficient approach can be
used, where the first two polynomials are constructed and then a three-term recurrence formula is
used.

In the following construction, each orthonormal polynomial is chosen to be monic, meaning that its
leading coefficient is one.

- The zero-th-order polynomial:
The conditions that has degree zero and that it is monic only leaves the choice

- The first-order one:
Writing the condition yields

- The higher-order polynomials:

Proof. Let . Since is a polynomial of degree , it can be expanded as

where the orthogonality of the polynomials

implies that

for

. However, since

and

can be expanded in terms
of the polynomials

, it follows again by the orthogonality of

that

for

. Finally,

since

and

are both monic. This proves
Eq. (

9.40). □

Notice that , as defined in Eq. (9.40), remains monic and can therefore be automatically used
for constructing , without any rescaling.

Eqs. (9.38, 9.39, 9.40) allow one to compute orthogonal polynomials for any weight function ,
without the expense of a Gram–Schmidt procedure. For specific weight cases, there are even more explicit
recurrence formulae, such as those in Eqs. (9.43, 9.44) and (9.48, 9.49, 9.50) below for Legendre and
Chebyshev polynomials, respectively.