# Modelling a function for a fourier series

when modelling a function for a fourier series, what determines which function i select from the forcing function for an and bn?
eg
in the following would 1-t^2 be used in the an or bn formula?
http://users.on.net/~rohanlal/fourier2.jpg [Broken]

Last edited by a moderator:

you would have to use both parts of f(t) when finding an and bn. all you need to do is break up the integrals that determine an and bn to the appropriate domains for each part of your function.

but how do i determine which part of f(x) goes in the an and which in the bn formula?

As Easty says, you have to use both the definitions of f(t) for both an and bn.
Meaning, an will be sum of two integrals :
-One going from -ve infinity to 0 and using the first definition of f(t)=1-t2.
-Second going from 0 to infinity, using the second definition of f(t)=1.

Likewise for bn.

Goodluck!

Cyosis
Homework Helper
The general expression for a Fourier series of a 2pi-periodic function is given by.

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

So in general you will need to always calculate both a_n and b_n, however seeing as we integrate over a symmetric interval to determine the coefficients and we know that if we integrate an odd function over a symmetric interval we get 0. Therefore if f(t) is even f(t)sin(nt) is odd and b_n will be zero. Similarly if f(t) is odd f(t)cos(nt) will be odd and a_n will be zero. Your function is neither even nor odd.

if an or bn are zero due to the function being even or odd then that means you dont use both parts of f(t) in the formula. How do i determine what part of f(t) i should use?

jbunniii
Homework Helper
Gold Member
if an or bn are zero due to the function being even or odd then that means you dont use both parts of f(t) in the formula. How do i determine what part of f(t) i should use?

Your f(t) is neither even nor odd. Therefore you must use both parts, as others have already told you.

Why don't you start by trying to write down a formula for $$a_n$$. It will be a sum of two integrals, one for each part of f(t). If you get stuck, then show us what you are trying, and we'll let you know if something is wrong and/or suggest a next step.

i understand that is the case for this problem but what about problems that have odd or even functions?

Cyosis
Homework Helper
Your question is answered in post #5. If that's not what you meant then please try to be more detailed.

I want to find the fourier series of the following function, an even function, meaning bn=0
http://users.on.net/~rohanlal/even.jpg [Broken]
what should i make f(x) in the a_n formula, X+L or L-X?

Last edited by a moderator:
Cyosis
Homework Helper
Ry122 said:
i understand that is the case for this problem but what about problems that have odd or even functions?

If this is true, I would like to see the formula for a_n and b_n of the previous problem since it works exactly the same as your new problem. Therefore I suspect that you did something awkward for the previous problem as well. Please show us your work.

Last edited:
I haven't myself attempted these questions. I want an answer to my question before i bother trying.
Are you saying that you use both parts of f(x) even in even functions?
In the solution to my last posted problem, for a_n f(x) is made to equal L-X and the second part of the function is ignored (X+L).

Cyosis
Homework Helper
The general rules of this forum as far as I know ask you to attempt first, show us your attempt and we help you from there. My point is that in post 8 you claim to understand the question you ask in post 10. This seemed odd to me. Now seeing what you're doing in post 12 I know for sure you did not understand the previous problem either. That's why I think it's best to return to the original problem before continuing.

Either way the function f(x) is even indeed so b_n is 0. However the question states you have to Fourier transform f(x). The function you're transforming is g(x)=L-X, and $f(x) \neq g(x)$.

This is what you want to calculate:

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

[quote='Ry122]
Are you saying that you use both parts of f(x) even in even functions[/quote]

This is not only what I am saying, but also the formula for the Fourier coefficients.

Last edited:
so this is wrong? this is a solution from my teacher. theres no X+L in there
http://users.on.net/~rohanlal/laplace.jpg [Broken]

Last edited by a moderator:
Cyosis
Homework Helper
Yes that's wrong, what you have there is the Fourier transform of the function g(x) in my previous post. In fact g(x) is odd so g(x) cos( Pi n x/L) is odd. You should really read post #5 again and use the data the assignment has given you. It gives you f(x), you have a formula to calculate a_n which includes the function f(x). So just plug f(x) into the formula and you can't go wrong.

but this is from my lecturer, and hes repeated the same process in several problems so it cant be a mistake.

Cyosis
Homework Helper
Ok I reviewed it again it's the correct answer, but you didn't just ignore the x+L part. Did you come to this answer by copying the lecture notes or actually realizing that:

$$\frac{1}{L}\int_{-L}^0 (x+L) dx+\frac{1}{L} \int_0^L(L-x)dx =\frac{2}{L}\int_0^L (L-x) dx$$?

so what happens with it?

Cyosis
Homework Helper
The left side is how you integrate your function f(x). Your teacher notices that he can write this as 2 times the integral of the right hand side. This saves time. He does NOT ignore the L+x term. Do you see this?

so it doesnt matter which part of f(x) you ignore, you can choose either part to be f(x) in a_n?

dx
Homework Helper
Gold Member
Cyosis, the solution in #14 is correct.

$$\frac{1}{L} \int_{-L}^{L}f(x) cos(k_n x) dx = \frac{1}{L} \int_{-L}^{0}(x + L)cos(k_n x) dx + \frac{1}{L} \int_{0}^{L}(L - x)cos(k_n x) dx = \frac{2}{L} \int_{0}^{L}(L-x) cos(k_n x) dx$$

EDIT: I see you already noticed.

Cyosis
Homework Helper
No, no and no. Your teacher does NOT ignore anything. Ignoring either side in this case would mean you're a factor 2 off.

Lets write out the full transform.

\begin{align*} a_n & = \frac{1}{L}\int_{-L}^L f(x)\cos(\frac{n \pi x}{L}) dx \\ & =\frac{1}{L}\int_{-L}^0 (x+L) \cos(\frac{n \pi x}{L}) dx+\frac{1}{L} \int_0^L(L-x) \cos(\frac{n \pi x}{L})dx & = \frac{2}{L}\int_0^L (L-x) \cos(\frac{n \pi x}{L}) dx \end{align}

To dx. Yes it is. Seeing as he was talking about ignoring one part of the function I missed the two, however I still think it's a lousy move of a teacher to write it in that form right away, which to some may suggest you're ignoring a part of the function. This is not the case and is causing a lot of confusion in this particular case.

i shouldn't have used the word ignore, what i meant to ask was does it matter which part of f(x) is chosen to be used in f(x) for a_n.
im asking if this is true
$$\frac{1}{L} \int_{-L}^{L}f(x) cos(k_n x) dx = \frac{1}{L} \int_{-L}^{0}(x + L)cos(k_n x) dx + \frac{1}{L} \int_{0}^{L}(L - x)cos(k_n x) dx = \frac{2}{L} \int_{0}^{L}(x + L)cos(k_n x) dx$$

dx
Homework Helper
Gold Member
No, that's not true. It would be true if the limits on your last integral were from -L to 0.

The point here is the both the integrals in the sum have the same value, so you can use twice the value of either one. Say you want to find the sum A + B, and you know that A = B = I. Then A + B = 2A = 2B.