The Begining
It all starts when Joseph Fourier started to analyze the Heat Equation which looks like:
or
Here T represent Temperature at any position x at time t
where:
- ( ) is the temperature distribution function,
- ( ) is time,
- ( ) represents the spatial coordinates (can be in 1D, 2D, or 3D),
- ( ) is the thermal diffusivity of the material,
- ( ) is the Laplace operator.
This equation is what we call A Linear Partial Differential Equation , what it means is ,
If we have 2 solutions which are different and satisfies a Boundary condition then we can write:
A new solution=>
where a and b are 2 arbitrary constants which depends upon the Initial Conditions. But how it is so powerful . As we know the solution will give us some combination of sine and cosine function. So what?
Ps: I am a Mechnical Engineering Student 😎😤
To understand what I mean , let’s take a simple example. We will consider an imaginary perfect metal rod, which have 2 different temperatures on two different sides with respect to it’s midpoint. Let’s see what I mean graphically:
The rod has 2 different temperatures on 2 different side w.r.t it’s midpoint.
So, If we mark temperature on Y-axis and position on X-axis, then as you can see, we get what we call a Step Function.
But wait a minute, I have told you the solution we get from the Heat Equation are Linear combination of cosine or sine function.
But our assumed system of Rod should also be solvable with the same method and should give us A Linear combination of Sine and Cosine(i.e., we will get Step function using Periodic sine and cosine function?? w.t.f)
This is where Fourier make a move, what we call a pro-gamer move and become immortal in the world of Science.
As you can see in the gif, As we keep adding the cosine or sine or their combination (depends on boundary condition) with appropriate coefficients(in our discussion similar to a and b),we are getting something close to our desired function. But our function is discontinuous and even that can’t stop us!!, Now you understand how powerful it is? You may say, well It looks like our function but it is not exactly that, I will say yes you are right. What we have is just an approximation but as we add more and more solutions of the Differential Equation shown above , We will get more and more close to our function. Here I have given you a playing thing, Try increasing number of terms and see how you approaches to that function(More general square wave).
Now we understand the idea behind this beautiful method. So, Now let’s see how to calculate one.
Fourier Series of a Function:
If a function f(x) of some real variable x, defined and integrable in the interval ( ), satisfies Dirichlet’s Conditions i.e.,
- f(x) is single valued and finite,
- f(x) is piecewise continuous having at most finite number of finite discontinuities,
- f(x) has at most finite number of maxima and minima within the interval, then f(x) can be expanded in this interval into the following series, called Fourier Series.
- For a function ( ) with period ( ), the Fourier series representation is given by:
where:
- ( ) is the average value of the function over one period,
- ( ) and ( ) are the Fourier coefficients, given by:
- Consider a function ( ) with period ( ) in the interval ( ). The angular frequency ( ) is defined as:
The Fourier series representation in terms of ( ) can be written as:
where:
- ( ) is the average value of the function over one period,
- ( ) and ( ) are the Fourier coefficients, given by:
Triangular Wave formation using just pure sine waves
The GIF where the Square wave(Step Function for a particular case) or Triangular wave is formed as an example of this series. As you can see we are just adding pure waves with certain frequency and amplitude. They are just waves and not have any circles in it.
In these equations , an and bn are called Fourier Constants and are given by
( a_n ) - The Cosine Coefficients
( b_n ) - The Sine Coefficients
The value of () is found by putting , so I have not written it.
If you want the proof, just use the orthogonality of sine and cosine .
So, We have seen that we can expand any function(which satisfies certain conditions) into a series of sine and cosine. But where are the circles which you see in the Joker or What is Fourier series gif? To understand this we have to go back to the equation
; Where is the square root of
This equation tells us that represent a circle as and also does the same. Using this simple but powerful identity we can write the in terms of exponential functions and in 2D plane they are represented by circles.
Like you see in this video, We have drawn a perpendicular from it’s tip to the Imaginary axis. The curve created because of it is our good old sine curve.
Similarly we can get a cosine curve if we draw a perpendicular from the tip to real axis.
So, using the upper identity we can write as:
where ( ) are the Fourier coefficients in the complex form.
Now you see from where those circles come from.
Adding each exponent term of the complex Fourier expansion for square wave
In this series each exponent term actually represent a rotating circle with a certain frequency(given by the term inside bracket) and a certain radius(given by cn). Those circles join together(one after another to their radius’s end like shown in the GIF file) to give you the curve or function as you have seen before.
Here cn is equivalent to and ( ) is equivalent to . Those constants are given by,
The problems concerning the possibility of expressing a function by Fourier Series are cumbersome. Fortunately almost all functions associated with physical problems are covered by the Dirichlet’s Conditions. Fourier’s Theorem is a set of conditions sufficient to imply the convergence of The Fourier Series to some function closely related to the given function.
Convergence of The Series: If f(x) and are sectionally continuous in to and satisfies Dirichlet conditions then according to Fourier Theorem we can say:
The Fourier series of f(x) converges to
If f(x) is discontinuous at a point , then the Fourier series of f(x) converges to as .
Odd-Even Function Trick: When we expand any function we have an equation with a Left hand side and Right hand side . As both sides must be equal, If one side has even function , then another one must be even and if one is odd then other must be odd also. This simple idea is very far reaching and it reduces the complexity of calculation.
As we know cosine is an even function so if , then Expansion of only contains terms with cosines and if , then Expansion of only contains terms with Sine as sine is a odd function.
Calculation:
Let’s calculate the fourier series of the square wave as an example:
As you can see the Square wave is defined as shown here.
As you can notice , this means we must have odd terms only when we expand this function. This means we will only have the sine terms i.e., the terms whose coefficient are bn. This insight reduced our half work and we will now only consider sine terms and not cosines.
To solve this problem as i have told before , we just need bn due to the symmetry as shown in the figure. To understand it’s intuition see the p5.js sketch hyperlinked with the text “Playing Thing” before the discussion Fourier Series of a Function.
This is the Square wave where T = 3
we know ( ), here ( ) and ( ). This gives us ( ).
Then:
Now we substitute ( ) in the first one.
As for this function ( ), we get
As ( ) and ( ) are both dummy variables we replace them both by ( ) and get ,
NOTEWhen ( ) = even, ( ) and when ( ) = odd, ( ). Thus we have,
, where ( )
This is the solution.
As you can see here I have used the series of sine and cosine expansion(with ), but you can also expand the Square wave using exponent terms , which is signified by the fact that you can create that using Rotating Phasors(vectors) as shown before.
End:
The Fourier Series is a way of representing certain functions(mostly all periodic functions). From classical physics to Quantum Mechanics, even in data processing, It is used . It is one of the most powerful tool ever created by Maths.
We have discussed so much but even now there are many topics left. This post is already long so we will discuss the remaining things later. I hope this article will help you in building intuition and will help you in solving many basic problems. With this let’s end our discussion here.
If you want to make any drawing using epicycles, here is my github repo and deployed link. Just download that repository and use it for creating beautiful animations. But remember the best result will come when the used images will be single-line drawing.
I have written this Sketch try it out to draw circular Fourier Series. (As an example see the screenshot)
I’m Batman 🦇 Upper one is the Drawing and Lower one is the Series Breakdown to circle
Copyright stuff:
All the images and gif used here are all created using a python library called Manim , developed by Grant Sanderson and p5.js developed by Lauren McCarthy . All equations and calculations used are written by me using Latex/Katex.