Fourier Series
The fourier series is the summation of a given function in terms of sums of sin and cos function infinitely.
If f(x) is a function which is defined on an interval from [a,b], then the fourier series formula of that function is:
$$ f(x) \;=\; \frac{a_0}{2} \;+\; \sum_{n=1}^∞ \; a_n cos(\frac{2nπx}{b-a}) \;+\; b_n sin(\frac{2nπx}{b-a}) $$
Where,
f(x)= given function we want to evaluate
a0 , an , bb = fourier coefficients required to calculate
So we have to calculate values of a0 , an , bn, these are fourier series coefficients which can be calculated by using Euler’s Formula.
Fourier Coefficients
The Euler’s formula for our fourier series coefficients are:
$$ a_0 \;=\; \frac{2}{b-a} \; \int_a^b \; f(x) \; dx $$ $$ a_n \;=\; \frac{2}{b-a} \; \int_a^b \; f(x) cos(\frac{2nπx}{b-a}) \; dx $$ $$ b_n \;=\; \frac{2}{b-a} \; \int_a^b \; f(x) sin(\frac{2nπx}{b-a}) \; dx $$
But the problem for solving in Fourier series always contains intervals having differences of 2π. It mat be [-π,+π] or [0,2π]
So,
If the difference between point of interval is equals to 2π, then fourier series will become:
For b-a = 2π
$$ f(x) \;=\; \frac{a_0}{2} \;+\; \sum_{n=1}^∞ \; a_n cos(nx) \;+\; b_n sin(nx) $$
Where,
$$ a_0 \;=\; \frac{1}{π} \; \int_a^b \; f(x) \; dx $$ $$ a_n \;=\; \frac{1}{π} \; \int_a^b \; f(x) cos(nx) \; dx $$ $$ b_n \;=\; \frac{1}{π} \; \int_a^b \; f(x) sin(nx) \; dx $$
Now we have a way to calculate the coefficients of fourier series and then we can easily get expansion form of our fiven function f(x) in its interval by using Fourier series formula.
Before implementing fourier series examples problems, we need to take an overview of some general results of sin and cos function which we will always use while evaluating fourier series of integration.
These rules are given as:
For Sin : Sin(nπ) = 0 and Sin2(nπ) = 0
Similarly for Cos : cos(nπ) = (-1)n , cos2(nπ) = 1 , cos2(n+1)π = -1 , cos2(n-1)π = -1
Now Let’s work on fourier series examples for precise learning and proper understanding of this topic
Example Problem Of Fourier Series
Obtain the fourier series for f(x) = e-x in the interval of 0 < x < 2π.
Solution:
So we can see here
f(x) = e-x
b-a = 2π
Therefore, the fourier series formula will become
$$ e^{-x} \;=\; \frac{a_0}{2} \;+\; \sum_{n=1}^∞ \; a_n cos(nx) \;+\; b_n sin(nx) ----------(1)$$
Since we have to calculate a0 , an , bn first. So let’s solve them one by one and put it back in the above equation(1).
Let's take a start from a0 , Since
$$ a_0 \;=\; \frac{1}{π} \; \int_a^b \; f(x) \; dx $$
In our case, f(x) = e-x and interval [a,b] = [0,2π], So
$$ a_0 \;=\; \frac{1}{π} \; \int_0^{2π} \; e^{-x} \; dx $$ $$ a_0 \;=\; \frac{1}{π} \; \Biggr| \frac{e^{-x}}{-1} \Biggr|_0^{2π} \; dx $$ $$ a_0 \;=\; - \frac{1}{π} \left[ e^{-2π} \;-\; e^{0} \right] $$ $$ \implies a_0 \;=\; \frac{1 - e^{-2π}}{π} $$
Now just like that, we will solve for an
$$ a_n \;=\; \frac{1}{π} \; \int_a^b \; f(x) cos(nx) \; dx \;=\; \int_0^{2π} \; e^{-x} cos(nx) \; dx $$
Now this time, there is the product of two different type of function under the integral. We can use here Chain rule or Integration by parts to solve it, But for reducing the complexicity we will simply use the following formula to calculate an.
$$ \int e^{ax} cos(bx) \; dx \;=\; \frac{e^{ax}}{a^2+b^2} \left( a \; cos(bx) \;+\; b \; sin(bx) \right) $$
Here, a = -1 and b = n, So our integrating function will become:
$$ a_n \;=\; \frac{1}{π} \Biggr| \frac{e^-x}{(1+n^2)} (-cosnx \;+\; n \; sin nx) \Biggr|_0^{2π} $$
As 1/(1+n2) is a constant, we will take it outside to the integral and multiply e-x inside the braces.
$$ a_n \;=\; \frac{1}{π(1+n^2)} \Biggr| ne^-x \; sin nx \;-\; e^-x \; cosnx) \Biggr|_0^{2π} $$
Now put the upper limit and lower limit in that function to solve it
$$ a_n \;=\; \frac{1}{π(1+n^2)} \left[ (0-0) \;-\; (e^{-2π}-1) \right] \;\;\;\;\;\;\;\;\;\; ∵ \;=\; Sin(nπ) = 0 \;and\; cos2(nπ) = 1 $$ $$ a_n \;=\; \left( \frac{1}{(1+n^2)} \right) \left( \frac{1-e^{-2π}}{π} \right) $$
Similarly, Let’s work for the last coefficient bb. It will be
$$ b_n \;=\; \frac{1}{π} \; \int_a^b \; f(x) sin(nx) \; dx \;=\; \int_0^{2π} \; e^{-x} sin(nx) \; dx $$
Similar to an, we use the formula for solving integration of product of two function, which is little differ from upper formula used in case of cos. The formula in case of sin is:
$$ \int e^{ax} sin(bx) \; dx \;=\; \frac{e^{ax}}{a^2+b^2} \left( a \; sin(bx) \;-\; b \; cos(bx) \right) $$
There is a little change of sin formula from cos as you see but we will solve it in same manners. We already know a = -1 and b = n, So our integrating function will become:
$$ b_n \;=\; \frac{1}{π} \Biggr| \frac{e^-x}{(1+n^2)} (-sin \; nx \;-\; n \; cos \; nx) \Biggr|_0^{2π} $$ $$ b_n \;=\; \frac{1}{π(1+n^2)} \Biggr| e^-x \; sin \; nx \;+\; ne^-x \; cos \; nx) \Biggr|_0^{2π} $$ $$ b_n \;=\; \frac{1}{π(1+n^2)} \left[ (0-0) \;+\; (ne^{-2π}-n) \right] $$ $$ b_n \;=\; \frac{n(1-e^{-2π})}{π(1+n^2)} $$ $$ b_n \;=\; \left( \frac{n}{n^2+1} \right) \left( \frac{1-e^{-2π}}{π} \right) $$
Now we have calculated a0 , an , bn. But for fourier expansion, we have to put these coefficients back in the fourier series equation for our expansion series. Since the fourier series formula in equation(1) is:
$$ e^{-x} \;=\; \frac{a_0}{2} \;+\; \sum_{n=1}^∞ \; a_n cos(nx) \;+\; b_n sin(nx) $$
Putting the values of a0 , an , bn in it.
$$ e^{-x} \;=\; \left( \frac{1 - e^{-2π}}{2π} \right) \;+\; \left( \sum_{n=1}^∞ \; \frac{1}{(1+n^2)} \frac{1-e^{-2π}}{π} cos(nx) \right) \;+\; \left( \sum_{n=1}^∞ \; \frac{n}{n^2+1} \frac{1-e^{-2π}}{π} sin(nx) \right) $$
Taking common part outside to the braces
$$ e^{-x} \;=\; \frac{1 - e^{-2π}}{2π} \;+\; \left[ \frac{1}{2} \;+\; \sum_{n=1}^∞ \frac{1}{(1+n^2)} cos(nx) \;+\; \sum_{n=1}^∞ \frac{n}{n^2+1} sin(nx) \right] $$ $$ e^{-x} \;=\; \frac{1 - e^{-2π}}{2π} \;+\; \left[ \frac{1}{2} + ( \frac{1}{2}cosx \;+\; \frac{1}{5}cos2x \;+\; \frac{1}{10}cos3x \;+\; ...) \;+\; (\frac{1}{2}sinx \;+\; \frac{2}{5}sin2x \;+\; \frac{3}{10}sin3x \;+\; ...) \right]$$
So this is the Fourier Series expansion in terms of infinity sums of sin and cos of our given function e-x in the interval of 0 < x < 2π.