Solving the coefficients of fourier series

jianxu
Messages
91
Reaction score
0

Homework Statement


f(x) = |cos x| if -\pi \leq x \leq\ \pi

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

2/\pi - 4/\pi\sum\frac{-1^{k}}{(2k)^{2}-1}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)

Homework Equations



f(x) = a_{0} + \suma_{k}coskx + b_{k}sinkx where k =1 and goes to infinity

a_{0} = 1/2\pi\intf(x)dx

a_{k} = 1/\pi\intf(x)coskxdx

b_{k} = 1/\pi\intf(x)sinkxdx

where we integrate all the above integrals from -\pi to \pi

Lastly, the properties of even functions are also considered.

The Attempt at a Solution



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

for
a_{0} = 1/2\pi\intf(x)dx

due to the properties of an even function I have:
= 1/\pi\intf(x)dx integrated from 0 to \pi

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

solving this gives me

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

For a_{k}:

using even function properties again I have,
a_{k} = 2/\pi\intf(x)coskxdx
= 2/\pi\intcosx*coskx dx
where integral goes from 0 to \pi.

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 \intcosx*coskx dx)

Thanks
 
Physics news on Phys.org
Last edited by a moderator:
sorry for double post but this is what I got after integrating,

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

does that look like I'm headed in the right direction? Thanks
 
Hi jianxu! :smile:

(what happened to that π i gave you? :confused:)
jianxu said:
sorry for double post but this is what I got after integrating,

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

does that look like I'm headed in the right direction? Thanks

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.
 
woops, here's my work:P

so after the trig identity, I have for a_{k}:

a_{k} = 1/\pi*(\intcos(kx+x)dx+\intcos(kx-x)dx) where we integrate from 0 to \pi

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

then the next integral would be \int(-cos(k\pm1)x)dx) from \pi/2 to \pi.

I split it due to the function being |cosx|

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

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

I simplified it because there are doubles and so:

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

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

so that's my work for a_{k}

please let me know if that looks good? :P thanks so much!
 
Yikes...what an eyesore!

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:


jianxu said:
woops, here's my work:P

so after the trig identity, I have for a_{k}:

a_{k} = \frac{1}{\pi} \left( \int_{0}^{\pi} \cos (kx+x) dx + \int_0^{\pi} \cos(kx-x) dx \right)


now for each integral, I split it in two where we integrate

\int_{0}^{\pi /2} \cos (kx\pm x) dx

then the next integral would be

\int_{\pi /2}^{\pi} -\cos (kx\pm x) dx


I split it due to the function being |cosx|

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:

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)

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

so after integrating the four terms I get,

a_k= \frac{1}{\pi} \left( \left[ \frac{\sin ((k \pm 1)x)}{k \pm 1} \right]_0^{\pi/2} - \left[ \frac{\sin ((k \pm 1)x)}{k \pm 1} \right]_{\pi/2}^{\pi} \right)

after evaluating I get,

a_k =\frac{1}{\pi} \left( \frac{\sin \left( \frac{(k+1)\pi}{2} \right)}{k+1} + \frac{\sin \left( \frac{(k+1)\pi}{2}\right)}{k+1} + \frac{\sin \left(\frac{(k-1)\pi}{2}\right)}{k-1}+\frac{\sin \left( \frac{(k-1)\pi}{2}\right)}{k-1} \right)

I simplified it because there are doubles and so:

a_{k}=\frac{2}{\pi} \left( \frac{\sin \left( \frac{(k+1)\pi}{2} \right)}{k+1} +\frac{\sin \left( \frac{(k-1)\pi}{2}\right)}{k-1} \right)

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

so that's my work for a_{k}

please let me know if that looks good? :P thanks so much!

This looks correct to me!:smile:

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

You should get something like

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

which is only non-zero for even values of k.
 
Last edited:
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! :)
 
Back
Top