Skip to main content
Logo image

Section 4.3 More on the Fourier series

Note: 2 lectures, §9.2–§9.3 in [EP], §10.3 in [BD]

Subsection 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 just rescale the independent axis. Suppose we have a \(2L\)-periodic function \(f(t)\text{.}\) Then \(L\) is called the half period. Let \(s = \frac{\pi}{L} t\text{.}\) Then the function
\begin{equation*} g(s) = f\left(\frac{L}{\pi} s \right) \end{equation*}
is \(2\pi\)-periodic. We must also rescale all our sines and cosines. In the series we use \(\frac{\pi}{L} t\) as the variable. That is, we want to write
\begin{equation*} \mybxbg{~~ f(t) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos \left( \frac{n \pi}{L} t \right) + b_n \sin \left(\frac{n \pi}{L} t \right) . ~~} \end{equation*}
If we change variables to \(s\text{,}\) we see that
\begin{equation*} g(s) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n \cos (n s) + b_n \sin (n s) . \end{equation*}
We compute \(a_n\) and \(b_n\) as before. After we write down the integrals, we change variables from \(s\) back to \(t\text{,}\) noting also that \(ds = \frac{\pi}{L} \, dt\text{.}\)
\begin{equation*} \mybxbg{~~ \begin{aligned} & a_0 = \frac{1}{\pi} \int_{-\pi}^\pi g(s) \, ds = \frac{1}{L} \int_{-L}^L f(t) \, dt , \\ & a_n = \frac{1}{\pi} \int_{-\pi}^\pi g(s) \, \cos (n s) \, ds = \frac{1}{L} \int_{-L}^L f(t) \, \cos \left( \frac{n \pi}{L} t \right) \, dt , \\ & b_n = \frac{1}{\pi} \int_{-\pi}^\pi g(s) \, \sin (n s) \, ds = \frac{1}{L} \int_{-L}^L f(t) \, \sin \left( \frac{n \pi}{L} t \right) \, dt . \end{aligned} ~~} \end{equation*}
The two most common half periods that show up in examples are \(\pi\) and 1 because of the simplicity of the formulas. 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. You can think of it as just using different units for time. All that we are doing is moving some constants around, but all the mathematics is the same.

Example 4.3.1.

Let
\begin{equation*} f(t) = \lvert t \rvert \qquad \text{for } \; {-1} < t \leq 1, \end{equation*}
extended periodically. The plot of the periodic extension is given in Figure 4.9. Compute the Fourier series of \(f(t)\text{.}\)

Figure 4.9. Periodic extension of the function \(f(t)\text{.}\)

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)\text{.}\) For \(n \geq 1\) we note that \(\lvert t \rvert \cos (n \pi t)\) is even and hence
\begin{equation*} \begin{split} a_n & = \int_{-1}^1 f(t) \cos (n \pi t) \, dt \\ & = 2 \int_{0}^1 t \cos (n \pi t) \, dt \\ & = 2 \left[ \frac{t}{n \pi} \sin (n \pi t) \right]_{t=0}^1 - 2 \int_{0}^1 \frac{1}{n \pi} \sin (n \pi t) \, dt \\ & = 0 + \frac{1}{n^2 \pi^2} \Bigl[ \cos (n \pi t) \Bigr]_{t=0}^1 = \frac{2 \bigl( {(-1)}^n -1 \bigr) }{n^2 \pi^2} = \begin{cases} 0 & \text{if } n \text{ is even} , \\ \frac{-4 }{n^2 \pi^2} & \text{if } n \text{ is odd} . \end{cases} \end{split} \end{equation*}
Next we find \(a_0\text{:}\)
\begin{equation*} a_0 = \int_{-1}^1 \lvert t \rvert \, dt = 1 . \end{equation*}
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\text{.}\) Here, we notice that \(\lvert t \rvert \sin (n \pi t)\) is odd and, therefore,
\begin{equation*} b_n = \int_{-1}^1 f(t) \sin (n \pi t) \, dt = 0 . \end{equation*}
Hence, the series is
\begin{equation*} \frac{1}{2} + \sum_{\substack{n=1 \\ n \text{ odd}}}^\infty \frac{-4}{n^2 \pi^2} \cos (n \pi t) . \end{equation*}
Let us explicitly write down the first few terms of the series up to the \(3^{\text{rd}}\) harmonic.
\begin{equation*} \frac{1}{2} - \frac{4}{\pi^2} \cos (\pi t) - \frac{4}{9 \pi^2} \cos (3 \pi t) - \cdots \end{equation*}
The plot of these few terms and also a plot up to the \({20}^{\text{th}}\) harmonic is given in Figure 4.10. 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 4.10. Fourier series of \(f(t)\) up to the \(3^{\text{rd}}\) harmonic (left graph) and up to the \({20}^{\text{th}}\) harmonic (right graph).

Subsection 4.3.2 Convergence

We will need the one sided limits of functions. We will use the following notation
\begin{equation*} f(c-) = \lim_{t \uparrow c} f(t), \qquad \text{and} \qquad f(c+) = \lim_{t \downarrow c} f(t). \end{equation*}
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
\begin{equation} f(t) = \begin{cases} 0 & \text{if } \; {-\pi} < t \leq 0 , \\ \pi & \text{if } \; \phantom{-}0 < t \leq \pi , \end{cases}\tag{4.8} \end{equation}
we have \(f(0-) = 0\) and \(f(0+) = \pi\text{.}\)
Let \(f(t)\) be a function defined on an interval \([a,b]\text{.}\) Suppose that we find finitely many points \(a=t_0\text{,}\) \(t_1\text{,}\) \(t_2\text{,}\) ..., \(t_k=b\) in the interval, such that \(f(t)\) is continuous on the intervals \((t_0,t_1)\text{,}\) \((t_1,t_2)\text{,}\) ..., \((t_{k-1},t_k)\text{.}\) Also suppose that all the one sided limits exist, that is, all of \(f(t_0+)\text{,}\) \(f(t_1-)\text{,}\) \(f(t_1+)\text{,}\) \(f(t_2-)\text{,}\) \(f(t_2+)\text{,}\) ..., \(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 4.3.2.

The square wave function (4.8) is piecewise smooth on \([-\pi,\pi]\) or any other interval. In such a case we simply say that the function is piecewise smooth.

Example 4.3.3.

The function \(f(t) = \lvert t \lvert\) is piecewise smooth.

Example 4.3.4.

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

Example 4.3.5.

The function \(f(t) = \sqrt[3]{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.
If we happen to have that \(f(t) = \frac{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.
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.

Subsection 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.
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.
Note that the series for \(F(t)\) is no longer a Fourier series as it contains the \(\frac{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.

Subsection 4.3.4 Rates of convergence and smoothness

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

Example 4.3.6.

Take the function
\begin{equation*} f(t) = \begin{cases} (t+1)\,t & \text{if } \; {-1} < t \leq 0 , \\ (1-t)\,t & \text{if } \; \phantom{-}0 < t \leq 1 , \end{cases} \end{equation*}
and extend to a 2-periodic function. The plot is given in Figure 4.11.

Figure 4.11. Smooth 2-periodic function.

This function has one derivative everywhere, but it does not have a second derivative whenever \(t\) is an integer.
Let us compute the Fourier series coefficients. The actual computation involves several integration by parts and is left to student.
\begin{equation*} \begin{aligned} a_0 & = \int_{-1}^1 f(t) \, dt = \int_{-1}^0 (t+1)\,t \, dt + \int_0^1 (1-t)\,t \, dt = 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 \\ & = \frac{4 ( 1-{(-1)}^n)}{\pi^3 n^3} = \begin{cases} \frac{8}{\pi^3 n^3} & \text{if } n \text{ is odd} , \\ 0 & \text{if } n \text{ is even} . \end{cases} \end{aligned} \end{equation*}
That is, the series is
\begin{equation*} \sum_{\substack{n=1 \\ n \text{ odd}}}^\infty \frac{8}{\pi^3 n^3} \sin (n \pi t) . \end{equation*}
This series converges very fast. If you plot up to the third harmonic, that is the function
\begin{equation*} \frac{8}{\pi^3} \sin (\pi t) + \frac{8}{27 \pi^3} \sin (3 \pi t) , \end{equation*}
it is almost indistinguishable from the plot of \(f(t)\) in Figure 4.11. In fact, the coefficient \(\frac{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 \(\nicefrac{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 \(\nicefrac{1}{n^3}\text{.}\) If you have only a continuous function, then the Fourier coefficients will go to zero as \(\nicefrac{1}{n^2}\text{.}\) If you have discontinuities, then the Fourier coefficients will go to zero approximately as \(\nicefrac{1}{n}\text{.}\) 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 \(\nicefrac{1}{n^2}\text{,}\) you always obtain a continuous function. If they go to zero like \(\nicefrac{1}{n^3}\text{,}\) you obtain an everywhere differentiable function.
To justify this behavior, take for example the function defined by the Fourier series
\begin{equation*} f(t) = \sum_{n=1}^\infty \frac{1}{n^3} \sin (n t) . \end{equation*}
When we differentiate term by term we notice
\begin{equation*} f'(t) = \sum_{n=1}^\infty \frac{1}{n^2} \cos (n t) . \end{equation*}
Therefore, the coefficients now go down like \(\nicefrac{1}{n^2}\text{,}\) 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)\text{,}\) now fails to be continuous (has jumps)
\begin{equation*} f''(t) = \sum_{n=1}^\infty \frac{-1}{n} \sin (n t) . \end{equation*}
This function is similar to the sawtooth. If we tried to differentiate the series again, we would obtain
\begin{equation*} \sum_{n=1}^\infty -\cos (n t) , \end{equation*}
which does not converge!

Exercise 4.3.2.

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

Subsection 4.3.5 Exercises

Exercise 4.3.3.

Let
\begin{equation*} f(t) = \begin{cases} 0 & \text{if } \; {-1} < t \leq 0 , \\ t & \text{if } \; \phantom{-}0 < t \leq 1 , \end{cases} \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.

Exercise 4.3.4.

Let
\begin{equation*} f(t) = \begin{cases} -t & \text{if } \; {-1} < t \leq 0 , \\ t^2 & \text{if } \; \phantom{-}0 < t \leq 1 , \end{cases} \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.

Exercise 4.3.5.

Let
\begin{equation*} f(t) = \begin{cases} \frac{-t}{10} & \text{if } \; {-10} < t \leq 0 , \\ \frac{t}{10} & \text{if } \; \phantom{-1}0 < t \leq 10 , \end{cases} \end{equation*}
extended periodically (period is 20).
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.

Exercise 4.3.6.

Let \(f(t) = \sum_{n=1}^\infty \frac{1}{n^3} \cos (n t)\text{.}\) Is \(f(t)\) continuous and differentiable everywhere? Find the derivative (if it exists everywhere) or justify why \(f(t)\) is not differentiable everywhere.

Exercise 4.3.7.

Let \(f(t) = \sum_{n=1}^\infty \frac{{(-1)}^n}{n} \sin (n t)\text{.}\) Is \(f(t)\) differentiable everywhere? Find the derivative (if it exists everywhere) or justify why \(f(t)\) is not differentiable everywhere.

Exercise 4.3.8.

Let
\begin{equation*} f(t) = \begin{cases} 0 & \text{if } \; {-2} < t \leq 0, \\ t & \text{if } \; \phantom{-}0 < t \leq 1, \\ -t+2 & \text{if } \; \phantom{-}1 < t \leq 2, \end{cases} \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.

Exercise 4.3.9.

Let
\begin{equation*} f(t) = e^t \qquad \text{for } \; {-1} < t \leq 1 \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.
  3. What does the series converge to at \(t=1\text{.}\)

Exercise 4.3.10.

Let
\begin{equation*} f(t) = t^2 \qquad \text{for } \; {-1} < t \leq 1 \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. By plugging in \(t=0\text{,}\) evaluate \(\displaystyle \sum_{n=1}^\infty \frac{{(-1)}^n}{n^2} = 1 - \frac{1}{4} + \frac{1}{9} - \cdots\text{.}\)
  3. Now evaluate \(\displaystyle \sum_{n=1}^\infty \frac{1}{n^2} = 1 + \frac{1}{4} + \frac{1}{9} + \cdots\text{.}\)

Exercise 4.3.11.

Let
\begin{equation*} f(t) = \begin{cases} 0 & \text{if } \; {-3} < t \leq 0, \\ t & \text{if } \; \phantom{-}0 < t \leq 3, \end{cases} \end{equation*}
extended periodically. Suppose \(F(t)\) is the function given by the Fourier series of \(f\text{.}\) Without computing the Fourier series evaluate
  1. \(\displaystyle F(2)\)
  2. \(\displaystyle F(-2)\)
  3. \(\displaystyle F(4)\)
  4. \(\displaystyle F(-4)\)
  5. \(\displaystyle F(3)\)
  6. \(\displaystyle F(-9)\)

Exercise 4.3.101.

Let
\begin{equation*} f(t) = t^2 \qquad \text{for } \; {-2} < t \leq 2 \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.
Answer.
a) \(\frac{8}{6} + \sum\limits_{n=1}^\infty \frac{16{(-1)}^n}{\pi^2 n^2} \cos\bigl(\frac{n\pi}{2} t\bigr)\)     b) \(\frac{8}{6} - \frac{16}{\pi^2 } \cos\bigl(\frac{\pi}{2} t\bigr) + \frac{4}{\pi^2} \cos\bigl(\pi t\bigr) - \frac{16}{9\pi^2} \cos\bigl(\frac{3\pi}{2} t\bigr) + \cdots\)

Exercise 4.3.102.

Let
\begin{equation*} f(t) = t \qquad \text{for } \; {-\lambda} < t \leq \lambda \; \text{ (for some } \lambda > 0 \text{)} \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Write out the series explicitly up to the \(3^{\text{rd}}\) harmonic.
Answer.
a) \(\sum\limits_{n=1}^\infty \frac{{(-1)}^{n+1}2\lambda}{n \pi} \sin\bigl(\frac{n\pi}{\lambda} t\bigr)\)     b) \(\frac{2\lambda}{\pi} \sin\bigl(\frac{\pi}{\lambda} t\bigr) - \frac{\lambda}{\pi} \sin\bigl(\frac{2\pi}{\lambda} t\bigr) + \frac{2\lambda}{3\pi} \sin\bigl(\frac{3\pi}{\lambda} t\bigr) - \cdots\)

Exercise 4.3.103.

Let
\begin{equation*} f(t) = \frac{1}{2} + \sum_{n=1}^\infty \frac{1}{n(n^2+1)} \sin(n\pi t) . \end{equation*}
Compute \(f'(t)\text{.}\)
Answer.
\(f'(t) = \sum\limits_{n=1}^\infty \frac{\pi}{n^2+1} \cos(n\pi t)\)

Exercise 4.3.104.

Let
\begin{equation*} f(t) = \frac{1}{2} + \sum_{n=1}^\infty \frac{1}{n^3} \cos(n t) . \end{equation*}
  1. Find the antiderivative.
  2. Is the antiderivative periodic?
Answer.
a) \(F(t) = \frac{t}{2} + C + \sum\limits_{n=1}^\infty \frac{1}{n^4} \sin(nt)\)        b) no

Exercise 4.3.105.

Let
\begin{equation*} f(t) = \nicefrac{t}{2} \qquad \text{for } \; {-\pi} < t < \pi \end{equation*}
extended periodically.
  1. Compute the Fourier series for \(f(t)\text{.}\)
  2. Plug in \(t=\nicefrac{\pi}{2}\) to find a series representation for \(\nicefrac{\pi}{4}\text{.}\)
  3. Using the first 4 terms of the result from part b) approximate \(\nicefrac{\pi}{4}\text{.}\)
Answer.
a) \(\sum\limits_{n=1}^\infty \frac{{(-1)}^{n+1}}{n} \sin(nt)\)        b) \(f\) is continuous at \(t=\nicefrac{\pi}{2}\) so the Fourier series converges to \(f(\nicefrac{\pi}{2}) = \nicefrac{\pi}{4}\text{.}\) Obtain \(\nicefrac{\pi}{4} = \sum\limits_{n=1}^\infty \frac{{(-1)}^{n+1}}{2n-1} = 1 - \nicefrac{1}{3} + \nicefrac{1}{5}- \nicefrac{1}{7} + \cdots\text{.}\)        c) Using the first 4 terms get \(\nicefrac{76}{105}\approx 0.72\) (quite a bad approximation, you would have to take about 50 terms to start to get to within \(0.01\) of \(\nicefrac{\pi}{4}\)).

Exercise 4.3.106.

Let
\begin{equation*} f(t) = \begin{cases} 0 & \text{if } \; {-2} < t \leq 0, \\ 2 & \text{if } \; \phantom{-}0 < t \leq 2, \end{cases} \end{equation*}
extended periodically. Suppose \(F(t)\) is the function given by the Fourier series of \(f\text{.}\) Without computing the Fourier series evaluate
  1. \(\displaystyle F(0)\)
  2. \(\displaystyle F(-1)\)
  3. \(\displaystyle F(1)\)
  4. \(\displaystyle F(-2)\)
  5. \(\displaystyle F(4)\)
  6. \(\displaystyle F(-8)\)
Answer.
a) \(F(0) = 1\text{,}\) b) \(F(-1) = 0\text{,}\) c) \(F(1) = 2\text{,}\) d) \(F(-2) = 1\text{,}\) e) \(F(4) = 1\text{,}\) f) \(F(-9) = 0\)
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf