myLearning

Topic 6 of 6

Step 20: Differential equations

Fourier series and the heat equation

Step 20 · Differential equations topics

Build periodic functions out of sines and cosines, compute Fourier coefficients, and use them to solve the heat equation for a rod.

Fourier series

A function with period 2L can be written as a sum of sines and cosines that fit evenly into that period. Each coefficient measures how much of that wave the function contains.

f(x)=a02+∑n=1∞(ancos⁡nπxL+bnsin⁡nπxL)f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n\cos\frac{n\pi x}{L} + b_n\sin\frac{n\pi x}{L}\right)
an=1L∫−LLf(x)cos⁡nπxL dxbn=1L∫−LLf(x)sin⁡nπxL dxa_n = \frac{1}{L}\int_{-L}^{L} f(x)\cos\frac{n\pi x}{L}\,dx \qquad b_n = \frac{1}{L}\int_{-L}^{L} f(x)\sin\frac{n\pi x}{L}\,dx

Example: A square wave

Find the Fourier series of the square wave that is −1 for −π < x < 0 and 1 for 0 < x < π.

  1. It is odd, so every ana_n is 0.
  2. bn=2π∫0πsin⁡nx dxb_n = \frac{2}{\pi}\int_{0}^{\pi} \sin nx\,dx, which is 4nπ\frac{4}{n\pi} for odd n and 0 for even n.

Answer4π(sin⁡x+sin⁡3x3+sin⁡5x5+⋯ )\frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \frac{\sin 5x}{5} + \cdots\right)

The square wave (dashed) and the sum of its first three sine terms. Adding more terms hugs the corners more closely.

Sine and cosine series

On 0 < x < L, a function can be extended to be odd, giving a series of sines only, or even, giving cosines only. Sine series suit problems where the ends are held at 0.

Example: A sine series

Find the sine series of f(x) = 1 on 0 < x < π.

  1. bn=2π∫0πsin⁡nx dxb_n = \frac{2}{\pi}\int_{0}^{\pi} \sin nx\,dx.
  2. These are the square wave's coefficients again.

Answer4π(sin⁡x+sin⁡3x3+⋯ )\frac{4}{\pi}\left(\sin x + \frac{\sin 3x}{3} + \cdots\right)

The heat equation

The temperature u(x, t) along a thin rod obeys ut=k uxxu_t = k\,u_{xx}: a spot hotter than its neighbors cools. With the ends held at 0, separation of variables gives a sum of sine waves, each fading exponentially.

u(x,t)=∑n=1∞bne−k(nπ/L)2tsin⁡nπxLu(x, t) = \sum_{n=1}^{\infty} b_n e^{-k(n\pi/L)^{2}t}\sin\frac{n\pi x}{L}

Example: A single wave

A rod of length π with k = 1 starts at u(x, 0) = 3 sin 2x, with both ends held at 0. Find u(x, t).

  1. The starting shape is already one sine wave, with n = 2.
  2. It fades at rate n², which is 4.

Answeru=3e−4tsin⁡2xu = 3e^{-4t}\sin 2x

Example: Which fades first

Starting from sin x + sin 5x, with k = 1 and length π, which part fades faster?

  1. The sin 5x part fades like e−25te^{-25t}, and the sin x part like e−te^{-t}.

AnswerThe sin 5x part: sharp wiggles smooth out first

Try it yourself

Work each one on paper first, then open the answer to check.

  1. Is f(x) = x on −π < x < π odd or even, and which coefficients vanish?

    Show answer

    Odd: every ana_n is 0

  2. Which waves appear in the Fourier series of an even function?

    Show answer

    Cosines only, plus the constant

  3. What does the square wave's Fourier series give at the jump x = 0?

    Show answer

    0, the midpoint of the jump

  4. Find u(x, t) for ut=uxxu_t = u_{xx} on 0 < x < π, with the ends at 0 and u(x, 0) = 5 sin x.

    Show answer

    u=5e−tsin⁡xu = 5e^{-t}\sin x

  5. In the heat equation, how fast does the n = 3 wave fade compared with n = 1?

    Show answer

    9 times as fast

  6. What is b1b_1 for the square wave?

    Show answer

    4π\frac{4}{\pi}

What next?