# Answer check for a couple fourier series problems

1. Jun 4, 2009

### jianxu

1. The problem statement, all variables and given/known data
hello, so I've got a couple of problems I need someone to kind of check over because on one of them, I'm not sure if it's correct, and then the other looks to be incorrect.

For problem 1, we have a 2$$\pi$$ periodic function where f(x) = xsin(x)

For the second problem, I need to use sine expansion on f(x) = (1+cos($$\pi$$x))*sin($$\pi$$x)

2. Relevant equations
cosine expansion = $$\left.a_{0}+\sum^{\infty}_{k=1}a_{k}cos(\frac{kx\pi}{p})$$
sine expansion =$$\left.\sum^{\infty}_{k=1}b_{k}sin(\frac{kx\pi}{p})$$

trig identities:
$$\left.2cos(a)sin(b)= sin(a+b) - sin(a-b)$$
$$\left.2sin(a)sin(b)= cos(a-b) - cos(a+b)$$

3. The attempt at a solution

For $$\left.f(x) = xsin(x)$$:
It's an even function so I can use cosine expansion,
so $$a_{0}$$ would be:
$$\left.a_{0}=\frac{1}{\pi}\int^{\pi}_{0}xsin(x)$$
doing integration by parts I get
-xcosx+sinx
after evaluating I get
$$\left.a_{0}=-1$$

Now for $$\left.a_{k}$$:
$$\left.a_{k}=\frac{2}{\pi}\int^{\pi}_{0}xsin(x)cos(kx)$$

using trig identities for sin(x)cos(kx),
2sin(x)cos(kx)=(sin(kx+x)-sin(kx-x))

So now the integral becomes:
$$\left.a_{k}=\frac{1}{\pi}\int^{\pi}_{0}xsin((k+1)x)-xsin((k-1)x)$$

after the integration by parts I have:

$$\left.a_{k}=\frac{1}{\pi}(\frac{-xcos((k+1)x)}{k+1}+\frac{xcos((k-1)x)}{k-1}+\frac{sin((k+1)x)}{\left(k+1\right)^{2}}-\frac{sin((k-1)x)}{\left(k-1\right)^{2}})\right|^{\pi}_{0}$$

now when I evaluate it, the sin terms will be zero and the only terms I get are these two:
$$\left.\frac{-xcos((k+1)x)}{k+1}+\frac{xcos((k-1)x)}{k-1}$$ when evaluated at $$\pi$$
now I simplified it by simply saying the cos will alternate between 1 and -1 depending on k and so I had the two terms reduced to:
$$\left.\frac{-1^{k}\pi}{k+1}+\frac{-1^{k+1}\pi}{k-1}$$

so $$\left.a_{k}=\frac{1}{\pi} * \left(\frac{-1^{k}\pi}{k+1}+\frac{-1^{k+1}\pi}{k-1}\right)$$

so my fourier series will be:
$$\left.-1+\sum^{\infty}_{k=1}(\frac{-1^{k}}{k+1}+\frac{-1^{k+1}}{k-1})cos(\frac{kx\pi}{p})$$

Please let me know if this looks correct Thanks!!!

For the second one, I first simplified f(x) by saying:
$$\left.\left(1+cos\left(\pi *x\right)\right)sin\left(\pi*x)= sin(\pi * x)+ cos(\pi*x)sin(\pi*x)$$

so for the $$b_{k}$$:
$$\left.b_{k}= 2\int^{1}_{0}\left(sin(\pi * x)+ cos(\pi*x)sin(\pi*x)\right)*sin\left(\pi * x\right)dx$$
I split the integral up so:
$$\left.b_{k}= 2\int^{1}_{0}sin\left(\pi * x\right)*sin\left(\pi * kx\right)dx + 2\int^{1}_{0}cos\left(\pi*x\right)sin\left(\pi*x\right)*sin\left(\pi * kx\right)dx$$

So I use a couple of trig identities where
$$\left.2sin\left(\pi *x\right)sin\left(\pi *kx\right)= cos\left((k-1)\pi *x\right)-cos\left((k+1)\pi *x\right)$$

and
$$\left.2cos(\pi* x)sin(\pi *x) = sin(2 \pi *x)$$
then:
$$\left.2sin(2 \pi *x)sin(k \pi *x) = cos((k-2)\pi *x) - cos((k+2) \pi *x)$$

so now our $$b_{k}$$ becomes:
$$\left.b_{k}= 2\int^{1}_{0}cos\left((k-1)\pi *x\right)-cos\left((k+1)\pi *x\right)dx + \frac{1}{2}\int^{1}_{0}cos((k-2)\pi *x) - cos((k+2) \pi *x)dx$$

so lastly I do all the integration and got:
$$\left.\left(\frac{sin((k-1) \pi *x)}{(k-1)\pi}-\frac{sin((k+1)\pi *x)}{(k+1)\pi}+\frac{1}{2}\left(\frac{sin((k-2) \pi *x)}{(k-2)\pi}-\frac{sin((k+2)\pi *x)}{(k+2)\pi}\right)\right)\right|^{1}_{0}$$

So here's my problem with this second exercise, all the terms goto zero since they have $$\pi$$ terms and so I'm confused(maybe I did my integrations wrong, or trig identities wrong).

Thanks to whoever decideds to help and read this long post!!!!

Last edited: Jun 5, 2009
2. Jun 5, 2009

### tiny-tim

Hi jianxu!
Yeah … no way am i reading all that!

I've read the bit above, and I think what you're missing is that if the coefficient inside the cos is 0, then the integral isn't sin, it's x …

does that fix it?

3. Jun 5, 2009

### jianxu

are you referring to the first term where I have k-1? I guess I can assume that for the first term when k =1, then cos will be zero but....I had the impression this is suppose to be as general as possible?

so am i suppose to say only the first 2 terms will give me nonzero items while the rest will just be zero? Thanks

Last edited: Jun 5, 2009
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook