The generalized Fourier series of a square-integrable function f: [a, b] → ,
with respect to Φ, is then
where the coefficients are given by
If Φ is a complete set, i.e., an orthonormal basis of the space of all square-integrable functions on [a, b], as opposed to a smaller orthonormal set,
the relation becomes equality in the L² sense, more precisely modulo |·|w (not necessarily pointwise, nor almost everywhere).
and because of Sturm-Liouville theory, these polynomials are eigenfunctions of the problem and are solutions orthogonal with respect to the inner product above with unit weight. So we can form a generalized Fourier series (known as a Fourier–Legendre series) involving the Legendre polynomials, and
As an example, let us calculate the Fourier–Legendre series for ƒ(x) = cos x over [−1, 1]. Now,
and a series involving these terms
which differs from cos x by approximately 0.003, about 0. It may be advantageous to use such Fourier–Legendre series since the eigenfunctions are all polynomials and hence the integrals and thus the coefficients are easier to calculate.