The Fourier Series

In the beginning, Fourier was trying to solve the Heat equation, which is a PDE describing how heat, with an initial distribution, propagates through a medium over time.

\[ \frac{\partial}{\partial t} T(x, t) = \alpha \frac{\partial^2}{\partial x^2} T(x, t) \]

The above equation says that:

The [rate of change over time of heat at a particular point x in the medium] is proportional to the [rate of change over time of heat gradient at a particular point x]

If you can find any T(x, t) that satisfies the above equation, and satisfy the initial and boundary conditions, then this T(x, t) can describe the way the heat distribution changes over time.

To start off, Fourier noticed that if we have an absurd initial heat distribution that looks exactly like a cosine wave with amplitude h, we can show that it satisfies the Heat equation.

Let:

\[ T(x, 0) = h cos(x) \]

Then:

\[ \frac{\partial}{\partial t} T(x, 0) = \alpha \frac{\partial^2}{\partial x^2} T(x, 0) \] \[ = \alpha (- h cos(x)) = -\alpha T(x, 0) \]

The above equation says that:

The [rate of change over time of heat at a particular point x in the medium] is proportional to the [heat at a particular point x in the medium]

This means that whatever cosine of arbitrary amplitude we start with, we’ll just get the same cosine with shorter amplitude in the next timestep. This is recursively true for all t >= 0.

Therefore:

\[ \frac{\partial}{\partial t} T(x, t) = -\alpha T(x, t) \]

Note that the above simply describes exponential decay over time. The solution for the above is simply:

\[ T(x, t) = C e^{-\alpha t} = h cos(x) e^{-\alpha t} \]

But to really solve a PDE, we also need another ingredient in the recipe: The boundary conditions T(0, t), T(L, t).

To find T(0, t) and T(L, t) for the Heat equation of a medium of length L, observe that if we split the heat distribution along the length of the medium into infinitely many points, the temperature difference between the last two points on both edges always approaches zero.

Therefore:

\[ \frac{\partial}{\partial x} T(0, t) = \frac{\partial}{\partial x} T(L, t) = 0 \]

We need to verify that our function T(x, t) also satisfies the above.

\[ \frac{\partial}{\partial x} T(x, t) = -h sin(x)e^{-\alpha t} \] \[ T(0, t) = T(L, t) = 0 \] \[ \iff L = n\pi \text{ for any integer } n \]

Evidently, our function T(x, t) only satisfies the boundary condition for very specific medium lengths L where L is a multiple of π.

To get around this, we can scale our cosine function to have a period that matches any medium of length L:

\[ T(x, t) = h cos(\frac{2\pi}{L} x) e^{-(\frac{2\pi}{L})^2 \alpha t} \]

Notice that if we scale the cosine in this way, the second partial derivative with respect to x will end up with an extra constant term. To ensure that the partial derivative with respect to t matches, we will also have to add that scaling into the exponential term.

\[ \frac{\partial}{\partial t} T(x, t) = \alpha \frac{\partial^2}{\partial x^2} T(x, t) \] \[ = -\alpha h (\frac{2\pi}{L})^2 cos(\frac{2\pi}{L} x) e^{-(\frac{2\pi}{L})^2 \alpha t} \]

In fact, we can have infinitely many solutions that can satisfy the boundary conditions for a medium of length L. More generally, we can have:

\[ T(x, t) = h cos(\frac{n\pi}{L} x) e^{-(\frac{n\pi}{L})^2 \alpha t} \] \[ \text{ for any integer } n \]

With this, we actually have the solution to describe ALL cosine shaped heat distributions that start with the amplitude h and period L, over a medium of length L and thermal diffusivity a.

We can currently only solve heat distributions in the shape of cosines with very specific periods. How can we solve the Heat equation for anything?

Fourier noticed that if we have two initial heat distributions T_1 and T_2:

\[ T_1(x, 0) = h_1 cos(\frac{\pi}{L} x) \] \[ T_2(x, 0) = h_2 cos(\frac{2\pi}{L} x) \]

We can make a third initial heat distribution T_3…:

\[ T_3(x, 0) = T_1(x, 0) + T_2(x, 0) \] \[ = h_1 cos(\frac{\pi}{L} x) + h_2 cos(\frac{2\pi}{L} x) \]

… and we immediately have the solution for it:

\[ T_3(x, t) = T_1(x, t) + T_2(x, t) \] \[ = h_1 cos(\frac{\pi}{L} x) e^{-(\frac{\pi}{L})^2 \alpha t} \] \[ + h_2 cos(\frac{2\pi}{L} x) e^{-(\frac{2\pi}{L})^2 \alpha t} \]

Due to linearity, any initial heat distributions described by the sum of any of these cosine waves with specific periods can be solved by the sum of all their solutions.

BUT… that’s not very useful yet.

At this point, Fourier asked a really absurd question: “If we can describe any heat distribution solely by summing arbitrarily many of these cosine waves of specific periods and arbitrary amplitudes, how can we write that down Mathematically?”

The general solution of the Heat equation:

\[ T(x, t) = \sum^\infty_{n=0} a_n cos(\frac{n\pi}{L} x) e^{-(\frac{n\pi}{L})^2 \alpha t} \] \[ = a_0 cos(\frac{0\pi}{L} x) e^{-(\frac{0\pi}{L})^2 \alpha t} \] \[ + a_1 cos(\frac{1\pi}{L} x) e^{-(\frac{1\pi}{L})^2 \alpha t} \] \[ + a_2 cos(\frac{2\pi}{L} x) e^{-(\frac{2\pi}{L})^2 \alpha t} \] \[ + … \]

Of course, whether this could work was still unknown to him at that time. Besides, even if we knew the individual periods of the cosines that make up the solution, we will do not know the individual amplitudes a_n.

What we really want to find out first is how we can represent an initial condition with cosines, so we can simply ignore the t terms for now.

\[ T(x, 0) = \sum^\infty_{n=0} a_n cos(\frac{n\pi}{L} x) \] \[ = a_0 cos(\frac{0\pi}{L} x) \] \[ + a_1 cos(\frac{1\pi}{L} x) \] \[ + a_2 cos(\frac{2\pi}{L} x) \] \[ + … \]

Now, let’s think about what these a_n terms actually mean. In particular, we look at the first term a_0.

Clearly, the entire first term is a constant as a_0 is a constant and the terms on the right evaluates to 1. But what does it really mean?

If we think about what happens when t is very large, we can see that every subsequent term falls to 0, leaving only the a_0 term remaining (i.e. the heat along all points on the rod is constant).

Therefore, a_0 is actually the average heat of the medium. Another way of expressing an average is through an integration:

\[ a_0 = \frac{1}{L} \int^L_0 T(x, 0) dx \]

The Fourier observed that every other term in the summation goes to zero when summed over the length of the medium as all the chosen cosine functions are odd:

\[ a_0 = \frac{1}{L} \int^L_0 T(x, 0) dx \] \[ = \frac{1}{L} \int^L_0 \sum^\infty_{n=0} a_n cos(\frac{n\pi}{L} x) dx \] \[ = \frac{a_0}{L} \int^L_0 cos(\frac{0\pi}{L} x) dx \] \[ + \frac{a_1}{L} \int^L_0 cos(\frac{1\pi}{L} x) dx \] \[ + \frac{a_2}{L} \int^L_0 cos(\frac{2\pi}{L} x) dx \] \[ + … \] \[ = \frac{a_0}{L} \cdot L \] \[ + \frac{a_1}{L} \cdot 0 \] \[ + \frac{a_2}{L} \cdot 0 \] \[ + … \] \[ = a_0 \]

Applying Euler’s formula to convert our cosine into an exponential pair, we would expect our previous averaging formula to still hold:

\[ a_0 = \frac{1}{L} \int^L_0 T(x, 0) dx \] \[ = \frac{1}{L} \int^L_0 \sum^\infty_{n=0} a_n (e^{\frac{n\pi}{L} ix} + e^{-\frac{n\pi}{L} ix}) dx \] \[ = \frac{a_0}{L} \int^L_0 \frac{1}{2} (e^{\frac{0\pi}{L} ix} + e^{-\frac{0\pi}{L} ix}) dx \] \[ + \frac{a_1}{L} \int^L_0 \frac{1}{2} (e^{\frac{1\pi}{L} ix} + e^{-\frac{1\pi}{L} ix}) dx \] \[ + \frac{a_2}{L} \int^L_0 \frac{1}{2} (e^{\frac{2\pi}{L} ix} + e^{-\frac{2\pi}{L} ix}) dx \] \[ + … \] \[ = \frac{a_0}{L} \cdot L \] \[ + \frac{a_1}{L} \cdot 0 \] \[ + \frac{a_2}{L} \cdot 0 \] \[ + … \] \[ = a_0 \]

Note also, that each pair of exponentials are just odd mirrors of each other, so we can further simplify:

\[ a_0 = \frac{1}{L} \int^L_0 T(x, 0) dx \] \[ = \frac{1}{L} \int^L_0 \sum^\infty_{n=0} a_n \frac{1}{2} (e^{\frac{n\pi}{L} x} + e^{-\frac{n\pi}{L} x}) dx \] \[ = \frac{1}{L} \int^L_0 \sum^\infty_{n=0} a_n * e^{\frac{n\pi}{L} x} dx \] \[ = \frac{a_0}{L} \int^L_0 e^{\frac{0\pi}{L} x} dx \] \[ + \frac{a_1}{L} \int^L_0 e^{\frac{1\pi}{L} x} dx \] \[ + \frac{a_2}{L} \int^L_0 e^{\frac{2\pi}{L} x} dx \] \[ + … \] \[ = \frac{a_0}{L} \cdot L \] \[ + \frac{a_1}{L} \cdot 0 \] \[ + \frac{a_2}{L} \cdot 0 \] \[ + … \] \[ = a_0 \]

Here comes the genius observation that Fourier made to allow us to find any arbitrary a_n. Fourier noticed that we can use a simple trick to kill off all coefficients except a_1 – by multiplying in an additional exponential term.

\[ a_1 = \frac{1}{L} \int^L_0 T(x, 0) e^{-\frac{1\pi}{L} x} dx \] \[ = \frac{1}{L} \int^L_0 \sum^\infty_{n=0} a_n e^{\frac{n\pi}{L} x} e^{-\frac{1\pi}{L} x} dx \] \[ = \frac{a_0}{L} \int^L_0 e^{\frac{0\pi}{L} x} e^{-\frac{1\pi}{L} x} dx \] \[ + \frac{a_1}{L} \int^L_0 e^{\frac{1\pi}{L} x} e^{-\frac{1\pi}{L} x} dx \] \[ + \frac{a_2}{L} \int^L_0 e^{\frac{2\pi}{L} x} e^{-\frac{1\pi}{L} x} dx \] \[ + … \] \[ = \frac{a_0}{L} \int^L_0 e^{-\frac{1\pi}{L} x} dx \] \[ + \frac{a_1}{L} \int^L_0 e^{\frac{0\pi}{L} x} dx \] \[ + \frac{a_2}{L} \int^L_0 e^{\frac{1\pi}{L} x} dx \] \[ + … \] \[ = \frac{a_0}{L} \cdot 0 \] \[ + \frac{a_1}{L} \cdot L \] \[ + \frac{a_2}{L} \cdot 0 \] \[ + … \] \[ = a_1 \]

Thus, we now have the general formula to find the coefficients for the Heat equation:

\[ a_n = \frac{1}{L} \int^L_0 T(x, 0) * e^{-\frac{n\pi}{L} x} dx \]

Therefore, the complete solution for solving the Heat equation is:

\[ T(x, t) = \sum^\infty_{n=0} a_n * cos(\frac{n\pi}{L} x) e^{-(\frac{n\pi}{L})^2 \alpha t} \] \[ a_0 = \frac{1}{L} \int^L_0 T(x, 0) dx \] \[ a_n = \frac{1}{L} \int^L_0 T(x, 0) * e^{-\frac{n\pi}{L} x} dx \]

To generalize out of the Heat equation PDE for any periodic function f(t) of period T, we first introduce the sine components into the equation, each with its own coefficients b_n:

\[ f(t) = \sum^\infty_{n=-\infty} (a_n * cos(\frac{2n\pi}{T} t) \] \[ + b_n * sin(\frac{2n\pi}{T} t)) \]

Once again applying Euler’s formula, we can rewrite this as:

\[ f(t) = \sum^\infty_{n=0} (a_n * \frac{1}{2}(e^{i\frac{2n\pi}{T} t} + e^{-i\frac{2n\pi}{T} t}) \] \[ + b_n * \frac{1}{2i}(e^{i\frac{2n\pi}{T} t} – e^{-i\frac{2n\pi}{T} t}) \] \[ = \sum^\infty_{n=0} (\frac{1}{2}(a_n – ib_n)e^{i\frac{2n\pi}{T} t} \] \[ + \frac{1}{2}(a_n + ib_n)e^{-i\frac{2n\pi}{T} t}) \] \[ = \sum^\infty_{n=0} \frac{1}{2}(a_n – ib_n)e^{i\frac{2n\pi}{T} t} \] \[ + \sum^{-1}_{n=-\infty} \frac{1}{2}(a_n + ib_n)e^{-i\frac{2n\pi}{T} t} \] \[ = \sum^\infty_{n=-\infty} \frac{1}{2}(a_n – ib_n) e^{i\frac{2n\pi}{T} t} \] \[ = \sum^\infty_{n=-\infty} c_ne^{i\frac{2n\pi}{T} t} \]

The above is known as the exponential form of Fourier Series. To find c_n, the complex coefficient of each term, the same method used in finding a_n in the general Heat equation applies.

\[ f(t) = \sum^\infty_{n=-\infty} c_ne^{\frac{2n\pi}{T} it} \] \[ c_0 = \frac{1}{T} \int^T_0 f(t) dt \] \[ c_n = \frac{1}{T} \int^T_0 f(t) * e^{-\frac{2n\pi}{L} t} dt \]

A layman / practical interpretation of the above is…

You can break down a periodic complex function f(t) with period T into a sum of exponentials.

To find the coefficient c_n of each exponential term, simply integrate your original function multiplied by its respective exponential along the whole period.

To think that Fourier achieved this in 1822 is simply mind-blowing.

By Kelvin Ang

Ang Kah Min, Kelvin Singapore NUS Computer Engineering Shopee Engineering Infra Marketplace SRE

Leave a comment

Your email address will not be published. Required fields are marked *