Diff. EquationsFourier Series and PDEs

Fourier Sine and Cosine Series and Convergence

Extend a function oddly or evenly; the series meets jumps halfway.

Not started Jump to practice

In heat and wave problems the function lives on $(0, L)$ only, the length of a rod. We are free to extend it to $(-L, 0)$ any way we like before building a Fourier series. Extending it as an odd function gives a series of sines only; extending it as an even function gives cosines only. Which one to use depends on the boundary conditions.

Key idea

For $f$ on $(0, L)$, the sine series and its coefficients are $$f \sim \sum_{n=1}^{\infty} b_n\sin\frac{n\pi x}{L},$$ $$b_n = \frac{2}{L}\int_0^{L} f(x)\sin\frac{n\pi x}{L}\,dx.$$ The cosine series and its coefficients are $$f \sim \frac{a_0}{2} + \sum_{n=1}^{\infty} a_n\cos\frac{n\pi x}{L},$$ $$a_n = \frac{2}{L}\int_0^{L} f(x)\cos\frac{n\pi x}{L}\,dx.$$ Convergence: if $f$ is piecewise smooth, the series converges to the extended function where it is continuous and to the average of the one-sided limits at each jump.

Why it works

Let $f_o$ be the odd extension: $f_o(x) = -f(-x)$ for $-L < x < 0$. Then $f_o\cos\frac{n\pi x}{L}$ is odd, so every $a_n = 0$, and $f_o\sin\frac{n\pi x}{L}$ is even, so $b_n = \frac{1}{L}\int_{-L}^{L} = \frac{2}{L}\int_0^{L}$. The even extension works the same way with the roles swapped. The extension matters for convergence: the odd extension of $f$ is continuous at 0 and $L$ only if $f$ is 0 there, so a sine series always converges to 0 at the ends. A cosine series has no such jumps when $f$ is continuous, which is why its coefficients usually shrink faster.

Worked example: A sine series

Find the sine series of $f(x) = 1$ on $(0, \pi)$.
  1. $b_n = \frac{2}{\pi}\int_0^{\pi} \sin nx\,dx$ $= \frac{2}{n\pi}\left(1 - (-1)^{n}\right)$.

Answer: $1 \sim \frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \dots\right)$ on $(0, \pi)$, the square wave again

Worked example: A cosine series

Find the cosine series of $f(x) = x$ on $(0, 2)$.
  1. $L = 2$: $a_0 = \frac{2}{2}\int_0^{2} x\,dx = 2$, so $\frac{a_0}{2} = 1$.
  2. By parts: $a_n = \int_0^{2} x\cos\frac{n\pi x}{2}\,dx$ $= \left[\frac{2x}{n\pi}\sin\frac{n\pi x}{2}\right]_0^{2}$ $- \frac{2}{n\pi}\int_0^{2}\sin\frac{n\pi x}{2}\,dx$ $= \frac{4}{n^{2}\pi^{2}}\left((-1)^{n} - 1\right)$.

Answer: $x \sim 1$ $- \frac{8}{\pi^{2}}\left(\cos\frac{\pi x}{2} + \frac{1}{9}\cos\frac{3\pi x}{2} + \dots\right)$, with coefficients shrinking like $\frac{1}{n^{2}}$

Worked example: Where does it converge?

The sine series of $f(x) = x$ on $(0, \pi)$: what does it converge to at $x = \frac{\pi}{2}$, at $x = \pi$, and at $x = 3\pi$?
  1. At $\frac{\pi}{2}$, $f$ is continuous: the sum is $\frac{\pi}{2}$.
  2. At $\pi$, the odd periodic extension jumps from $\pi$ down to $-\pi$: the average is 0.
  3. $3\pi$ is a period ($2\pi$) away from $\pi$.

Answer: $\frac{\pi}{2}$, $0$, and $0$

Common mistake

Using $\frac{1}{L}$ for a half-range series. The sine and cosine series on $(0, L)$ use $\frac{2}{L}$ and integrate over $(0, L)$ only, because they come from integrating an even integrand over $(-L, L)$.
The sine series of $f(x) = x$ on $(0, \pi)$ comes from the odd extension, a sawtooth with jumps at $\pm\pi$. The partial sums are pinned to 0 at the ends, and the coefficients shrink only like $\frac{1}{n}$.
The cosine series of the same function comes from the even extension, a triangle wave with no jumps. Three terms already look good: the coefficients shrink like $\frac{1}{n^{2}}$.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Paul's Online Math Notes, Differential Equations: Fourier Sine Series
  • Paul's Online Math Notes, Differential Equations: Fourier Cosine Series
  • Paul's Online Math Notes, Differential Equations: Convergence of Fourier Series
@teddyrookbook GitHub