1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Fourier series (cosine series expansion?)

  1. Sep 16, 2008 #1
    Find the Fourier series of the 2Pi-periodic function

    {0 , Abs(x) <= Pi/2
    {Abs(x)-Pi/2, Pi/2 < Abs(x) <= Pi

    My attempt at a solution

    I have sketched the function... It equals zero between -Pi/2 and Pi/2 and it equals Pi/2 at -Pi and Pi. Then the pattern is repeated with peaks at +/- Pi, 3Pi, 5Pi...

    To find the Fourier series I have to identify a_0, a_n and b_n.
    Here, b_n = 0 because the function is even, right?

    a_0= (1/(2Pi))*AUC = Pi/8 (AUC=area under curve from -Pi to Pi (i.e. one period))

    then a_n = (1/Pi)*integral_-Pi_Pi f(x)*cos(nx) dx= (2/Pi)*integral_0_Pi f(x)*cos(nx) dx (because even function)
    = (2/Pi)integral_0_Pi (Abs(x)-Pi/2))*cos(nx) dx = (integration by parts) = (2/(nPi))[(Abs(x)-Pi/2)*sin(nx)] (evaluate for x=Pi minus for x=Pi/2, because the function is zero anyway between 0 and Pi/2 --> integral is zero) - (2/(nPi))*integral_Pi/2_Pi 1*sin(nx) dx

    [(Abs(x)-Pi/2)*sin(nx)] (evaluate for x=Pi minus for x=Pi/2) I think is zero so just the last expression left, but I just can't figure it out.

    Sorry for the format of this post, I can hardly figure out what I wrote myself so it's a miracle if somebody can help me out of this :) I now saw the "insert image" feature, which will be my choice for the maths next time I post :)
  2. jcsd
  3. Sep 17, 2008 #2
    You do need to write it out more neatly, I can't wrap my head around it. At the very least insert some newlines now and then. I worked through the problem and it seemed to just involve some integration by parts and trigonometric integrations. Here are some of my steps:

    [tex] f(x)=\frac{a_0}{2}+\Sigma^{\infty}_{n=1}a_{n}cos(nx) [/tex]

    [tex] a_n = \frac{1}{\pi}\int^{\pi}_{-\pi}f(x)cos(nx)dx [/tex]

    For n>0:

    [tex] a_n = \frac{2}{\pi}\int^{\pi}_{\pi/2}(x-\frac{\pi}{2})cos(nx)dx [/tex]

    Some terms canceled each other out, and to present the final answer concisely I considered the cases of values of n modulo 4.
  4. Sep 17, 2008 #3
    Hope it is easier to follow now with the attached image.
    Did you get the same expression for a_n?

    Indeed I have to express the a_n consisely...
    I know cos(n*Pi) = (-1)^n
    but what about the other, cos(n*Pi/2)? Let's call this "???" for now. I have figured out that
    n=1 --> 0
    n=2 --> -1
    n=3 --> 0
    n=4 --> 1
    n=5--> 0
    and so on...

    Does this mean that the a_n are different depening on whether n is odd or even?

    For odd n: a_n = (2/(Pi*n^2)) * (-1)^n

    And for even n: a_n = (2/(Pi*n^2)) * ((-1)^n - "???"))

    Then I could of course evaluate a_1, a_2, a_3, ... etc. one by one, but it feels like there is some trick to get the a_n general and good looking...

    Edit: Evaluated and plotted the first few terms, it looks "ok" I think? So maybe the calculations are correct so far.
    I attach an picture of the Fourier series with those evaluated terms.
    I noted that a_4, a_8, a_12 etc == 0

    Attached Files:

    Last edited: Sep 17, 2008
  5. Sep 17, 2008 #4
    I can't see your attachments yet because they're awaiting approval, but it looks like you're nearly there. The values of a_n are periodic in n with a period of 4, so essentially you need to find a_0, a_1, a_2 and a_3, and then they repeat. I'll post up my answer shortly.
  6. Sep 18, 2008 #5
    I got:

    a_n =

    0 when n=0 (mod 4)

    [tex]-\frac{2}{\pi n^2}[/tex] when n=1,3 (mod 4)

    [tex]\frac{4}{\pi n^2}[/tex] when n=2 (mod 4)
  7. Sep 18, 2008 #6
    Sweet :) Then I was right! But still, is there some tricky trick so that you can write it more beautiful as
    f(x)=\frac{a_0}{2}+\Sigma^{\infty}_{n=1}a_{n}cos(n x)
    in one expression? Not "a_n ==, if n=1,3,5,7,9,11,13,15.... if n=2,6,10,14,18...if n=0,4,8,12,16..."

    Maybe the follow up question gives a clue?
    It looks like this:

    Use the result (from problem above) to calculate the sum
  8. Sep 18, 2008 #7
    Yes, you could split it into two series for each case where the coefficients are non-zero:

    [tex] f(x) = \frac{\pi}{4} + \Sigma^{\infty}_{k=0}(-\frac{2}{\pi(2k+1)^2})cos([2k+1]x) + \Sigma^{\infty}_{k=0}(\frac{4}{\pi(4k+2)^2})cos([4k+2]x)[/tex]

    From this form, it should be evident how to solve the next question.
  9. Sep 18, 2008 #8
    Thanks a lot! I have kept struggling for a while now, it looks easy but I feel stupid :(

    First, a_0/2 in your last answer is Pi/4, but I have Pi/8 in my calculations..

    Then the sum... That way of expressing it made it much more clear; I think that the approach is to eliminate the "last" sum

    which means that cos([4k+2]x)=0, which corresponds to [4k+2]x=Pi/2 ==> x = Pi/4

    So I take x = Pi/4
    f(\frac{\pi}{4})= 0[/tex]

    but then I am just getting confused by the [tex]
    [/tex] which is sqrt(1/2) or -sqrt(1/2) for different k's....
  10. Sep 18, 2008 #9
    You're making it more complicated than it has to be... notice that the coefficients of the second series are 1/(4k+2)^2 = 1 / 4(2k+1)^2. So you don't have to eliminate the second series. The coefficients inside the cosines are respectively odd multipliers of x and even multipliers of x. What value of x would give a constant value for each cosine, so that you could take the cosines outside the series?

    Regarding a_0, you used the formula a_0= (1/(2Pi))*AUC. I believe that should be a_0= (1/(Pi))*AUC, which gives my answer.
  11. Sep 19, 2008 #10
    Thanks a lot!! I thought of x=0 before, but I could not find that way of rewriting the second sum!
    Back to a_0... I think that the "sum" should be pi^2/8 which goes together with "my" a_0...

    Here is how I did it

    a_0 = \frac{1}{\pi}\int^{-\pi}_{\pi}f(x)dx =\frac{2}{\pi}\int^{\pi/2}_{\pi}(x-\frac{\pi}{2})dx =\frac{\pi}{4}
  12. Sep 19, 2008 #11
    You're right, the answer is [tex]\frac{\pi^2}{8}[/tex]. I forgot to divide a_0 by two :P
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook