# Fourier Series for |cos(x)|

#### SVXX

Question - Find the Fourier series for f(x) = |cos(x)| in the interval (-π, π).
Right, I attempted the question and the integration that followed. I'm having trouble in the integration itself..
Firstly I found that f(x) is an even function, so the sine term(bn) of the Fourier expansion would be zero and that I can use a property of integration to write

as
and similarly so for an.

I computed a0 to be zero, but the trouble is, I'm getting an to be zero too, and if that is so, there will be no Fourier series!! Could someone please point out my mistake?

Last edited by a moderator:
Related Calculus and Beyond Homework News on Phys.org

#### uart

Hints :

1. One period of |cos(x)| extends from -pi/2 to pi/2. Check your limits.

2. Beware divide by zero.

#### SVXX

Thanks for the hints...I figured out what I was doing wrong in the integration. I had to break the intervals at pi/2 as |cos(x)| = cos(x) for 0 < x < pi/2 and = - cos(x) for pi/2 < x < pi.
I referred a popular book from the college library today which proved me correct. But what I don't understand is the last part of the solution that was given in that book...it stated that sin(n+1)pi/2 = cos(n)pi/2....how is this so?

#### uart

Thanks for the hints...I figured out what I was doing wrong in the integration. I had to break the intervals at pi/2 as |cos(x)| = cos(x) for 0 < x < pi/2 and = - cos(x) for pi/2 < x < pi.
I referred a popular book from the college library today which proved me correct. But what I don't understand is the last part of the solution that was given in that book...it stated that sin(n+1)pi/2 = cos(n)pi/2....how is this so?
The complementary relation between sin and cos tells us that sin x = cos (pi/2 - x) and visa versa.

So sin (n+1)pi/2 = cos (pi/2 -(n+1)pi/2) = cos (-n pi/2).

Now since cos is an even function then cos (-n pi/2) = cos (n pi/2).

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving