fourier series representation

Find the Fourier series with period $2$ of

$$f(x) = -x,\qquad-1<x<1$$

so I find that $a_0$ and $a_n$ both are $0$ since odd functions so the Fourier series is on the form: $$\sum_{n=1}^{\infty}b_n\sin(n\pi x)$$ so the question is: how do I find $b_n$? I know the formula but I am not sure how to solve the definite integral which is.
$$-\int_{-1}^{1} x\sin(n\pi x)\,dx$$

thanks for any help!

• Partial integration, say...? – DonAntonio May 20 '14 at 13:25
• hmm what? :D I think its integration by parts etc so if I have u=x and dv=sin(npix) I get v= (-1/npi) * cos(npi*x) and du=1 but now idk what? and idk if what I alredy wrote is correct :( – gger234 May 20 '14 at 13:35
• use MathJax (LaTeX) to write mathematics here, otherwise it's very hard to understand you: meta.matheducators.stackexchange.com/questions/93/… – DonAntonio May 20 '14 at 13:52

$$u=x\;,\;\;u'=1\\v'=\sin n\pi x\;,\;\;v=-\frac1{n\pi}\cos n\pi x$$

so

$$\int\limits_{-1}^1x\sin n\pi x\,dx=\left.-\frac x{n\pi}\cos n\pi x\right|_{-1}^1+\frac1{n\pi}\int\limits_{-1}^1\cos n\pi x\,dx=\\$$

$$=-\frac2{n\pi}\cos n\pi+\left.\frac1{n^2\pi^2}\sin n\pi x\right|_{-1}^1=(-1)^{n+1}\frac2{n\pi}$$

and etc....

• hmm I still dont understand how you got the last line? specially (-2)/(npi) * cos(npi)? but I guess the second expression is just 1/npi multiplied with the integral cos(npi*x)? – gger234 May 20 '14 at 13:57
• @gger234 : $\;\cos n\pi=(-1)^n\;$ ....and use MathJax, please! – DonAntonio May 20 '14 at 13:58
• well.. I still dont understand what you mean. I hate this stuff lol.. I get what you're saying but I still dont know how you get these expressions. – gger234 May 20 '14 at 14:06
• @gger234, didn't you understand what I wrote in my last comment?? You studied trigonometry, right? – DonAntonio May 20 '14 at 14:12
• well I get what you wrote in your last comment, but I dont get how that make that expression equal to the series expression thingymajig on the last line, and I also dont get where 2 is from? – gger234 May 20 '14 at 14:16