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 for (sin(x))^2

  1. Apr 27, 2005 #1


    User Avatar

    Hey guys i was working on an algorithm for one of my CS classes that included working out the fourier series for the function f(x) = (sin(x))^2. it's been a few years since i've done anything like this, so I did some googling to refresh my memory of how to determine the fourier coefficients, and after some integrals and calculations, came up with:

    f(x) = (1/2) + (1/2)cos(2x) + (1/2)sin(2x)

    I graphed this along with f(x) = (sin(x))^2 and it looked different from it. I was wondering if someone can give me a correct answer to compare with what i came up with, or help with giving me a rough walkthru of the process. Thanks again.
  2. jcsd
  3. Apr 27, 2005 #2


    User Avatar
    Homework Helper

    The answer you got is incorrect.

    The two identities you need are:

    (sin(x))^2 + (cos(x))^2 =1


    cos(2x) = 2(cos(x))^2 - 1

    Use both of these to solve for (sin(x))^2 in terms of cos(2x).
  4. Apr 28, 2005 #3


    User Avatar
    Science Advisor
    Homework Helper

    One thing you should always check is to see if the symmetry of the component functions matches the symmetry of the function you are decomposing. The function you started with is an even function

    f(-x) = f(x)

    All the component functions must also be even functions. One of yours is not. You can often take advantage of symmetry to eliminate performing many of the integrals that have to be calculated to decompose a function.
  5. Apr 28, 2005 #4
    No integrals at all required here. You can either use the identities learningphysics gave, or use the exponential form of sine:

    [tex]\sin{x} = \frac{e^{ix}-e^{-ix}}{2i}[/tex]

    and just square it (and then convert back to sines and cosines).
  6. Apr 28, 2005 #5


    User Avatar
    Science Advisor
    Homework Helper

    That is true. My comment about integrals was a general comment about Fourier series where one often does have integrals to perform, and taking advatange of the symmetry can save work.
  7. Apr 28, 2005 #6
    Indeed, I wasn't criticizing your reply at all :smile:

    If you want to find the fourier series for x^n, for example, that symmetry can help a lot!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook