Fourier Series – An Example

Formulas: Let f(x) be periodic with period 2π. We want to write

f(x) = \frac{A_{0}}{2} + ∑_{1}^{∞} (A_{k} cos kx + B_{k} sin kx) .

The Fourier coefficients are given by the formulas

A_{k} = \frac{1}{π} ∫_{−π}^{π} f(x) cos kx dx B_{k} = \frac{1}{π} ∫_{−π}^{π} f(x) sin kx dx.

Moreover one has the analogue of the “Pythagorean theorem”

∥f∥^{2} = π [\frac{A_{0}^{2}}{2} + ∑_{1}^{∞}(A_{k}^{2} + B_{k}^{2})] .

Example: Consider the function

f(x) = \{ \begin{matrix}−1 & if −π < x ≤ 0 \\ 1 & if 0 < x ≤ π \end{matrix}

To use the above formulas for the Fourier coefficients we split the integrals into two pieces

A_{k} = \frac{1}{π} [∫_{−π}^{0}(−1) cos kx dx + ∫_{0}^{π}(+1) cos kx dx] .

and

B_{k} = \frac{1}{π} [∫_{−π}^{0}(−1) sin kx dx + ∫_{0}^{π}(+1) sin kx dx] .

When one evaluates the A_{k} the two integrals cancel and give A_{k} = 0. Also,

∫_{0}^{π}(+1) sin kx dx = \frac{− cos kπ + 1}{k} = \{ \begin{matrix}0 & if k is even \\ \frac{2}{k} & if k is odd \end{matrix}

By a computation the first integral in B_{k} has the same value as thiis second integral. Thus,

B_{k} = \frac{2}{π} \{ \begin{matrix}0 & if k is even \\ \frac{2}{k} & if k is odd \end{matrix} = \{ \begin{matrix}0 & if k is even \\ \frac{4}{kπ} & if k is odd \end{matrix}

Consequently the desired Fourier series is

f(x) = \frac{4}{π} [sin x + \frac{sin 3x}{3} + \frac{sin 5x}{5} + \frac{sin 7x}{7} + ⋯] .

Note that since our function f is an odd function, we should not be surprised that the right side is also an odd function.

To use the “Pythagorean” theorem above, we observe that

∥f∥^{2} = ∫_{−π}^{π} 1^{2} dx = 2π.

Thus

2π = \frac{16}{π} [1 + \frac{1}{3^{2}} + \frac{1}{5^{2}} + \frac{1}{7^{2}} + ⋯] ,

that is,

\frac{π^{2}}{8} = [1 + \frac{1}{3^{2}} + \frac{1}{5^{2}} + \frac{1}{7^{2}} + ⋯] .

This evaluation of the sum of the infinite series on the right is a bonus from our computation of the Fourier series of this function f.