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: Can (1-cos(npi))=(-1)^(n+1)?

  1. Dec 9, 2011 #1
    1. The problem statement, all variables and given/known data

    To find the Fourier series for

    0, -2<x<0
    x, 0≤x<1
    1, 1≤x<2

    2. Relevant equations

    f(x)=a_0/2+Ʃ(from n=0 to ∞) (a_n*cos(npix/p) + b_n*sin(npix/p))

    3. The attempt at a solution

    So p=2, interval=[-2,2]



    Here is my problem:

    did the exercise twice and keep getting:


    I have the solution:


    I know cos(npi)=(-1)^n

    and I've been told sin(npi)=(-1)^(n+1)

    My steps:

    1) b_n=1/2[∫(from 0 to 1) x*sin(npix/2)dx + ∫(from 1 to 2) sin(npix/2)dx]

    2) integration by parts for 1st integral and subsequent integration:

    → b_n=1/2[-(2x/npi)cos(npix/2)|(0 to 1) + (4/n^2pi^2)sin(npix/2)|(0 to 1) - (2/npi)cos(npix/2)|(1 to 2)]

    3) I am left with:

    b_n=1/2[(2/npi) + (4/n^2pi^2)sin(npi/2) - (2/npi)cos(npi)

    after regrouping is where (1-cos(npi)) comes from.

    Thus original question is:

    Can (1-cosnpi)=(-1)^(n+1)? or am I mistaken somewhere?

    Thank you
    Last edited: Dec 9, 2011
  2. jcsd
  3. Dec 9, 2011 #2


    User Avatar
    Science Advisor

    I don't know where you got "[itex]sin(n\pi)= (-1)^{n+1}= 1- cos(n\pi)[/itex]". None of those equalities is correct.

    [itex]sin(n\pi)= 0[/itex] for all n, not a power of -1. [itex]cos(n\pi)= -1[/itex] if n is odd, 1 if n is even so [itex]cos(n\pi)= (-1)^n[/itex] and [itex]1+ cos(n\pi)[/itex] is 2 if n is even, 0 if n is odd.
  4. Dec 9, 2011 #3
    As I said, I "know cos(npi)=(-1)^n and I was told sin(npi)=(-1)^(n+1)" so I believe you that it is wrong. I imagine that that someone wanted to say sin(npi/2)=(-1)^(n+1)???

    As for the "equalities", I was wondering, not stating, seeing as the equations "looked" similar.

    Therefore, if all this is wrong, would it be possible for you to help me figure out where I went wrong?

    I think it safe to say I will remove that "P.S." from the question so as not to confuse...
    Last edited: Dec 9, 2011
  5. Dec 9, 2011 #4


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Why would you imagine that? Try it with n = 0 or 2.
  6. Dec 9, 2011 #5


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Your an is correct but I think your a0 should be -5/4.
    I didn't check your remaining steps, but what about the integral from -2 to 0?
    Last edited: Dec 9, 2011
  7. Dec 9, 2011 #6
    The reason I "imagine" that is because I had some sort of logic in my head that said that if
    sin(npi/2)=something, when n is an odd number than n+1 was gonna give me an odd number...
    I see as I try to explain that it doesn't always work. But I had "sin(npi)=(-1)^(n+1) in my class notes which is a mistake and probably didn't help my understanding...

    The thing is that in my school book. It keeps telling me things like "=(-1)^(n+1).
    And a similar problem to my initial question just popped up again:

    Expand f(x)=x, -2<x<2
    x = Odd f(x)
    b_n = ∫ (0 to 2) x*sin(npix/2)dx

    When I do this, I get (-4/npi)cos(npi)

    and it gives me (4/npi)(-1)^(n+1)

    as in original post, I was getting: (1-cos(npi)) and the answer was (-1)^(n+1)

    So is it when there is a negative in front that I have to do ^(n+1)???

    Could someone please respond to the actual question about where (-1)^(N+1) comes from...
    Last edited: Dec 9, 2011
  8. Dec 9, 2011 #7
    @ LCKurtz
    The answer in the book is 3/8 for a_0/2
    And the -2 to 0 disappears 'cause the function is 0 on that interval
    P.S. Thank you for trying to help me with the real question
  9. Dec 9, 2011 #8


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    This is right.

    This is wrong. You're making another error somewhere, which is causing you to mistakenly think that [itex]1-\cos n\pi = (-1)^{n+1}[/itex] must hold. You need to turn this around. The latter equality is obviously wrong, which means you must have made a mistake somewhere, so you should be looking for it.

    It seems a bit strange that you're struggling with basic algebra when you're learning about Fourier series. There's nothing mysterious going on here:
    [tex]-(-1)^n = (-1)(-1)^n = (-1)^{n+1}[/tex]
  10. Dec 9, 2011 #9
    My brain works in VERY mysterious ways, but thank you. That does clear things up.
    I am working hard on trying to figure out where my mistake is.
    I get confused when sometimes the answer is (-1)^(n+1)
    and in other cases like:

    b_n=(2/pi)∫(0 to pi)sin(nx)dx

    I get (2/npi)(1-cos(npi))and the answer in that case is (2/pi)(1-(-1)^n)/n

    instead of (2/pi)(1+(-1)^(n+1))/n
    Last edited: Dec 9, 2011
  11. Dec 9, 2011 #10


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    For some reason I had written the function as -2 on that interval. Guess my eyeball fell on the -2 instead of the 0.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook