Tackling Fourier Series: Need Help With Examples

In summary, the conversation is about how to work out Fourier series for various functions. The speaker mentions that any periodic integrable function can be approximated by a sum of sine and cosine functions according to Fourier's theorem. They also mention that the Fourier coefficients can be calculated using integration and the Euler formulas, and that the period of the function must be taken into consideration. The speaker goes through an example of finding the Fourier series for a rectangle function, showing how the coefficients can be determined and discussing the importance of determining if the function is even or odd. They also mention that the more sine terms included in the series, the more it will resemble the original function.
  • #1
I've been trying pretty consistently to work out the Fourier series for a number of functions, but continually fail to find the correct series. My book is terrible in that it only has one poorly explained example of how to do a Fourier series. I was wondering if anyone has any links to worked problems involving them, that would be much appreciated.
Physics news on Phys.org
  • #2
I don't have any links, but I can offer some advice...

Any periodic integrable function can be approximated by a sum of sine and cosine function. This is Fourier's theorem. Formally,

[tex]f(x) = a_0 + \sum_{n=1}^{\infty}\left(a_n\cos(nx) + b_n\sin(nx)\right)[/tex]

The purpose of many Fourier decomposition problems is to write a given function [itex]f(x)[/itex] into this form. This almost always requires us to calculate [itex]a_0,\,a_n,\,b_n[/itex]. I say almost always because sometimes the function may be even or odd.

Well, these Fourier coefficients are easy to calculate, because there are formula's for them - namely the Euler Formulas:

[tex]a_0 = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)dx[/tex]

[tex]a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx[/tex]

[tex]b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx[/tex]

Note that if [itex]f(x)[/itex] is a polynomial of degree greater than 1, or any trigonometric or exponential function, then calculating these coefficients is probably going to require integration by parts. If you're lucky enough to have Maple or some computer mathematics package, this can be simple.

Once you have determined each of these coefficients it is just a simple matter of substituting them into Fourier's equation.
  • #3
Functions that you will be asked to find the Fourier series for are going to be periodic. The more simpler functions will be periodic with a period of [itex]2\pi[/itex], whereas the slightly more complicated functions will have a period of [itex]2L[/itex].

So after you are given your function [itex]f(x)[/itex] you first must recognise its period. If it is [itex]2\pi[/itex] then your function has a fundamental period and we just use the Euler Formulae above. For now this is what we will consider...

After you have determined your function to be periodic over the interval [itex]\[-\pi,\pi\][/itex], the next thing you must do is determine if it is even or odd.

If you have a periodic function that isn't even or odd at [itex]x=0[/itex] but at some other point [itex]x = y[/itex], you can adjust the axes so that the function becomes symmetric at [itex]x=0[/itex]. This pretty much means you can centre your function at 0 and your integration becomes simpler.

Generally this requires one or both of two things:
1. You know what the graph of the function looks like, and you can make an educated guess at whether or not the function is even or odd.
2. You are able to calculate it using the fact that a function is even if
[tex]g(-x) = g(x)[/tex]
or odd if
[tex]g(-x) = -g(x)[/tex]
Last edited:
  • #4
In applications, periodic functions will almost never have a period of [itex]2\pi[/itex]. However, if you think about it, it is possible to expand or contract the scale of the axes upon which your function is defined, such that the period becomes [itex]2\pi[/itex].

If your function has an arbitrary period [itex]2L[/itex], then we must adjust the Euler formulae accordingly.

[tex]a_0 = \frac{1}{2L}\int_{-L}^{L}f(x)dx[/tex]

[tex]a_n = \frac{1}{L}\int_{-L}^{L}f(x)\cos\frac{n\pi x}{L}dx[/tex]

[tex]b_n = \frac{1}{L}\int_{-L}^{L}f(x)\sin\frac{n\pi x}{L}dx[/tex]

Further, the Fourier Series becomes

[tex]f(x) = a_0 + \sum_{n=1}^{\infty}\left(a_n\cos\frac{n\pi x}{L} + b_n \sin\frac{n\pi x}{L}\right)[/tex]

Next I will work through a problem
  • #5
Consider the well-known rectangle function.

[tex]f(x) = \left\{\begin{array}{cc}
-k & -\pi < x < 0 \\
k & 0 < x < \pi

The first question to ask yourself is: what is the period of this function?

What is the length of this function before it repeats itself? Quite simply, the period is [itex]2\pi[/itex]. Draw it on some paper, and notice that it repeats the same pattern every [itex]2\pi[/itex]. So since this function has the fundamental period, we use the corresponding Euler formulae and Fourier Series.

The second question to ask yourself is: is this function even or odd?

Luckily, this is one of those functions which you can picture in your head, or write down on a piece of paper. It is odd, since it is NOT symmetric about 0.
When a function is odd, the first Fourier coefficient is always 0, no matter how much don't want it to be. To see this, we compute

[tex]a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx[/tex]

[tex]= \frac{1}{\pi}\left[\int_{-\pi}^{0}(-k)\cos(nx)dx + \int_{0}^{\pi}k\cos(nx)dx\right][/tex]

Notice how I have split the integral into two integrals. The rest of the computation is simple calculus, and

[tex]a_n = 0[/tex]

Why does an odd function always have [itex]a_n = 0[/itex]? Remember, that the Fourier Series of a function is just an approximation of that function as a sum of sines and cosines. The sine function is by definition odd, and the cosine function is by definition even.

The Forier coefficient that accompany the sine and cosine term in the Fourier Sum are like weighted parameters. The larger the [itex]a_n[/itex] the more the function will be "like" a cosine and hence even. The larger the [itex]b_n[/itex] the more the function will be "like" a sine and hence odd.

So the Fourier coefficients [itex]a_n[/itex] and [itex]b_n[/itex] influence how the Fourier Sum will act.

In our example, the rectangle function is odd. So we are going to expect that the Fourier Series will be a sine wave. In fact we will see that the more sine terms we allow into our Fourier Series, the more and more the Fourier Series will look like our function. This will become clear in a minute...

So it is of no surprise that [itex]a_n = 0[/itex] because it is [itex]a_n[/itex] that accompanies the cosine term.

This leaves us to calculate [itex]a_0[/itex]. This coefficient is special in that it always defined as the average value of the function. This coefficient tells us where the function is located.

So for our rectangle function, what do you think its average value is? Zero of course. So we guess that [itex]a_0 = 0[/itex]. Let's see if we are right?

[tex]a_0 = \frac{1}{2\pi}\left[\int_{-\pi}^0-kdx + \int_0^{\pi}kdx\right][/tex]

[tex]a_0 = \frac{1}{2\pi}\left[\left.-kx\right|_{-\pi}^0 + \left.kx\right|_0^{\pi}\right][/tex]

[tex]a_0 = \frac{1}{2\pi}\left(k\pi -k\pi\right)[/tex]

[tex]a_0 = 0[/tex]

Of course the same technique applies to all functions.


[tex]b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx[/tex]

[tex]b_n = \frac{1}{\pi}\left[\int_{-\pi}^{0}(-k)\sin(nx)dx + \int_{0}^{\pi}k\sin(nx)dx\right][/tex]

[tex]b_n = \frac{1}{\pi}\left[\left.k\frac{\cos(nx)}{n}\right|_{-\pi}^0 - \left.k\frac{\cos(nx)}{n}\right|_0^{\pi}\right][/tex]

[tex]b_n = \frac{k}{n\pi}\left[\cos0 - \cos(-n\pi) - \cos(n\pi) + \cos0\right][/tex]

[tex]b_n = \frac{2k}{n\pi}(1-\cos(n\pi))[/tex]

Now, something which you must always do when you get to this stage in your calculations, something that a lot of people forget. Simply note that the sum of Fourier Series take on values of [itex]n \in \mathbb{N}[/itex]. That is

[tex]n = 1,2,\dots[/tex]

And we must note that

[tex]\cos(n\pi) = (-1)^n \, \forall \, n \in \mathbb{N}[/tex]

This is just a fancy way of writing...

[tex]\cos(n\pi) = \left\{\begin{array}{cc}
1 & \mbox{for even}\, n \\
-1 & \mbox{for odd}\, n

and thus

[tex]1-\cos(n\pi) = \left\{\begin{array}{cc}
2 & \mbox{for odd}\, n \\
0 & \mbox{for even}\, n

Now we can explicitly calculate our [itex]b_n[/itex] coeffcients

[tex]b_1 = \frac{4k}{\pi}[/tex]
[tex]b_2 = 0[/tex]
[tex]b_3 = \frac{4k}{3\pi}[/tex]
[tex]b_4 = 0[/tex]

Obviously for every even n, [itex]b_n = 0[/itex].

Hence the Fourier Series is

[tex] f(x) = \frac{2k}{\pi}\sum_{n=1}^{\infty}b_n\sin(nx)[/tex]

[tex] f(x) = \frac{2k}{\pi}\left(\sin(x) + \frac{1}{3}\sin(3x) + \frac{1}{5}\sin(5x) + \dots \right)[/tex]
Last edited:
  • #6
Nice oxymoron, but is this true?

Oxymoron said:
A periodic function is always either going to be even or odd, since we are allowed to adjust the position of 0 along the real line, such that the function is symmetric (even) or non-symmetric (odd) about 0.

Look at the attachement for example.


  • Untitled-1.jpg
    4.9 KB · Views: 429
  • #7
No, it isn't.

Ahh, I know what I meant to say... let me re-word this...

If you have a periodic function that isn't even or odd at [itex]x=0[/itex] but at some other point [itex]x = y[/itex], you can adjust the axes so that the function becomes symmetric at [itex]x=0[/itex]. This pretty much means you can centre your function at 0 and your integration becomes simpler.

I guess what I said doesn't make much sense at all. Sorry about that.
Last edited:
  • #8
By the way quasar987, I have changed what I said above.
  • #9
Wow, thank you for the help Oxy, my book's only example was the series for the the rectangle function, but your method of solving it was much more illuminating. Thanks again for the help.
  • #10
Hi ...I have a doubt realted to this...Say I have f(x)=xsinx...this is an even function...so I should get values for only a0 and an...however,in my book there are 2 sums based on xsinx...one in which we find its Fourier series in the interval (0,2pi) and another in which its Fourier cosine series in (0.pi) is to be found. In the solution provided,they get a certain value for b1 for the first sum whereas they don't get any b-terms for the second one.
My question is,why do we get a b1 term at all for the first situation,as the function is even and is not supposed to have b terms. Further,why do we get a different answer for the two sums?
  • #11
  • #12

This is an excellent site for what you're looking for...just scroll down to "Higher Calculus" and you should see "Fourier Series."

Related to Tackling Fourier Series: Need Help With Examples

What is a Fourier series?

A Fourier series is a mathematical expression that represents a periodic function as a sum of sine and cosine functions. It is used to analyze and approximate functions in the frequency domain.

Why do we use Fourier series?

Fourier series are useful in many areas of science and engineering because they allow us to break down a complex function into simpler components, making it easier to analyze and manipulate. They are particularly useful in signal processing, image analysis, and solving differential equations.

What are the main properties of Fourier series?

The main properties of Fourier series include linearity (the sum of two Fourier series is also a Fourier series), periodicity (the series repeats itself over a specific interval), and convergence (the series approaches the original function as more terms are added).

How do you calculate Fourier coefficients?

Fourier coefficients can be calculated using integration or by using the Fourier series formula, which involves multiplying the function by sine or cosine functions and integrating over one period. The coefficients represent the amplitude and phase of each component in the series.

What are some real-world applications of Fourier series?

Fourier series are used in many real-world applications, including signal processing for audio and video signals, image compression and analysis, and solving heat transfer problems in engineering. They are also used in fields such as physics, chemistry, and astronomy to analyze and model periodic phenomena.

Similar threads

  • Calculus and Beyond Homework Help
  • Science and Math Textbooks
  • Calculus and Beyond Homework Help
  • MATLAB, Maple, Mathematica, LaTeX
  • Introductory Physics Homework Help
  • Engineering and Comp Sci Homework Help