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

  1. May 27, 2010 #1
    1. The problem statement, all variables and given/known data[/b
    expand the function in Fourier series[tex]f(x)= x^2+xcosx[/tex]
    I divided the function in separate part and try to expand it in Fourier series separately
    i have started with
    [tex]x^2[/tex]
    [tex]a_{0}= \frac{1}{2\pi}\int_{-\infty}^{\infty}x^2dx=\frac{\pi^2}{3}[/tex]

    [tex]a_{n}= \frac{2}{\pi}\int_{0}^{\pi}x^2cosnxdx=\frac{2}{\pi}[\frac{x^2}{n}sinnx-2\int_{0}^{\pi}x\frac{sinx}{n}]dx=\frac{2}{\pi}[\frac{2\pi(-1)^n}{n^2}]=4\cdot\frac{(-1)^n}{n^2}\Rightarrow x^2= 4 \sum_{n=1}^{\infty}\frac{(-1)^n}{n^2}cosnx[/tex]
    [tex]x^2[/tex] if even function then[tex]b_{n}=0[/tex]

    function f(x)=x is an odd function [tex]a_{n}= 0[/tex]
    [tex]b_{n}= \frac{2}{\pi}\int_{0}^{\pi}xsinnxdx=\frac{2}{\pi}[-\frac{x}{n}cosnx+\frac{1}{n}\int_{0}^{\pi}cosnxdx]=\frac{2}{\pi}[-\frac{\pi}{n}(-1)^n]=2 \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n}sinnx[/tex]
    is this correct so far?
    can someone help me and show me how to calculate the rest? I mean how to connect everything together with cosx?





    2. Relevant equations



    3. The attempt at a solution
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
    1. The problem statement, all variables and given/known data



    2. Relevant equations



    3. The attempt at a solution
     
    Last edited: May 27, 2010
  2. jcsd
  3. May 27, 2010 #2

    Cyosis

    User Avatar
    Homework Helper

    It would be handy if you tell us what the period of that function needs to be. From the looks of it you want it to have a period of [itex]2\pi[/itex].

    You're integrating the wrong function in every integral. You're supposed to integrate [itex]f(x)=x^2+x\cos x[/itex]. Secondly some of your integrands are odd, therefore you can't just say that evaluating the integral between -pi and pi is the same as 2 times the integral between 0 and pi.
     
  4. May 27, 2010 #3
    for [tex]|x|<\pi[/tex]
    my teacher did it in almost the same way but at the end he did something else with the xcosx part......
     
  5. May 27, 2010 #4

    Cyosis

    User Avatar
    Homework Helper

    It doesn't matter what your teacher did. What does matter is that you're doing it wrong. I suspect that your teacher makes good use of his knowledge how even and odd functions behave when integrated over a symmetrical interval. It is not smart to try and copy a method that you don't understand.

    For example you get the correct answer for [itex]a_0[/itex] by pure coincidence. In fact your integral for [itex]a_0[/itex] doesn't even converge.

    This is the integral you should have calculated:

    [tex]
    a_0=\frac{1}{2 \pi}\int_{-\pi}^\pi f(x)dx[/tex]
     
  6. May 27, 2010 #5
    well i calculated this integral once again and i get [tex] \frac{\pi^2}{3}[/tex]
     
  7. May 27, 2010 #6

    Cyosis

    User Avatar
    Homework Helper

    That is correct, but you calculated a different integral in your OP, which had the same answer by coincidence.

    This is why it gave the same answer.

    [tex]
    \begin{align*}
    a_0 & =\frac{1}{2 \pi}\int_{-\pi}^\pi x^2+x \cos x dx \\
    & = \underbrace{\frac{1}{2 \pi} \int_{-\pi}^\pi x^2 dx}_\text{even integrand}+\underbrace{\frac{1}{2 \pi}\int_{-\pi}^\pi x \cos x dx}_\text{odd integrand}
    \end{align*}
    [/tex]

    The second integral goes to zero.
     
    Last edited: May 27, 2010
  8. May 27, 2010 #7
    okej, i see it now.
    but how to calculate coefficients [tex] a_{n} , b_{n} [/tex] then?
    the problem is that i am not able to say whether the function is odd or even.....[tex] x^2[/tex] is even but [tex] xcosx[/tex] is odd.....but the whole function?
     
  9. May 27, 2010 #8

    Cyosis

    User Avatar
    Homework Helper

    You can calculate the other coefficients in a similar way. Read post #6 again, because I just fixed the latex.

    If a function is even then [itex]f(-x)=f(x)[/itex]. If a function is odd then [itex]f(-x)=-f(x)[/itex]. You can use this to check that f(x) is neither even nor odd.
     
    Last edited: May 27, 2010
  10. May 27, 2010 #9
    okej
    so i started with [tex] a_{n}=\frac{1}{\pi}\int_{-\pi}^{\pi}x^2cos(nx)dx+\frac{1}{\pi}\int_{-\pi}^{\pi}xcosxcos(nx)dx[/tex]

    the first integral gave me
    [tex] \frac{2}{n^2}[xcos(nx)]_{-\pi}^{\pi}]=\frac{4\pi}{n^2}(-1)^n[/tex] hope its correct
    how would you calculate the second one?
     
  11. May 27, 2010 #10

    Cyosis

    User Avatar
    Homework Helper

    The [itex]\pi[/itex] shouldn't be there. As for the second integral. Is the integral even or odd?
     
  12. May 27, 2010 #11
    i would say the second integral is odd, should it give 0 then?
    is the final substitution wrong in the first integral? whe [tex] \pi[/tex] should not be there?
     
  13. May 27, 2010 #12

    Cyosis

    User Avatar
    Homework Helper

    Correct. The integrand is odd, and the integration interval is symmetric therefore the integral is 0. You have a [itex]\pi[/itex] in there because you forgot the factor [itex]1/ \pi[/itex] in front of the integral.

    Notice how you got the same answer again, this time however without luck.
     
  14. May 27, 2010 #13
    oh....again, right

    [tex] \frac{2}{n^2}[xcos(nx)]_{-\pi}^{\pi}]=\frac{4\pi}{n^2}(-1)^n[/tex]

    [tex] a_{n}=\frac{4}{n^2}(-1)^ncosnx[/tex]

    [tex]b_{n}= \frac{1}{\pi}\int_{-\pi}^{\pi}x^2sin(nx)dx+ \frac{1}{\pi}\int_{-\pi}^{\pi}xsin(nx)cos(nx)=
    \frac{1}{\pi}[-\frac{x^2}{n}cosnx+\frac{2x}{n^2}sinnx+\frac{2}{n^3}cosnx]_{-\pi}^{\pi}[/tex]
    is this correct so far?
    i get from the first integral 0.......the second integrand is even so it will give 0
     
    Last edited: May 27, 2010
  15. May 27, 2010 #14

    Cyosis

    User Avatar
    Homework Helper

    Why did you suddenly put a cosine in your expression for [itex]a_n[/itex]? It shouldn't be there.

    The first integral is zero yes, why? The second integral is even yes, but that does not mean the integral is zero.
     
  16. May 27, 2010 #15
    okej, I just got quite confused....I must admit that I am a real beginner when it comes to Fourier analysis...all this is quite difficult;)
    i just calculated the value for the first integral
    [tex]b_{n}= \frac{1}{\pi}[-\frac{x^2}{n}cosnx+\frac{2x}{n^2}sinnx+\frac{2}{n^ 3}cosnx]_{-\pi}^{\pi}=\frac{1}{\pi}[-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n-(-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n)]=}[-\frac{\pi^2}{n}(-1)^n+\frac{2}{n^3}(-1)^n+\frac{\pi^2}{n}(-1)^n-\frac{2}{n^3}(-1)^n=0[/tex]

    you are right with the second integral, i mixed it up with an odd function and I assumpted it should give 0....
    however i do not have any clue how do solve the 2nd integral...
     
  17. May 27, 2010 #16

    Cyosis

    User Avatar
    Homework Helper

    The first integral is odd so you could have set it to zero saving you a lot of trouble.

    For the second integral use the well known double angle formula [itex]\sin 2x=2\sin x \cos x[/itex].
     
    Last edited: May 27, 2010
  18. May 27, 2010 #17
    okej, i used it and i got
    [tex] \frac{1}{2\pi}\int_{-\pi}^{\pi}xsin(2nx)dx=\frac{1}{2\pi}[-\frac{x}{2n}cos(2nx)+\frac{1}{4n^2}sin(2nx)]_{-\pi}^{\pi}=\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^n-\frac{\pi}{2n}(-1)^n][/tex]
     
  19. May 27, 2010 #18

    Cyosis

    User Avatar
    Homework Helper

    You're almost there.

    [tex] \frac{1}{2\pi}\int_{-\pi}^{\pi}xsin(2nx)dx
    =
    \underbrace{\frac{1}{2\pi}[-\frac{x}{2n}cos(2nx)+\frac{1}{4n^2}sin(2nx)]_{-\pi}^{\pi}}_\text{correct}
    =\underbrace{\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^n}_\text{missing a factor}-\underbrace{\frac{\pi}{2n}(-1)^n}_\text{wrong}][/tex]

    Also [itex]1^n=...[/itex]?
     
  20. May 27, 2010 #19
    should it be [tex] 2n[/tex]
    hm....the term with sin2nx will give 0 right?
    for the rest i get :
    [tex]{\frac{1}{2\pi}[-\frac{\pi}{2n}(1)^{2n}+\frac{\pi}{2n}(-1)^{2n}][/tex]
    but according to what you have written it is still wrong,
     
  21. May 27, 2010 #20

    Cyosis

    User Avatar
    Homework Helper

    You found the correct primitive. Now all you have to do is plug in the limits of integration. You're nearly there, but don't get sloppy with simple arithmetic.

    Yes the [itex]\sin 2 n \pi [/itex] term is zero for every [itex]n \in \mathbb{Z}[/itex]. Don't forget to answer my question in post #18.
     
    Last edited: May 27, 2010
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook