# Fourier Coefficients of an Even Function

1. Jan 28, 2012

### JackFlash

1. The problem statement, all variables and given/known data
For a given periodic function F(x), the coefficients An of its Fourier expansion can be found using the formulas (Form1) and (Form2). Consider a periodic square pulse and verify that the Fourier coefficients are as claimed:
An =($\frac{2}{πn}$)sin($\frac{πan}{λ}$)
for n≥1 and that
A0 = $\frac{a}{λ}$

(the height of the pulse is 1, the width is a)

2. Relevant equations
(Form1): An = $\frac{1}{λ}$$\int^{λ}_{0}$ F(x)cos($\frac{2πnx}{λ}$) dx

(Form2): A0 = $\frac{1}{λ}$$\int^{λ}_{0}$ F(x)dx

λ = wavelength

F(x) = Ancos($\frac{2πnx}{λ}$)

3. The attempt at a solution

I've tried to integrate the function F(x) through Form1, but my answer doesn't match the one that it should be. I'm missing a $\frac{1}{πn}$ and my sine value has a 4 in it. Then I tried without the extra cos(~) part in Form1, where ~ is the fraction within the cos (I don't want to rewrite it over and over). I was closer this time, but I couldn't get a λ in the denominator of the fraction within the sine value.
I know these attempts would be better seen had I actually written them out, but I assure you I've tried to integrate according to the functions I'm given to no avail. The textbook doesn't do a good job explaining how to calculate the Fourier coefficients as it just handwaves it under the guise of it being "straightforward". I would appreciate someone pointing me in the right direction, or someone showing what I need to start with to solve this problem as I suspect the given Formulas (Form1 and Form2) only apply to their respective question (they were part of another question, but the question I'm on directed me to them as the formulas to use).

Last edited: Jan 28, 2012
2. Jan 28, 2012

### Mattszo

what textbook do you have?

3. Jan 28, 2012

### JackFlash

Modern Physics for Scientists and Engineers, 2nd Edition.
Authors are John Taylor, Chris D. Zafiratos, and Michael A. Dubson.
Chapter 6, problem #32.

I figure more information than necessary is better than too little information.

4. Jan 28, 2012

### Mattszo

If you have it in your library check out Fourier Series by Tolstov.

For your question you need to know the tricks and play around with it. Here are a few:
$\int^{\pi}_{-\pi}cos(nx)ds$=$\int^{\pi}_{-\pi}sin(nx)dx$=0
$\int^{\pi}_{-\pi}cos^{2}(nx)ds$=$\int^{\pi}_{-\pi}sin^{2}(nx)dx$=$\pi$
or sub pi for anything else
function is even if f(-x)=f(x) such as a cosine function or a sine squared function
function is odd if f(-x)=-f(x) such as fucntion x or a sine function
odd x odd = even x even = evenfucntion
odd x even = odd function
$\int^{λ}_{-λ}(even function)$=2$\int^{λ}_{0}(even function)$
$\int^{λ}_{-λ}(odd function)$=0

f(x)=even=> a$_{n}$=$\frac{2}{\pi}$$\int^{\pi}_{0}f(x)cos(nx)dx$, b$_{n}$=0 .... (series contains only cosines)
f(x)=odd=> b$_{n}$=$\frac{2}{\pi}$$\int^{\pi}_{0}f(x)sin(nx)dx$, a$_{n}$=0 .... (series contains only sines)

Play with those, and alot with trig identities.

GL

Matt

5. Jan 29, 2012

### JackFlash

Alright. Given that the function F(x) is an even function, the equations will only deal with cosines. Using the equation I was given in this book and the equations Matt gave me, my end result is:

My integrals were:
An = $\frac{2}{λ}$$\int$$^{λ}_{0}$cos2($\frac{2πnx}{λ}$)dx
and
An = $\frac{2}{π}$$\int$$^{π}_{0}$cos2($\frac{2πnx}{λ}$)dx

An = $\frac{2}{λ}$+$\frac{2knλ + sin(2knλ)}{4kn}$ = $\frac{4πn * sin(4πn)}{4πn}$
where k =$\frac{2π}{λ}$
Using the equation where instead of lambda we have pi:
An = $\frac{2πkn + sin(2πkn)}{2πkn}$

I thought of using the trig identity where sin(2θ) = 2sin(θ)cos(θ) in both equations, though that just makes things worse and makes me realize it wasn't a good idea to do so. I've also substituted cos2(~) for 1-sin2(~), but that yields the same results after some trig identities.

Using cos(nx) instead of cos($\frac{2πnx}{λ}$) doesn't help either, and I've tried both above integrals with cos to the power of 1 instead of 2 (as my searches on the internet have yielded examples where the questions are solved in such a way), but still no dice. I'm getting:
An = $\frac{2sin(λn)}{λn}$
and
An = $\frac{2sin(πn)}{πn}$
(respective to the above integrals, but using cos(nx) instead of cos2(nx))

So far, I can see that the bottom-most result is closest to the target result, but a λ is missing in the denominator of the sin(~) function. Putting "k" (wave number, 2π/λ) back into the mix gives us the λ in the denominator, but also gives a π2.
I considered that the integral from 0 to λ (or π) is also equal to the twice the integral from 0 to λ/2 (or π/2) and tried to solve it that way, but I still don't get a λ in the denominator of the sin(~) value or I get a π2.

6. Jan 29, 2012

### vela

Staff Emeritus
How did you get this?

Moderator note: I moved this thread to the advanced physics forum since it's not a problem you typically get in an intro physics course.

7. Jan 29, 2012

### JackFlash

Given F(x) = $\sum$$^{∞}_{n=1}$ A$_{n}$cos($\frac{2πnx}{λ}$)
Considering we're solving for A$_{n}$, I figure it couldn't be used in the integral (given in the original post).
So:
An = $\frac{2}{λ}$$\int^{λ}_{0}$ F(x)cos($\frac{2πnx}{λ}$) dx
=
$\frac{2}{λ}$$\int^{λ}_{0}$ cos($\frac{2πnx}{λ}$)*cos($\frac{2πnx}{λ}$) dx

EDIT: I just saw that the original post had coefficients of $\frac{1}{λ}$ and $\frac{1}{π}$ rather than twice that. My mistake.

8. Jan 29, 2012

### vela

Staff Emeritus
I see what you did. One mistake you're making is that you're using the variable n to represent two different quantities. One is the summation index; the other is the index for An. What you should actually have is
$$A_n = \frac{2}{\lambda} \int_0^\lambda \left(\sum_{m=1}^\infty A_m\cos \frac{2\pi mx}{\lambda}\right) \cos \frac{2\pi n x}{\lambda}\,dx$$If you evaluate this integral, you'll just end up with An=An because only n=m term survives — not very useful.

To find the coefficients for a particular F(x), you need to plug the actual function into the formula. In this case, your square wave is described by
$$F(x) = \begin{cases} 1, & 0 \le x \le a \\ 0, & a<x < \lambda\end{cases}$$What do you get for the integral when you plug that in?

Last edited: Jan 29, 2012
9. Jan 29, 2012

### JackFlash

((Just a side note, sorry about posting this thread in the wrong board. I couldn't decide which one to post it in between the Introductory and the Advanced Physics boards and figured it might be upper-level introductory. Thank you for correcting my error. Also, I'll make the equations a bit bigger like how others have. Easier on the eyes.))

Hm. The original integral going from 0 to λ would now be "half" of what it is. So I believe the integral would become:

A$_{n}$ = $\frac{2}{λ}$$\int$$^{a}_{0}$ (1)cos($\frac{2πmx}{λ}$) dx

Solving by hand (and verified with Wolfram Alpha)

sin($\frac{2πma}{λ}$)$/πm$
which is so very close to the answer I'm looking for.
However, a bit of playing around, if I change the integral to:

A$_{n}$ = $\frac{4}{λ}$$\int$$^{a/2}_{0}$ (1)cos($\frac{2πmx}{λ}$) dx

Then I get (verified with Wolfram Alpha)

2sin($\frac{πma}{λ}$)$/πm$
which is the solution. I'm not 100% sure why this works, but I think the reasoning behind it is the same as the reasoning behind using twice the integral from 0 to π/2 of sin(x) instead of the integral from 0 to π. But if that were the case, then the first integral should have worked.

10. Jan 29, 2012

### vela

Staff Emeritus
Whoops, I made a mistake writing down F(x). You wanted an even function, so it should have been
$$F(x) = \begin{cases} 1, & |x|<a/2 \\ 0, & \text{otherwise} \end{cases}.$$ If you plug this function into the general formula for An and then use the fact that F(x) is even, you should get the desired result.