Sine and Cosine Series

Theory

Fourier series can be simplified if the function exhibits symmetry.

  • Odd Functions: f(x)=f(x)f(-x) = -f(x).
    The Fourier series of an odd function is a Sine Series, where a0=an=0a_0 = a_n = 0.
  • Even Functions: f(x)=f(x)f(-x) = f(x).
    The Fourier series of an even function is a Cosine Series, where bn=0b_n = 0.

Exercises

Exercise 1
Question

Determine if the following are even or odd:

  1. f(x)=x2f(x) = x^2
  2. f(x)=x3f(x) = x^3
  3. f(x)=exf(x) = e^x
Show solution ↓
Solution
  1. f(x)=(x)2=x2=f(x)f(-x) = (-x)^2 = x^2 = f(x), so f(x)f(x) is even.
  2. f(x)=(x)3=x3=f(x)f(-x) = (-x)^3 = -x^3 = -f(x), so f(x)f(x) is odd.
  3. f(x)=exf(x)f(-x) = e^{-x} \neq f(x) and f(x)\neq -f(x), so f(x)f(x) is neither even nor odd.
Exercise 2
Question

Write the Fourier series of f(x)=xf(x) = |x|, x(π,π)x \in (-\pi, \pi).

Show solution ↓
Solution

The function f(x)=xf(x)=|x| is even.
Therefore, its Fourier series is a cosine series:

f(x)=a02+n=1ancos(nx).f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n\cos(nx).a0=1πππxdx=2π0πxdx=π.a_0=\frac{1}{\pi}\int_{-\pi}^{\pi}|x|dx =\frac{2}{\pi}\int_{0}^{\pi}x\,dx=\pi.an=2π0πxcos(nx)dx=2π(1)n1n2.a_n=\frac{2}{\pi}\int_{0}^{\pi}x\cos(nx)\,dx =\frac{2}{\pi}\frac{(-1)^n-1}{n^2}.

Thus,

|x|=\frac{\pi}{2} -\frac{4}{\pi}\sum_{n=1}^{\infty}\frac{\cos((2n-1)x)}{(2n-1)^2}, \quad -\pi<x<\pi.
Exercise 3
Question

Write the Fourier series of

f(x)={x+1,1lt;xlt;0,x1,0lt;xlt;1.f(x)= \begin{cases} x+1, & -1<x<0,\\ x-1, & 0<x<1. \end{cases}
Show solution ↓
Solution

Check symmetry:

f(x)={x+1,0lt;xlt;1,x1,1lt;xlt;0,=f(x).f(-x)= \begin{cases} -x+1, & 0<x<1,\\ -x-1, & -1<x<0, \end{cases} = -f(x).

Thus, f(x)f(x) is an odd function, and its Fourier series is a sine series.

f(x)=\sum_{n=1}^{\infty}b_n\sin(n\pi x), \quad (-1<x<1).bn=11f(x)sin(nπx)dx=201(x1)sin(nπx)dx.b_n=\int_{-1}^{1}f(x)\sin(n\pi x)\,dx =2\int_{0}^{1}(x-1)\sin(n\pi x)\,dx.

Evaluating,

bn=2(1)nnπ.b_n=\frac{2(-1)^n}{n\pi}.

Hence,

f(x)=n=12(1)nnπsin(nπx).f(x)=\sum_{n=1}^{\infty}\frac{2(-1)^n}{n\pi}\sin(n\pi x).
Exercise 4
Question

Write the Fourier series of f(x)=sin(2x)f(x)=\sin(2x), -\pi<x<\pi.

Show solution ↓
Solution

The function f(x)=sin(2x)f(x)=\sin(2x) is odd.
Therefore, its Fourier series contains only sine terms.

Since sin(2x)\sin(2x) is already a sine function,

b2=1,bn=0 for n2.b_2=1,\quad b_n=0 \text{ for } n\neq2.

Thus, the Fourier series is simply

f(x)=sin(2x).f(x)=\sin(2x).