$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 4.3: More on the Fourier Series

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

Before reading the lecture, it may be good to first try Project IV (Fourier series) from the IODE website: www.math.uiuc.edu/iode/. After reading the lecture it may be good to continue with Project V (Fourier series again).

## 4.3.1 2L-Periodic Functions

We have computed the Fourier series for a $$2 \pi$$-periodic function, but what about functions of different periods. Well, fear not, the computation is a simple case of change of variables. We can just rescale the independent axis. Suppose that we have a $$2L$$-periodic function $$f(t)$$ ($$L$$ is called the half period). Let $$S= \dfrac{\pi}{L}t$$. Then the function

$g(s)=f \left( \dfrac{L}{\pi}s \right)$

is $$2 \pi$$-periodic. We want to also rescale all our sines and cosines. We want to write

$f(t)= \dfrac{a_0}{2}+ \sum_{n=1}^{\infty}a_n \cos \left( \dfrac{n \pi}{L}t \right) + b_n \sin \left( \dfrac{n \pi}{L}t \right).$

If we change variables to $$s$$ we see that

$g(s)= \dfrac{a_0}{2}+ \sum_{n=1}^{\infty}a_n \cos(ns) + b_n \sin(ns).$

We compute $$a_n$$ and $$b_n$$ as before. After we write down the integrals we change variables from $$s$$ back to $$t$$.

\begin{align}\begin{aligned} a_0 &= \dfrac{1}{\pi} \int_{-\pi}^{\pi}g(s)ds=\dfrac{1}{L} \int_{-L}^{L}f(t)dt, \\ a_n &= \dfrac{1}{\pi} \int_{-\pi}^{\pi}g(s) \cos(ns)ds=\dfrac{1}{L} \int_{-L}^{L}f(t) \cos \left( \dfrac{n \pi}{L}t \right)dt, \\ b_n &= \dfrac{1}{\pi} \int_{-\pi}^{\pi}g(s) \sin(ns)ds=\dfrac{1}{L} \int_{-L}^{L}f(t) \sin \left( \dfrac{n \pi}{L}t \right)dt. \end{aligned}\end{align}

The two most common half periods that show up in examples are $$\pi$$ and $$1$$ because of the simplicity. We should stress that we have done no new mathematics, we have only changed variables. If you understand the Fourier series for $$2 \pi$$-periodic functions, you understand it for $$2L$$-periodic functions. All that we are doing is moving some constants around, but all the mathematics is the same.

Example $$\PageIndex{1}$$

Let

$f(t)=|t|~~~~~ {\rm{~for~}} -1<t \leq 1,$

extended periodically. The plot of the periodic extension is given in Figure $$\PageIndex{1}$$. Compute the Fourier series of $$f(t)$$. Figure $$\PageIndex{1}$$: Periodic extension of the function $$f(t)$$.

We want to write $$f(t)=\frac{a_{0}}{2}+\sum_{n=1}^{\infty}a_{n}\cos (n\pi t)+b_{n}\sin (n\pi t)$$. For $$n\geq 1$$ we note that $$|t|\cos (n\pi t)$$ is even and hence

\begin{align}\begin{aligned} a_n &= \int_{-1}^{1} f(t) \cos( n \pi t)dt \\ &= 2 \int_{0}^{1} t \cos( n \pi t)dt \\ &= 2 \left[ \dfrac{t}{n \pi} \sin(n \pi t)\right] _{t=0}^{1} - 2 \int_{0}^{1} \dfrac{1}{n \pi} \sin(n \pi t)dt \\ &=0 + \dfrac{1}{n^2 \pi^2} \left[ \cos(n \pi t)\right] _{t=0}^{1} = \dfrac{2((-1)^n-1)}{n^2 \pi^2}= \left\{ \begin{array}{cc} 0 & {\rm{~if~}} {\it{n}} {\rm{~is~even,}}\\ \dfrac{-4}{n^2 \pi^2} & {\rm{~if~}} {\it{n}} {\rm{~is~odd.}} \end{array} \right. \end{aligned}\end{align}

Next we find $$a_0$$

$a_0 = \int_{-1}^{1} |t|dt=1.$

You should be able to find this integral by thinking about the integral as the area under the graph without doing any computation at all. Finally we can find $$b_n$$. Here, we notice that $$|t| \sin(n \pi t)$$ is odd and, therefore,

$b_n= \int_{-1}^{1} f(t) \sin( n \pi t)dt=0.$

Hence, the series is

$\dfrac{1}{2}+ \sum_{\underset{n~ \rm{odd}}{n=1}}^{\infty} \dfrac{-4}{n^2 \pi^2} \cos(n \pi t)$

Let us explicitly write down the first few terms of the series up to the $$3^{\rm{rd}}$$ harmonic.

$\dfrac{1}{2}- \dfrac{4}{\pi^2} \cos(\pi t)- \dfrac{4}{9 \pi^2} \cos(3 \pi t)- \cdots$

The plot of these few terms and also a plot up to the $$20^{\rm{th}}$$ harmonic is given in Figure $$\PageIndex{2}$$. You should notice how close the graph is to the real function. You should also notice that there is no “Gibbs phenomenon” present as there are no discontinuities. Figure $$\PageIndex{2}$$: Fourier series of $$f(t)$$ up to the $$3^{\text{rd}}$$ harmonic (left graph) and up to the $$20^{\text{th}}$$ harmonic (right graph).

## 4.3.2 Convergence

We will need the one sided limits of functions. We will use the following notation

$f(c-) = \lim_{t \uparrow c} f(t), \qquad \text{and} \qquad f(c+) = \lim_{t \downarrow c} f(t).$

If you are unfamiliar with this notation, $$\lim_{t \uparrow c} f(t)$$ means we are taking a limit of $$f(t)$$ as $$t$$ approaches $$c$$ from below (i.e. $$t<c$$) and $$\lim_{t \downarrow c} f(t)$$ means we are taking a limit of $$f(t)$$ as $$t$$ approaches $$c$$ from above (i.e. $$t>c$$). For example, for the square wave function

$\label{eq:12} f(t)= \left\{ \begin{array}{ccc} 0 & \rm{if}& - \pi < t \leq 0, \\ \pi & \rm{if} & 0 < t \leq \pi , \end{array} \right.$

we have $$f(0-)=0$$ and $$f(0+)= \pi$$.

Let $$f(t)$$ be a function defined on an interval $$[a,b]$$. Suppose that we find finitely many points $$a=t_0, t_1, t_2, \ldots , t_k=b$$ in the interval, such that $$f(t)$$ is continuous on the intervals $$(t_0,t_1), (t_1,t_2), \ldots , (t_{k-1},t_k)$$. Also suppose that all the one sided limits exist, that is, all of $$f(t_0+), f(t_1-), f(t_1+), f(t_2-), f(t_2+), \ldots , f(t_k-)$$ exist and are finite. Then we say $$f(t)$$ is piecewise continuous.

If moreover, $$f(t)$$ is differentiable at all but finitely many points, and $$f'(t)$$ is piecewise continuous, then $$f(t)$$ is said to be piecewise smooth.

Example $$\PageIndex{2}$$

The square wave function $$\eqref{eq:12}$$ is piecewise smooth on $$[- \pi, \pi]$$ or any other interval. In such a case we simply say that the function is piecewise smooth.

Example $$\PageIndex{3}$$

The function $$f(t)=|t|$$ is piecewise smooth.

Example $$\PageIndex{4}$$

The function $$f(t)= \dfrac{1}{t}$$ is not piecewise smooth on $$[-1, 1]$$ (or any other interval containing zero). In fact, it is not even piecewise continuous.

Example $$\PageIndex{5}$$

The function $$f(t)=\sqrt{t}$$ is not piecewise smooth on $$[- 1, 1]$$ (or any other interval containing zero). $$f(t)$$ is continuous, but the derivative of $$f(t)$$ is unbounded near zero and hence not piecewise continuous.

Piecewise smooth functions have an easy answer on the convergence of the Fourier series.

Theorem $$\PageIndex{1}$$

Suppose $$f(t)$$ is a $$2L$$-periodic piecewise smooth function. Let

$\dfrac{a_0}{2} + \sum^{\infty}_{n=1} a_n \cos \left( \dfrac{n \pi}{L}t \right)+b_n \sin \left( \dfrac{n \pi}{L}t \right)$

be the Fourier series for $$f(t)$$. Then the series converges for all $$t$$. If $$f(t)$$ is continuous near $$t$$, then

$f(t)= \dfrac{a_0}{2} + \sum^{\infty}_{n=1} a_n \cos \left( \dfrac{n \pi}{L}t \right)+b_n \sin \left( \dfrac{n \pi}{L}t \right).$

Otherwise

$\dfrac{f(t-)+f(t+)}{2}= \dfrac{a_0}{2} + \sum^{\infty}_{n=1} a_n \cos \left( \dfrac{n \pi}{L}t \right)+b_n \sin \left( \dfrac{n \pi}{L}t \right).$

If we happen to have that $$f(t)= \dfrac{f(t-)+f(t+)}{2}$$ at all the discontinuities, the Fourier series converges to $$f(t)$$ everywhere. We can always just redefine $$f(t)$$ by changing the value at each discontinuity appropriately. Then we can write an equals sign between $$f(t)$$ and the series without any worry. We mentioned this fact briefly at the end last section.

Note that the theorem does not say how fast the series converges. Think back to the discussion of the Gibbs phenomenon in the last section. The closer you get to the discontinuity, the more terms you need to take to get an accurate approximation to the function.

## 4.3.3 Differentiation and Integration of Fourier Series

Not only does Fourier series converge nicely, but it is easy to differentiate and integrate the series. We can do this just by differentiating or integrating term by term.

Theorem $$\PageIndex{2}$$

Suppose

$f(t)= \dfrac{a_0}{2} + \sum^{\infty}_{n=1} a_n \cos \left( \dfrac{n \pi}{L}t \right)+b_n \sin \left( \dfrac{n \pi}{L}t \right)$

is a piecewise smooth continuous function and the derivative $$f'(t)$$ is piecewise smooth. Then the derivative can be obtained by differentiating term by term,

$f'(t)= \sum^{\infty}_{n=1} \dfrac{-a_n n \pi}{L} \sin \left( \dfrac{n \pi}{L}t \right)+\dfrac{b_n n \pi}{L} \cos \left( \dfrac{n \pi}{L}t \right).$

It is important that the function is continuous. It can have corners, but no jumps. Otherwise the differentiated series will fail to converge. For an exercise, take the series obtained for the square wave and try to differentiate the series. Similarly, we can also integrate a Fourier series.

Theorem $$\PageIndex{3}$$

Suppose

$f(t)= \dfrac{a_0}{2} + \sum^{\infty}_{n=1} a_n \cos \left( \dfrac{n \pi}{L}t \right)+b_n \sin \left( \dfrac{n \pi}{L}t \right)$

is a piecewise smooth function. Then the antiderivative is obtained by antidifferentiating term by term and so

$F(t)= \dfrac{a_0 t}{2}+ C+ \sum^{\infty}_{n=1} \dfrac{a_n L}{n \pi} \sin \left( \dfrac{n \pi}{L}t \right)+\dfrac{-b_n L}{n \pi} \cos \left( \dfrac{n \pi}{L}t \right),$

where $$F'(t)=f(t)$$ and $$C$$ is an arbitrary constant.

Note that the series for $$F(t)$$ is no longer a Fourier series as it contains the $$\dfrac{a_0 t}{2}$$ term. The antiderivative of a periodic function need no longer be periodic and so we should not expect a Fourier series.

## 4.3.4 Rates of Convergence and Smoothness

Let us do an example of a periodic function with one derivative everywhere.

Example $$\PageIndex{6}$$

Take the function

$f(t)= \left\{ \begin{array}{ccc} (t+1)t & \rm{if}& -1 < t \leq 0, \\ (1-t)t & \rm{if} & 0 < t \leq 1 , \end{array} \right.$

and extend to a 2-periodic function. The plot is given in Figure$$\PageIndex{3}$$. Figure $$\PageIndex{3}$$: Smooth $$2$$-periodic function.

Note that this function has one derivative everywhere, but it does not have a second derivative whenever $$t$$ is an integer.

Exercise $$\PageIndex{1}$$

Compute $$f''(0+)$$ and $$f''(0-)$$.

Let us compute the Fourier series coefficients. The actual computation involves several integration by parts and is left to student.

\begin{align}\begin{aligned} a_0 &= \int_{-1}^1 f(t)dt= \int_{-1}^0 (t+1)tdt+ \int_{0}^1 (1-t)tdt=0, \\ a_n &= \int_{-1}^1 f(t) \cos(n \pi t)dt= \int_{-1}^0 (t+1)t \cos(n \pi t)dt+ \int_{0}^1 (1-t)t \cos(n \pi t)dt=0 \\ b_n &= \int_{-1}^1 f(t) \sin(n \pi t)dt= \int_{-1}^0 (t+1)t \sin(n \pi t)dt+ \int_{0}^1 (1-t)t \sin(n \pi t)dt \\ &= \dfrac{4(1-(-1)^n)}{\pi^3 n^3}= \left\{ \begin{array}{cc} \dfrac{8}{\pi^3 n^3} & {\rm{~if~}} {\it{n}} {\rm{~is~odd,}}\\ 0 & {\rm{~if~}} {\it{n}} {\rm{~is~even.}} \end{array} \right.\end{aligned}\end{align}

That is, the series is

$\sum_{\underset{n~ \rm{odd}}{n=1}}^{\infty} \dfrac{8}{\pi^3 n^3} \sin(n \pi t).$

This series converges very fast. If you plot up to the third harmonic, that is the function

$\dfrac{8}{\pi^3} \sin(\pi t)+ \dfrac{8}{27 \pi^3} \sin(3 \pi t),$

it is almost indistinguishable from the plot of $$f(t)$$ in Figure $$\PageIndex{3}$$. In fact, the coefficient $$\dfrac{8}{27 \pi^3}$$ is already just 0.0096 (approximately). The reason for this behavior is the $$n^3$$ term in the denominator. The coefficients $$b_n$$ in this case go to zero as fast as $$\dfrac{1}{n^3}$$ goes to zero.

For functions constructed piecewise from polynomials as above, it is generally true that if you have one derivative, the Fourier coefficients will go to zero approximately like $$\dfrac{1}{n^3}$$. If you have only a continuous function, then the Fourier coefficients will go to zero as $$\dfrac{1}{n^2}$$. If you have discontinuities, then the Fourier coefficients will go to zero approximately as $$\dfrac{1}{n}$$. For more general functions the story is somewhat more complicated but the same idea holds, the more derivatives you have, the faster the coefficients go to zero. Similar reasoning works in reverse. If the coefficients go to zero like $$\dfrac{1}{n^2}$$ you always obtain a continuous function. If they go to zero like $$\dfrac{1}{n^3}$$ you obtain an everywhere differentiable function.

To justify this behavior, take for example the function defined by the Fourier series

$f(t)= \sum_{n=1}^{\infty} \dfrac{1}{n^3} \sin(nt).$

When we differentiate term by term we notice

$f'(t)= \sum_{n=1}^{\infty} \dfrac{1}{n^2} \cos(nt).$

Therefore, the coefficients now go down like $$\dfrac{1}{n^2}$$, which means that we have a continuous function. The derivative of $$f'(t)$$ is defined at most points, but there are points where $$f'(t)$$ is not differentiable. It has corners, but no jumps. If we differentiate again (where we can) we find that the function $$f''(t)$$, now fails to be continuous (has jumps)

$f''(t)= \sum_{n=1}^{\infty} \dfrac{-1}{n} \sin(nt).$

This function is similar to the sawtooth. If we tried to differentiate the series again we would obtain $\sum_{n=1}^{\infty} - \cos(nt),$﻿ which does not converge!

Exercise $$\PageIndex{2}$$

Use a computer to plot the series we obtained for $$f(t)$$, $$f'(t)$$ and $$f''(t)$$. That is, plot say the first $$5$$ harmonics of the functions. At what points does $$f''(t)$$ have the discontinuities?