Skip to main content

Section 7.3 Fourier Series

The answer to the question at the end of the Section 7.2 is very positive: most functions can, in fact, be approximated by a series with term \(\sin nx\text{.}\) These series are called Fourier series and I’ll spend the current section defining and investigating them.

Subsection 7.3.1 Series and Bases for Functions

The series in Section 7.2 only involved sine functions, but the general Fourier series involves both sine and cosine.

Definition 7.3.1.

Let \(a_n\) and \(b_n\) be real numbers. A Fourier series is a series of the form
\begin{equation*} f(x) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos (nx) + \sum_{n=1}^\infty b_n \sin (nx)\text{.} \end{equation*}
In general, function as series can be consider a sums over a particular basis. For Taylor series, the basis was the set of monomials: \(x^n\) for \(n \in \NN\text{.}\) A Taylor series is an attempt to write a general function as a sum of these monomials. For Fourier series, the is \(\{ 1, \cos nx, \sin nx \}\) for \(n \in \NN\text{.}\)
In a Fourier series, I can split the basis into two pieces: the sine pieces and the cosine pieces (including the constant \(1\) in the later). If I restrict to only one piece, I could form a Fourier sine series or Fourier cosine series. The sine pieces are all odd functions; therefore, a Fourier sine series must be an odd function. Likewise, the cosine pieces (including the constant) are all even functions, so a Fourier cosines series must be an even function.
Given a general function \(f\text{,}\) I can write \(f = f_+ + f_-\) where \(f_+\) is even and \(f_-\) is odd. The pieces are easy to define: \(f_+ = \frac{1}{2} (f(x) + f(-x))\) and \(f_- = \frac{1}{2} (f(x) - f(-x))\text{.}\) If \(f\) has a Fourier series, then \(f_-\text{,}\) the odd piece, will have a Fourier sine series and \(f_+\text{,}\) the even piece, will have a Fourier cosine series. The heat equation, since I insisted on starting at \((0,0)\) and only considering positive values, only needs one of the two types. Since sines arose in the solution, I’ll assume the solution to the heat equation is odd and rely on Fourier sine series.

Subsection 7.3.2 Scope of Fourier Series

The good news about Fourier series is that they cover a large family of functions.
If I don’t want to work with periodic functions, I can simply look at any piecewise-continuous function defined on \([0,2T)\text{,}\) thinking of it as one period, and find a Fourier series for it. (This method works for any finite intervals.)
Therefore, I can use Fourier series to approximate any piecewise continuous function on a bounded interval. This is a very large class of functions.

Subsection 7.3.3 Properties of Fourier Series

When I talked about the Legendre polynomials, I derived a very nice orthogonality property for them. As opposed to the ordinary monomials \(x^n\text{,}\) the Legengre polynomials were pair-wise orthogonal, using integration on \([-1,1]\) as the inner product. When I find a basis for a type of series, it is very convenient for integration if the basis functions are orthogonal. (Like in linear algebra, an orthogonal basis is always easy to use).
Fourier series terms have wonderful orthogonality properties. For convenience, these properties are stated for the period \(T = 2\pi\text{.}\)

Proof.

For the proof, I use the trig identities for products of \(\sin\) and \(\cos\text{,}\) such as
\begin{equation*} \cos A \cos B = \frac{1}{2} \left( \cos(A-B) + \cos (A+B) \right)\text{.} \end{equation*}
I only show the proof of the first of the three statements. The proof is to show a particular integral is zero, so I just calculate that integral. I use a trig identity to make the product into a sum, so that the integral has an antiderivative which is reasonable to find.
\begin{align*} \int_{-\pi}^{\pi} \cos (mx) \cos (nx) dx \amp = \frac{1}{2} \int_{-\pi}^\pi \cos ((m-n)x) + \cos((m+x)x)dx \\ \amp = \frac{1}{2} \left. \left[ \frac{-\sin((m-n)x)}{m-n} - \frac{-\sin((m+n)x)}{m+n} \right] \right|_{-\pi}^{\pi} = 0 \\ \amp \text{ if } m \neq n\\ \amp = \frac{1}{2} \int_{-\pi}^\pi 1 + \cos 2m dx \\ \amp = \frac{1}{4} \left. \left( \frac{-\sin mx}{m} \right) + \frac{x}{2} \right|_{\pi}^\pi = 0 + \frac{2\pi}{2} = \pi \\ \amp \text{ if } m = n \end{align*}
For Taylor series, there were convenient properties for the calculus of the series and the calculation of coefficients. Similar properties exist for Fourier series. If I know a series is convergent, I can integrate and differentiate term-wise. (Not that differentiation and integration change a Fourier sine series into a Fourier cosine series and vice-versa.)
A method for the the calculation of coefficients comes from the orthogonality property. Assume that \(f(x)\) is expressed as a Fourier series.
\begin{equation*} f(x) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos (nx) + \sum_{n=1}^\infty b_n \sin (nx) \end{equation*}
Then I can calculate the following integral.
\begin{align*} \int_{-\pi}^\pi f(x) \cos mx dx \amp = \int_{-\pi}^\pi \frac{a_0}{2} dx + \int_{-\pi}^\pi \sum_{n=1}^\infty a_n \cos (nx) dx + \int_{-\pi}^\pi \sum_{n=1}^\infty b_n \sin (nx) dx\\ \amp = 0 + \sum_{n=1}^\infty a_n \pi \delta_{mn} + \sum_{n=1}^\infty 0\\ \amp = a_n \pi \end{align*}
The integral calculates the coefficient \(a_n\text{.}\) Similarly, the constant coefficient \(a_0\) and the sine coefficients are calculated by integrals. This gives a general result for calculating Fourier coefficients, for \(n \in \NN\text{.}\)

Example 7.3.6.

I’ll express \(f(x) = x\) on \((-\pi, \pi)\) as a Fourier series. Notice that \(f(x)\) is odd, so only sine terms are expected. I calculate the coefficients of the sine terms with integrals.
\begin{align*} b_n \amp = \frac{1}{\pi} \int_{-\pi}^\pi f(x) \sin nx dx\\ \amp = \frac{1}{\pi} \int_{-\pi}^\pi x \sin nx dx\\ \amp = \frac{1}{\pi} \left. \left( \frac{-x\cos nx}{n} \right) \right|_{-\pi}^\pi + \int_{-\pi}^\pi \frac{\cos nx}{n} dx\\ \amp = \frac{1}{\pi} \left( \frac{ -\pi \cos n \pi }{n} - \frac{ \sin (nx) }{n^2} \Bigg|_{-\pi}^\pi \right) \\ \amp = \frac{1}{\pi} \left( \frac{-\pi}{n} \right) \cos n\pi = \frac{-(-1)^n}{n} = (-1)^{n+1}\ \frac{1}{n}\\ x \amp = \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} \sin nx \end{align*}

Subsection 7.3.4 Finishing the Heat Equation Solution

If I go back to the heat equation, the initial conditions where \(u(x,0) = f(x)\) for some given function \(f\) on \([0, \pi]\) with \(f(0) = f(\pi) = 0\text{.}\) When \(t=0\text{,}\) I wrote that
\begin{equation*} f(x) = \sum_{n=1}^\infty T_n \sin (nx)\text{.} \end{equation*}
The coefficients \(T_n\) in the full solution to the heat equation must be the Fourier coefficients of the initial function \(f(x)\text{.}\) Now I know how to calculate these coefficients. Since this is a sine series, we expect that \(f\) is odd, and we extend it to \((-\pi,\pi)\) as an odd function. Then I integrate to find the coefficients.
\begin{equation*} T_n = \frac{2}{\pi} \int_0^\pi f(x) \sin nx dx \end{equation*}
Therefore, the full solution to the heat equation, with initial conditions \(f(t)\) and boundary conditions \(u(0,t) = u(\pi,t) = 0\text{,}\) is the following function.
\begin{equation*} u(x,t) = \frac{2}{\pi} \sum_{n=1}^\infty \left[ \int_0^\pi f(x) \sin (nx) dx \right] e^{-kn^2t} \sin (nx) \end{equation*}