logo

Derivation of Fourier Series 📂Fourier Analysis

Derivation of Fourier Series

Definition

The series for $2L$-periodic function $f$ is defined as the Fourier series of $f$ as follows:

$$ \begin{align*} \lim \limits_{N \rightarrow \infty} S^{f}_{N}(t) &= \lim \limits_{N \to \infty}\left[ \dfrac{a_{0}}{2}+\sum \limits_{n=1}^{N} \left( a_{n} \cos \dfrac{n\pi t}{L} + b_{n}\sin\dfrac{n\pi t}{L} \right) \right] \\ &= \dfrac{a_{0}}{2}+\sum \limits_{n=1}^{\infty} \left( a_{n} \cos \dfrac{n\pi t}{L} + b_{n}\sin\dfrac{n\pi t}{L} \right) \end{align*} $$

Here, each coefficient $a_{0}, a_{n}, b_{n}$ is called the Fourier coefficient, and its value is as follows:

$$ \begin{align*} \\ a_{0} &=\dfrac{1}{L}\int_{-L}^{L}f(t)dt \\ a_{n} &= \dfrac{1}{L}\int_{-L}^{L} f(t)\cos\dfrac{n\pi t}{L} dt \\ b_{n} &=\dfrac{1}{L}\int_{-L}^{L}f(t)\sin \dfrac{n\pi t}{L}dt \end{align*} $$

Description

The Fourier series represents any function as a series expansion of trigonometric functions, famously developed by the French mathematician Joseph Fourier for solving heat equations. The term “any function” is used because if there is a function defined on a certain interval $(a,b)$, it can be replicated (Ctrl+C, Ctrl+V) to produce a $(b-a)$-periodic function.

The core principle is to express it as a linear combination of orthogonal trigonometric functions, analogous to decomposing $(4,-1,7)$ as follows in three-dimensional vectors:

$$ (4,-1,7) = a_{1}\hat{\mathbf{e}}_{1} + a_{2}\hat{\mathbf{e}}_{1} + a_{3}\hat{\mathbf{e}}_{1} $$

Indeed, the Fourier series of $f$ not only has minimal error with $f$ but also converges pointwise under well-defined conditions to $f$.

$$ f(t) = \dfrac{a_{0}}{2}+\sum \limits_{n=1}^{\infty} \left( a_{n} \cos \dfrac{n\pi t}{L}t + b_{n}\sin\dfrac{n\pi t}{L} \right) $$

Derivation

Regression Analysis1

  • Part 1

    The goal is to express the function $f(t)$ as a linear combination of $1, \cos \dfrac{\pi t}{L}, \cos\dfrac{2\pi t}{L}, \cdots, \sin \dfrac{\pi t}{L}, \sin \dfrac{2\pi t}{L}, \cdots $s. Thus, assuming $S^{f}_{N}(t)=\dfrac{1}{2}{\alpha_{0}}+\sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac{n\pi t}{L} \right)$, $f(t)$ can be represented as follows:

    $$ f(t)=S^{f}_{N}(t)+e_{N}(t) $$

    $e_{N}(t)$ is the difference between $f(t)$ and the approximation $S_{N}^{f} (t)$. The smallest difference $S_{N}^{f}(t)$ leads to the closest series expansion to $f(t)$. Let’s define $e_{N}$ as the mean square error2.

    $$ e_{N}=\dfrac{1}{2L}\int_{-L}^{L} [e_{N}(t) ]^{2}dt=\dfrac{1}{2L}\int_{-L}^{L} \left[ f(t)-S^{f}_{N} (t) \right]^{2} dt $$

  • Part 2

    $$ \begin{align*} e_{N} &= \dfrac{1}{2L}\int_{-L}^{L} \left[ f(t)-S^{f}_{N}(t) \right]^{2} dt \\ &= \dfrac{1}{2L}\int_{-L}^{L} \left[ f(t)-\dfrac{1}{2}{\alpha_{0}}-\sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]^{2} dt \end{align*} $$

    Let the coefficients that minimize the mean square error $e_{N}$ be $\alpha_{0},\ \alpha_{n},\ \beta_{n}$, $a_{0}$, $a_{n}$, respectively. The conditions that minimize $e_{N}$ are called the normal equations.

    $$ \dfrac{\partial e_{N}}{\partial \alpha_{0}}=0,\ \ \dfrac{\partial e_{N}}{\partial \alpha_{n}}=0,\ \ \dfrac{\partial e_{N}}{\partial \beta_{n}}=0\quad (m=1,\ 2,\ \cdots,\ N) $$

    Then, $a_{0}$, $a_{n}$, $b_{n}$ can be calculated as follows:

    • Part 2.1 $a_{0}$

      $$ \begin{align*} \dfrac{\partial e_{N}}{\partial \alpha_{0}} &= \dfrac{1}{2L}\int_{-L}^{L} \dfrac{\partial}{\partial \alpha_{0}} \left[ f(t)-\dfrac{1}{2} {\alpha_{0}}-\sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]^{2} dt \\ &= 2\cdot \dfrac{-1}{2} \cdot \dfrac{1}{2L} \int_{-L}^{L} \left[ f(t)-\dfrac{1}{2}{\alpha_{0}}-\sum \limits_{n=1}^{N} \left( \alpha_ {N} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac {n\pi t}{L} \right) \right] dt \\ &= \dfrac{-1}{2L}\int_{-L}^{L}f(t) dt + \dfrac{1}{2L}\int_{-L}^{L}\dfrac{1}{2}\alpha_{0} dt +\dfrac{1}{2L}\int_{-L}^{L} \sum \limits_ {n=1}^{N}\left( \alpha_{n}\cos \dfrac{n\pi t}{L}+\beta_{n} \sin \dfrac{n \pi t}{L} \right) dt \\ &= \dfrac{-1}{2L}\int_{-L}^{L}f(t) dt + \dfrac{1}{2L}\int_{-L}^{L}\dfrac{1}{2}\alpha_{0} dt \\ &= \dfrac{-1}{2L}\int_{-L}^{L}f(t) dt +\dfrac{1}{2}\alpha_{0} \\ &= 0 \end{align*} $$

      The fourth equality holds because the integral of a trigonometric function over one period is $0$.

      $$ a_{0} = \dfrac{1}{L} \int_{-L}^{L}f(t)dt $$

    • Part 2.2 $a_{n}$

      Choose any $m \in \left\{ 1,2,\dots,N \right\}$.

      $$ \begin{align*} \dfrac{\partial e_{N}}{\partial \alpha_{m}} &= \dfrac{1}{2L}\int_{-L}^{L} \dfrac{\partial}{\partial \alpha_{m}} \left[ f(t)-\dfrac{1}{2} {\alpha_{0}}-\sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]^{2} dt \\ &= 2\cdot \dfrac{1}{2L} \int_{-L}^{L} \left( - \cos \dfrac{m\pi t}{L} \right)\left[ f(t)-\dfrac{1}{2}{\alpha_{0}}-\sum \limits_{n=1}^ {N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L} +\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]dt \\ &= -\dfrac{1}{L} \int_{-L}^{L} f(t)\cos\dfrac{m\pi t}{L} dt +\dfrac{1}{L}\int_{-L}^{L} \dfrac{1}{2}\alpha_{0}\cos\dfrac{m\pi t}{L} dt \\ &\quad + \dfrac{1}{L} \int_{-L}^{L} \sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n\pi t}{L} + \beta_{n}\sin\dfrac{n\pi t}{L} \right) \cos\dfrac{m\pi t}{L}dt \\ &= -\dfrac{1}{L}\int_{-L}^{L} f(t)\cos\dfrac{m\pi t}{L} dt + \dfrac{1}{L}\alpha_{m} \int_{-L}^{L}\cos\dfrac{m\pi t}{L}\cos\dfrac{m\pi t} {L} dt\\ &= -\dfrac{1}{L}\int_{-L}^{L} f(t)\cos\dfrac{m\pi t}{L} dt + \alpha_{m} \\ &= 0 \end{align*} $$

      The fourth and fifth equalities hold due to the orthogonality of trigonometric functions.

      $$ a_{n}= \dfrac{1}{L}\int_{-L}^{L} f(t)\cos\dfrac{n\pi t}{L} dt \quad (n=1, 2, \cdots, N) $$

    • Part 2.3 $b_{n}$

      Choose any $m \in \left\{ 1,2,\dots,N \right\}$.

      $$ \begin{align*} \dfrac{\partial e_{N}}{\partial \beta_{m}} &= \dfrac{1}{2L}\int_{-L}^{L} \dfrac{\partial}{\partial \beta_{m}} \left[ f(t)-\dfrac{1}{2} {\alpha_{0}}-\sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L}+\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]^{2} dt \\ &= 2\cdot \dfrac{1}{2L} \int_{-L}^{L} \left( - \sin \dfrac{m\pi t}{L} \right)\left[ f(t)-\dfrac{1}{2}{\alpha_{0}}-\sum \limits_{n=1}^ {N} \left( \alpha_{n} \cos \dfrac{n \pi t}{L} +\beta_{n}\sin\dfrac{n\pi t}{L} \right) \right]dt \\ &= -\dfrac{1}{L} \int_{-L}^{L} f(t)\sin\dfrac{m\pi t}{L} dt +\dfrac{1}{L}\int_{-L}^{L} \dfrac{1}{2}\alpha_{0}\sin\dfrac{m\pi t}{L} dt \\ &\quad +\dfrac{1}{L} \int_{-L}^{L} \sum \limits_{n=1}^{N} \left( \alpha_{n} \cos \dfrac{n\pi t}{L} + \beta_{n}\sin\dfrac{n\pi t}{L} \right) \sin\dfrac{m\pi t}{L}dt \\ &= -\dfrac{1}{L}\int_{-L}^{L} f(t)\sin\dfrac{m\pi t}{L} dt + \dfrac{1}{L}\beta_{m} \int_{-L}^{L}\sin\dfrac{m\pi t}{L}\sin\dfrac{m\pi t} {L} dt \\ &= -\dfrac{1}{L}\int_{-L}^{L} f(t)\sin\dfrac{m\pi t}{L} dt + \beta_{m} \\ &=0 \end{align*} $$

      The fourth and fifth equalities hold due to the orthogonality of trigonometric functions.

      $$ b_{n}=\dfrac{1}{L}\int_{-L}^{L}f(t)\sin\dfrac{n\pi t}{L}dt \quad (n=1, 2, \cdots, N) $$

  • Part 3 Using the obtained $a_{0}$, $a_{n}$, $b_{n}$ to express $f(t)$ results in the same.

    $$ \begin{align*} f(t) &= S^{f}_{N}(t)+e_{N}(t) \\[1em] \text{where } S^{f}_{N}(t) &= \dfrac{a_{0}}{2}+\sum \limits_{n=1}^{N} \left( a_{n} \cos \dfrac{n\pi t}{L} + b_{n}\sin\dfrac{n\pi t} {L} \right) \\ a_{0} &= \dfrac{1}{L}\int_{-L}^{L}f(t)dt \\ a_{n} &= \dfrac{1}{L}\int_{-L}^{L} f(t)\cos\dfrac{n\pi t}{L} dt \\ b_{n} &= \dfrac{1}{L}\int_{-L}^{L}f(t)\sin\dfrac{n\pi t}{L}dt \end{align*} $$

    Taking the limit for $N$ yields

    $$ \lim \limits_{N \rightarrow \infty} S_{N}^{f} (t)=\dfrac{a_{0}}{2}+\sum \limits_{n=1}^{\infty} \left( a_{n} \cos \dfrac{n\pi t}{L} + b_{n} \sin\dfrac{n\pi t}{L} \right) $$

    The above series is called the Fourier series of $f$, and $a_{0}$, $a_{n}$, $b_{n}$ are called the Fourier coefficients of $f$.


  1. Byung Sun Choi, Introduction to Fourier Analysis (2002), pp. 51-53 ↩︎

  2. RSS is the mean square error. ↩︎