You are here:

Advanced Math/Fourier Series and Phase


QUESTION: Dear Clyde,
I am currently studying Audio Signal Processing, and I am asked to derive the Fouries series for the signal in the screenshot I am attaching.
I am assuming a period between -T/2 and T/2.
The function is then -2t/T for t<0 and 2t/T for t>0.
Then, I've calculated that a_0 is 1, a_n is
2*[(-1)^n - 1]/(n^2*pi^2).
There is no b_0 because the function is even.

This is what I got so far.
Then, after plotting the spectrum (I am using Matlab for this) I must describe it, including the phase shift within the different harmonics.
On wikipedia ( I've found: "multiply every (4n−1)th harmonic by −1 (or changing its phase by π)'.

I don't get how can I see (if I can) it from my formulae.

Could you please help me?
(Sorry for the very long mail)
Thank you so much,

Best regards


ANSWER: The quotation is not telling you how to compute the series, it's just pointing out that every other nonzero term in the Fourier series is negative. But that's the Fourier for a triangle function that is not

Additionally, don't seem to mention T at all -- T is the period, which is at least worth considering since it affects how you compute the coefficients. I don't

I strongly advise that one does not reference the Wikipedia article in an attempt to find the solution to your problem. There are several reasons this won't help (and will probably confuse someone working on the problem you pose):

1. The Wikipedia article doesn't really show you how it derives the formula.

2. The Wikipedia article uses a function that is shifted down (changing a_0).

3. The Wikipedia article uses a function that is shifted left (dramatically changing the entire computation).

4. The Wikipedia article uses a function with period π -- yours has period T.

5. The Wikipedia article has a wave with twice the amplitude of the wave you want.

For reason 3, I have no idea whether you think a_n goes with the sine or cosine terms. So we'll start from scratch and try to get this figured out. You really should be trying to compute this without referring to a source -- it is not a hard computation, and it is more problematic when the source has a similar function that has a very different Fourier series.

The Fourier series of a function is, when feasible, a way of writing f(t) as:

f(t) = a_0/2 + ∑ a_n cos(2πnt/T) + b_n sin(2πtn/T)

Here, f should be a periodic function with period T.

Where you can compute:

a_n = (2/T) ∫ f(t) cos(2πn/T) dt

b_n = (2/T) ∫ f(t) cos(2πn/T) dt

where the integrals are taken over one period of the function.

Now, in your case, the function f(t) is sgn(t) (2t/T) where sgn(t) is +1 if t>0 and -1 if t<0, within the periodic domain [-T/2,T/2]. You have correctly observed that this is an even function, which means there are no b_n.

The integral you want is:

(2/T) ∫ sgn(t) (2t/T) cos(2πn t/T) dt

So when you this integral, first let's make the substitution u = 2t/T:

∫ u cos(πn u) du

By symmetry, you get:

2 ∫ u cos(πn u) du

Integrating by parts gives you

∫ u cos(nπu) du = cos(nπu)/π²n² + u sin(nπu)/πn

Evaluating this at 0 and 1, and subtracting, gives you the definite integral:

at u=0 → 1/π²n²

at u=1/2 → cos(nπ)/π²n² + sin(nπ)/πn

Subtract these two:

(cos(nπ) - 1)/π²n² + sin(nπ)/πn

Now, because n is an integer, sin(nπ) = 0.

If n is even you get:

(1 - 1)/π²n² + 0/πn = 0

When n is odd, you get:

(-1 - 1)/π²n² + 0/πn = -2/π²n²

b(n) = 0
a(2k) = 0
a(2k+1) = -2/π²(2k+1)²

That gives you the series representation of your function:

1/2 - (2/π²)cos(t) - (2/9π²)cos(3t) - (2/25π²)cos(5t) - ...

This seems to agree with your answer, but I'm concerned that the Wikipedia article has really messed you up because you are comparing two very different functions. I started from scratch and hopefully going through all of this makes sense. As far as I can tell, your answer is the same as this, but I wanted to make sure you understood the whole thing.

---------- FOLLOW-UP ----------

Follow up question page1
Follow up question pag  

Follow up question page2
Follow up question pag  
QUESTION: Dear Clyde, first of all thank you so much for you answer.

I am really sorry for this massive follow up question, I've found it easier to write on a pdf what I did and what I'm asking.

I am really sorry, I hope not to be impertinent.

I look forward to hearing from you.

Best regards

I am sorry to say, this question has become quite a bit longer and more involved than could be explained effectively by computer.

The basic problem here is that phase shifts are not simple translations when you are looking at Fourier series. Instead, what you might consider is this:

Given an all-cosines Fourier series: ∑ a(n) cos(ω n t) what happens when you shift this?

∑ a(n) cos(ω n (t-δ) )

∑ a(n) cos(ω n t - ω n δ )

∑ a(n) cos(ω n t) cos(ω n δ) - a(n) sin(ω n t) sin(ω n δ)

Now, you can recover the "new" Fourier coefficients:

New a(n) = a(n)cos(ωδn)

New b(n) = -a(n)sin(ωδn)

(The old b(n) were all zero.)

Notice in particular that:

[ old a(n) ] ^ 2 = [ new a(n) ]^2 + [ new b(n) ]^2

which is important -- you haven't changed the L2 norm of the function by the phase shift.

You ask for much more detail and some more specific questions, unfortunately I can't answer all of them effectively through this website, but I hope this puts you on the right track.

Advanced Math

All Answers

Answers by Expert:

Ask Experts


Clyde Oliver


I can answer all questions up to, and including, graduate level mathematics. I am more likely to prefer questions beyond the level of calculus. I can answer any questions, from basic elementary number theory like how to prove the first three digits of powers of 2 repeat (they do, with period 100, starting at 8), all the way to advanced mathematics like proving Egorov's theorem or finding phase transitions in random networks.


I am a PhD educated mathematician working in research at a major university.


Various research journals of mathematics. Various talks & presentations (some short, some long), about either interesting classical material or about research work.

BA mathematics & physics, PhD mathematics from a top 20 US school.

Awards and Honors
Various honors related to grades, various fellowships & scholarships, awards for contributions to mathematics and education at my schools, etc.

Past/Present Clients
In the past, and as my career progresses, I have worked and continue to work as an educator and mentor to students of varying age levels, skill levels, and educational levels.

©2016 All rights reserved.