# Trig Integration

I am having problems arriving at the same solutions as my professor for the 2 following integrals, sorry for the formatting in advance. \begin{align*}a_n&=\frac{1}{\pi}\int_0^\pi\sin(x)\cos(nx)\text{d}x=\frac{1}{\pi}\int_0^\pi \frac{1}{2}\left[\sin\left((1+n)x\right)+\sin\left((1-n)x\right)\right]\text{d}x\\&=\left(\frac{1+(-1)^n}{\pi\left(1-n^2 \right)}\right)\hspace{0.2cm} \text{where: } n\ne 1,\ n=2,3,4,\dots\end{align*} \begin{align*}b_n&=\frac{1}{\pi}\int_0^\pi\sin(x)\sin(nx)\text{d}x=\frac{1}{2\pi}\int_0^\pi\left[\cos\left((1-n)x\right)-\cos\left((1+n)x\right)\right]\text{d}x=0\\&\text{for } n=2,3,4\dots\ (\text{again, } n\ne 1)\end{align*}

• Mathjax is very similar to latex. It shouldn't be hard for you to improve your formatting. – Ian Miller Feb 25 '16 at 4:49
• I have a program which converts ms word equations to Tex format. How is the proper way of posting a question using this format? – E.JJ Feb 25 '16 at 4:51
• math.stackexchange.com/help/notation – user296602 Feb 25 '16 at 4:51
• I've made some minor changes to your question's formatting which greatly improve the readability. (Wasn't sure how to do ellipsis.) Can you read over it and make sure I haven't changed your meaning. – Ian Miller Feb 25 '16 at 4:52
• Looks good, thanks! – E.JJ Feb 25 '16 at 4:55

Assuming $\,n\neq1\;$:

$$\frac1\pi\int_0^\pi\frac12\left(\sin(1+n)x+\sin(1-n)x\right)dx=$$

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

$$=\frac1{2\pi}\left[-\frac1{n+1}\left((-1)^{n+1}-1\right)+\frac1{n-1}\left((-1)^{n-1}-1\right)\right]\stackrel{\text{common factor}}=$$

$$=\frac{(-1)^{n-1}-1}{2\pi}\left[\frac1{n-1}-\frac1{n+1}\right]=\frac{(-1)^{n-1}-1}{\pi(n^2-1)}=\frac{1+(-1)^n}{\pi(1-n^2)}$$

Observe above that $\;n-1,\,n+1\;$ have the same parity and thus $\;(-1)^{n-1}=(-1)^{n+1}\;$ , and besides $\;\cos(1-n)x=\cos(n-1)x\;$ , since it is an even function, and also in the last step: $\;-((-1)^{n-1}-1)=1+(-1)^n\;$ .

Also, in your formula I can't see where that $\;m\;$ comes from. I think it should be $\;n\;$ .