# Fourier Series

Jean-Baptiste-Joseph Fourier (1768-1830) was concerned with heat flow, while he studied the concvergence of trigonometric series. His article from 1807 was rejected by the scientific community as to imprecise. He finally managed to publish his work in 1822. His idea was to express a periodic function $f(t)$ as a linear combination of sines and cosines and maybe a constant term. We denote the frequency as $n$. \begin{align} f(t)=\frac{a_0}{2} + \sum_{n=1}^{\infty} a_n cos(nt) + b_n sin(nt) \tag{1} \end{align} Later in the 19th century it was proved by Dirichlet and Riemann, that this is indeed possible.

Let first study the trigonometric series \begin{align} f(t)=\sum_{n=1}^{\infty} a_n cos(nt) \end{align} and \begin{align} f(t)=\sum_{n=1}^{\infty} b_n sin(nt) \end{align} We assume that these series converge to $f(t)$ as we add higher and higher frequencies $n$ and move the discussion of this issue to a seperate article, where we actually prove the convergence of series.

How can we calculate the coefficiets of the series?

To answer this question we take a look at the following properties of trigonometric integrals \begin{align} \int_{-\pi}^{\pi} cos(kx) \, cos(lx)dx=\left\{\begin{array}{ll} 2\pi & \text{for } k=l=0 \\ \pi & \text{for } k=l>0 \\ 0 & \text{for } k\neq l=0 \end{array}\right. \tag{2} \end{align} \begin{align} \int_{-\pi}^{\pi} sin(kx) \, sin(lx)dx=\left\{\begin{array}{ll} 0 & \text{for } k=l=0 \\ \pi & \text{for } k=l>0 \\ 0 & \text{for } k\neq l=0 \end{array}\right. \tag{3} \end{align} \begin{align} \int_{-\pi}^{\pi} sin(kx) \, cos(lx)dx= 0 \hspace{0.9cm} \text{ for all } k \text{ und } l \tag{4} \end{align} and use this integral properties to calculate the coefficiets. For the following calculation let us start the index from $n=0$ so that $a_0$ is included in the sum. \begin{align} f(t)= \sum_{n=0}^{\infty} a_n cos(nt) + b_n sin(nt) \end{align} we mulitply this sum by $cos(mt)$ and itegrate over one period. Remember the trigonometric functions cosine and sine are $2 \pi$-periodic. \begin{align} \int_{-\pi}^{\pi} f(t) \cdot cos(mt) \, dt= \int_{-\pi}^{\pi} \sum_{n=0}^{\infty} a_n cos(nt) cos(mt) + b_n \underbrace{sin(nt)cos(mt)}_{=0 \text{ by eq. }4}\, dt= \sum_{n=0}^{\infty}\int_{-\pi}^{\pi} a_n cos(nt) cos(mt)\, dt \tag{5} \end{align} All integrals on the right with $m \not = n$ are zero by (2), only the integral \begin{align} \int_{-\pi}^{\pi} f(t) \cdot cos(mt) \, dt= \int_{-\pi}^{\pi} a_n cos(nt)^2 \, dt \end{align} survives! We only have to integrate one term, which we can do by the half-angle formula \begin{align} a_n \int_{-\pi}^{\pi} cos(nt)^2 \, dt = a_n \int_{-\pi}^{\pi} \frac{1+cos(2nt)}{2} \, dt= a_n \left[ \frac{t}{2}+\frac{sin(2nt)}{4n} \right]_{-\pi}^{\pi}=a_n \left[ \frac{\pi}{2}-\frac{- \pi}{2}+0\right]=a_n \pi \end{align} for $m=0$ we can calculate the coefficient \begin{align} a_0 \int_{-\pi}^{\pi} 1 \, dt = 2 \pi \end{align} in agreement with equation (2). The factor $2$ in front of $\pi$ in the last calculation is the reason, why we have to devide $a_0$ in (1) by two, if we use the general formula for $a_n$ to calculate $a_0$.

Following property (4) all mixed integrals with a product of sine and cosine are zero. This means if we multiply the whole fourier series (1) with cosine, we find exactely equation (5), because all sine cosine products simply vanish. The similar argument holds for mulitplication with sine. In summary, the product of a function with any other function is zero, exept the product with the function itself. Functions with this property are called orthogonal.

We use this curtial concept of othogonality to calculate the general fourier coefficients. We find $a_n$ with property (2)

\begin{align} a_n=\frac{1}{\pi} \int_{-\pi}^{\pi} f(t) \, cos(nt) \, dt \end{align}

with integral property (3) we find \begin{align} f(t)=\sum_{n=1}^{\infty} b_n sin(nt) \tag{6} \end{align} with the fourier coefficients

\begin{align} b_n=\frac{1}{\pi} \int_{-\pi}^{\pi} f(t) \, sin(nt) \, dt \end{align}

What if the phenomena we want to study is not $2\pi$ periodic, but say of period $2L$? This represents no problem, we can make the variable transformation $A: x' \rightarrow B: \frac{\pi x}{L}$, so when $x=L$ we find again $f(\pi)$. This means that a variable in space $A$ has length $L$ but after transformation into $B$ it's again $2 \pi$ periodic. In this way, we can deal with functions of any period $2L$. The fourier series after transformation is \begin{align} f(t)=\sum_{n=1}^{\infty} a_n cos\left(n \frac{\pi \, t}{L} \right) + b_n sin \left(n \frac{\pi \, t}{L} \right) \tag{7} \end{align} with the fourier coefficients \begin{align} a_n=\frac{1}{L} \int_{-L}^{L} f(t) \, cos \left(n\frac{\pi \, t}{L} \right) \, dt \end{align} obtained by integrating form $-L$ to $L$ \begin{align} b_n=\frac{1}{L} \int_{-L}^{L} f(t) \, sin \left(n\frac{\pi \, t}{L} \right) \, dt \end{align} Notice, if $L$ is $\pi$, the $\pi$s in our new fourier series (7) simply cancel out and we are left with our old fourier series (6).

The Fourier Coefficients are also called spectrum of a Fourier Series in analogy to the light spectrum. Loosely speaking the coefficients tell you how much of each Eigenfrequency $n$ is needed to build the function $f(t)$.

## Complex Fourier Series

We can find an alternative expression of the Fourier Series by DeMoivre's Formulas \begin{align} sin(\theta)=\frac{e^{i \theta}-e^{-i\theta}}{2i} \hspace{2cm} cos(\theta)=\frac{e^{i \theta}+e^{-i\theta}}{2} \end{align} If we replace the sine and the cosine term of \begin{align} f(x) = \sum_{n=0}^{\infty} a_n cos(nt) + b_n sin(nt) \end{align} we get for $\theta=n \frac{t \pi}{L}$

\begin{align} f(x) &= \sum_{n=0}^{\infty} a_n \frac{e^{i \theta}+e^{-i\theta}}{2} + b_n \frac{e^{i \theta}-e^{-i\theta}}{2i}\\ f(x) &= \sum_{n=0}^{\infty} a_n \frac{1}{2} \left( e^{i \theta}+e^{-i\theta} \right) -i b_n \frac{1}{2} \left( e^{i \theta}-e^{-i\theta} \right)\\ f(x) &= \sum_{n=0}^{\infty} (a_n-ib_n) \frac{1}{2} e^{i \theta} + (a_n +i b_n) \frac{1}{2} e^{-i\theta}\\ \end{align} If we now change the sum to run from $k=-\infty$ to $\infty$ we can gather the coefficients \begin{align} c_k=\frac{a_n-ib_n}{2}\\ c_{-k}=\frac{a_n+ib_n}{2}\\ \end{align}

we define the Complex Fourier Series with $c_k=c_{-k}^*$ \begin{align} f(t)=\sum_{k=-\infty}^{\infty} c_k e^{i \, k \, \pi \, t /L} \end{align}

We can find the coefficients by multiplying by $e^{-i \, r \, \pi \, t /L}$ \begin{align} \int_{-L}^L f(t) e^{-i \, r \, \pi \, t /L} dt=\sum_{-\infty}^{\infty} \int_{-L}^L c_k e^{i \, k \, \pi \, t /L}e^{-i \, r \, \pi \, t /L} dt=\left\{\begin{array}{ll} c_k \, 2L & \text{for } k=r \\ 0 & \text{for } k \not = r \\ \end{array} \right. \tag{8} \end{align}

so the complex fourier coeffiecients $c_k$ are \begin{align} c_k=\frac{1}{2L} \int_{-L}^L f(t) e^{-i \, r \, \pi \, t /L} dt \end{align}

Example

The $2\pi$ periodic complex fourier series with $f(t)=t$ has the coefficients \begin{align} c_k=\frac{1}{2\pi} \int_{-\pi}^{\pi} t e^{-i \, r \, t} dt= \frac{1}{2\pi}\left[ t \frac{-1}{i \, k}e^{-i \, k \, t} \right]_{-\pi}^{\pi} -\frac{1}{2\pi}\int_{-\pi}^{\pi} \frac{1}{i \, k}e^{-i \, k \, t}=\frac{ cos(k\pi)}{-ik}-\frac{i sin(k\pi)}{\pi k^2}=\frac{i(-1)^k}{k} \end{align} \begin{align} c_0=\frac{1}{2\pi} \int_{-\pi}^{\pi} t dt= \frac{1}{2\pi} \left[ \frac{t^2}{2}\right]_{-\pi}^{\pi} =0 \end{align}

Discrete spectrum $c_k$ of the Fourier Series with $f(t)=t$ up to $k=\pm 10$