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: Solving the coefficients of fourier series

  1. May 31, 2009 #1
    1. The problem statement, all variables and given/known data
    f(x) = |cos x| if -[tex]\pi[/tex] [tex]\leq[/tex] x [tex]\leq\[/tex] [tex]\pi[/tex]

    The fourier series answer we should end up with is the following:

    2/[tex]\pi[/tex] - 4/[tex]\pi[/tex][tex]\sum[/tex][tex]\frac{-1^{k}}{(2k)^{2}-1}[/tex]cos(2kx)

    where for the summation, k = 1 and goes to infinity.

    What I need to do is to actually go an solve for the fourier series and show that we get the same series when we derive it given f(x)

    2. Relevant equations

    f(x) = [tex]a_{0}[/tex] + [tex]\sum[/tex][tex]a_{k}[/tex]coskx + [tex]b_{k}[/tex]sinkx where k =1 and goes to infinity

    [tex]a_{0}[/tex] = 1/2[tex]\pi[/tex][tex]\int[/tex]f(x)dx

    [tex]a_{k}[/tex] = 1/[tex]\pi[/tex][tex]\int[/tex]f(x)coskxdx

    [tex]b_{k}[/tex] = 1/[tex]\pi[/tex][tex]\int[/tex]f(x)sinkxdx

    where we integrate all the above integrals from -[tex]\pi[/tex] to [tex]\pi[/tex]

    Lastly, the properties of even functions are also considered.

    3. The attempt at a solution

    So, to start out, since [tex]b_{k}[/tex] = 1/[tex]\pi[/tex][tex]\int[/tex]f(x)sinkxdx, cosx is even and the sinkx is odd,
    [tex]b_{k}[/tex] = 0

    [tex]a_{0}[/tex] = 1/2[tex]\pi[/tex][tex]\int[/tex]f(x)dx

    due to the properties of an even function I have:
    = 1/[tex]\pi[/tex][tex]\int[/tex]f(x)dx integrated from 0 to [tex]\pi[/tex]

    = 1/[tex]\pi[/tex]([tex]\int[/tex]cosxdx + [tex]\int[/tex]-cosxdx)
    where the first integral is from 0 to [tex]\pi[/tex]/2} and the second integral is from [tex]\pi[/tex]/2 to [tex]\pi[/tex],

    solving this gives me

    [tex]a_{0}[/tex] = 1/[tex]\pi[/tex](1 - (-1)) = 2/[tex]\pi[/tex]

    For [tex]a_{k}[/tex]:

    using even function properties again I have,
    [tex]a_{k}[/tex] = 2/[tex]\pi[/tex][tex]\int[/tex]f(x)coskxdx
    = 2/[tex]\pi[/tex][tex]\int[/tex]cosx*coskx dx
    where integral goes from 0 to [tex]\pi[/tex].

    Maybe I'm just rusty with integration, but I just want to make sure I'm heading into the right direction and how do I integrate that? ( meaning [tex]\int[/tex]cosx*coskx dx)

  2. jcsd
  3. May 31, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper

    Last edited by a moderator: Apr 24, 2017
  4. May 31, 2009 #3
    Last edited by a moderator: Apr 24, 2017
  5. Jun 1, 2009 #4
    sorry for double post but this is what I got after integrating,


    does that look like I'm headed in the right direction? Thanks
  6. Jun 2, 2009 #5


    User Avatar
    Science Advisor
    Homework Helper

    Hi jianxu! :smile:

    (what happened to that π i gave you? :confused:)
    It's a little difficult to check when you haven't shown your working, but that looks roughly right, except I don't see where the (1/2) comes from.
  7. Jun 2, 2009 #6
    woops, here's my work:P

    so after the trig identity, I have for [tex]a_{k}[/tex]:

    [tex]a_{k}[/tex] = 1/[tex]\pi[/tex]*([tex]\int[/tex]cos(kx+x)dx+[tex]\int[/tex]cos(kx-x)dx) where we integrate from 0 to [tex]\pi[/tex]

    now for each integral, I split it in two where we integrate
    [tex]\int[/tex](cos(k[tex]\pm[/tex]1)x)dx) where this integral is evaluated from 0 to [tex]\pi[/tex]/2

    then the next integral would be [tex]\int[/tex](-cos(k[tex]\pm[/tex]1)x)dx) from [tex]\pi[/tex]/2 to [tex]\pi[/tex].

    I split it due to the function being |cosx|

    so after integrating the four terms I get,
    =(1/[tex]\pi[/tex])*(sin(k[tex]\pm[/tex]1)x/(k[tex]\pm[/tex]1) (evaluated from 0 to [tex]\pi[/tex]/2) + -sin(k[tex]\pm[/tex]1)x/(k[tex]\pm[/tex]1)) (evaluated from [tex]\pi[/tex]/2 to [tex]\pi[/tex])

    after evaluating I get,
    =(1/[tex]\pi[/tex])*(sin((k+1)*[tex]\pi[/tex]/2)/(k+1)+sin((k+1)*[tex]\pi[/tex]/2)/(k+1) + sin((k-1)*[tex]\pi[/tex]/2)/(k-1)+sin((k-1)*[tex]\pi[/tex]/2)/(k-1))

    I simplified it because there are doubles and so:

    [tex]a_{k}[/tex] = (2/[tex]\pi[/tex])*(sin((k+1)*[tex]\pi[/tex]/2)/(k+1)+ sin((k-1)*[tex]\pi[/tex]/2)/(k-1))

    (I found a mistake I had made while writing my work down here :P....was (8/[tex]\pi[/tex]) before, but it's actually (2/[tex]\pi[/tex]))

    so that's my work for [tex]a_{k}[/tex]

    please let me know if that looks good? :P thanks so much!
  8. Jun 2, 2009 #7


    User Avatar
    Homework Helper
    Gold Member

    Yikes....what an eyesore!:yuck:

    You need to work on your LaTeX a little. For starters, it's much easier to read if you write entire expressions in between a single set of tex tags. Also, you can use itex & /itex instead of tex & tex when you want an expression to occur on the same line as some written text and not look out of place. Click on the edited quote below to see the code used to make your last post readable:

    Splitting up the integral into two intervals to deal with the absolute value is the right idea, but to correctly apply the idea you need to split it up before you use the trig identity:

    [tex]a_k= \frac{1}{\pi} \int_{-\pi}^{\pi} |\cos{x}|\cos{kx} dx= \frac{2}{\pi} \int_{0}^{\pi} |\cos{x}|\cos{kx} dx =\frac{2}{\pi} \left( \int_0^{\pi/2} \cos{x}\cos{kx} dx - \int_{\pi/2}^{\pi} \cos{x}\cos{kx} dx \right)[/tex]

    However, you seem to be doing it correctly in your head, because your separated integrals are correct.

    This looks correct to me!:smile:

    You can however simplify it a little more by putting each term over the common denominator [itex](k+1)(k-1)[/itex] and using the trig identity [itex]\sin (a \pm b) =\sin(a)\cos(b) \pm \cos(a)\sin(b)[/itex]

    You should get something like

    [tex]a_k=\frac{-4\cos\left( \frac{k\pi}{2}\right)}{(k^2-1)\pi}[/tex]

    which is only non-zero for even values of [itex]k[/itex].
    Last edited: Jun 2, 2009
  9. Jun 2, 2009 #8
    Thanks! yea the quotient tag was giving me errors before for some reason...said like invalid image or something so I took all the quotient stuff out. Sorry for the poor post:(

    Thanks again, tiny-tim and gabbagabbahey! :)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook