# Tackling Fourier Series: Need Help With Examples

• Gza
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.
Gza
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.

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

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

The purpose of many Fourier decomposition problems is to write a given function $f(x)$ into this form. This almost always requires us to calculate $a_0,\,a_n,\,b_n$. 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:

$$a_0 = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)dx$$

$$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx$$

$$b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx$$

Note that if $f(x)$ 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.

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 $2\pi$, whereas the slightly more complicated functions will have a period of $2L$.

So after you are given your function $f(x)$ you first must recognise its period. If it is $2\pi$ 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 $$-\pi,\pi$$, 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 $x=0$ but at some other point $x = y$, you can adjust the axes so that the function becomes symmetric at $x=0$. 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
$$g(-x) = g(x)$$
or odd if
$$g(-x) = -g(x)$$

Last edited:
In applications, periodic functions will almost never have a period of $2\pi$. 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 $2\pi$.

If your function has an arbitrary period $2L$, then we must adjust the Euler formulae accordingly.

$$a_0 = \frac{1}{2L}\int_{-L}^{L}f(x)dx$$

$$a_n = \frac{1}{L}\int_{-L}^{L}f(x)\cos\frac{n\pi x}{L}dx$$

$$b_n = \frac{1}{L}\int_{-L}^{L}f(x)\sin\frac{n\pi x}{L}dx$$

Further, the Fourier Series becomes

$$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)$$

Next I will work through a problem

Consider the well-known rectangle function.

$$f(x) = \left\{\begin{array}{cc} -k & -\pi < x < 0 \\ k & 0 < x < \pi \end{array}\right.$$

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 $2\pi$. Draw it on some paper, and notice that it repeats the same pattern every $2\pi$. 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

$$a_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos(nx)dx$$

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

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

$$a_n = 0$$

Why does an odd function always have $a_n = 0$? 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 $a_n$ the more the function will be "like" a cosine and hence even. The larger the $b_n$ the more the function will be "like" a sine and hence odd.

So the Fourier coefficients $a_n$ and $b_n$ 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 $a_n = 0$ because it is $a_n$ that accompanies the cosine term.

This leaves us to calculate $a_0$. 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 $a_0 = 0$. Let's see if we are right?

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

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

$$a_0 = \frac{1}{2\pi}\left(k\pi -k\pi\right)$$

$$a_0 = 0$$

Of course the same technique applies to all functions.

Now

$$b_n = \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\sin(nx)dx$$

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

$$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]$$

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

$$b_n = \frac{2k}{n\pi}(1-\cos(n\pi))$$

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 $n \in \mathbb{N}$. That is

$$n = 1,2,\dots$$

And we must note that

$$\cos(n\pi) = (-1)^n \, \forall \, n \in \mathbb{N}$$

This is just a fancy way of writing...

$$\cos(n\pi) = \left\{\begin{array}{cc} 1 & \mbox{for even}\, n \\ -1 & \mbox{for odd}\, n \end{array} \right.$$

and thus

$$1-\cos(n\pi) = \left\{\begin{array}{cc} 2 & \mbox{for odd}\, n \\ 0 & \mbox{for even}\, n \end{array} \right.$$

Now we can explicitly calculate our $b_n$ coeffcients

$$b_1 = \frac{4k}{\pi}$$
$$b_2 = 0$$
$$b_3 = \frac{4k}{3\pi}$$
$$b_4 = 0$$

Obviously for every even n, $b_n = 0$.

Hence the Fourier Series is

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

$$f(x) = \frac{2k}{\pi}\left(\sin(x) + \frac{1}{3}\sin(3x) + \frac{1}{5}\sin(5x) + \dots \right)$$

Last edited:
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.

#### Attachments

• Untitled-1.jpg
4.9 KB · Views: 429
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 $x=0$ but at some other point $x = y$, you can adjust the axes so that the function becomes symmetric at $x=0$. 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:
By the way quasar987, I have changed what I said above.

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.

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?

Anyone?

http://www.intmath.com/

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

## 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.

• Calculus and Beyond Homework Help
Replies
3
Views
375
• Science and Math Textbooks
Replies
6
Views
2K
• General Math
Replies
5
Views
3K
• Calculus and Beyond Homework Help
Replies
1
Views
392
• MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
• Introductory Physics Homework Help
Replies
5
Views
4K
• Topology and Analysis
Replies
4
Views
438
• Calculus
Replies
11
Views
904
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Calculus and Beyond Homework Help
Replies
1
Views
954