[Math] Fourier sine series of $\sin(x/2)$

fourier series

$$f(x) =\sin \left(\frac{x}{2}\right)$$
on interval $0 < x < \pi$

Hello, I'm trying to do the sine series. I understand I have to do $b_n$ but somehow I always get $0$ as result, but it doesn't seem logical to me.

I always end up to the point where I get $\sin$ of something minus that same $\sin$.
This is what I have so far:

\begin{align}
b_n &=\frac{2}{\pi} \int_o^\pi \sin\left(\frac{x}{2}\right)\sin nx\,dx\\
&=\frac{2}{\pi} \int_o^\pi \frac{{\cos\left(\frac{x}{2} – x\right)}-{\cos\left(\frac{x}{2} – x\right)}}{2}dx\\
&=\frac{1}{\pi} \int_o^\pi \left({\cos\left(-\frac {x}{2}\right)}-{\cos\left(\frac{x}{2}\right)}\right)dx
\end{align}

And its pretty much clear what happens, I end up with $0$ as result. I'm so confused.

I'd like to see how would you do $b_n$ because I think I did something wrong along the line, but I tried so many times I can't see it anymore 🙂

Much appreciated.

Best Answer

I think you forgot to include $n$ when rewriting the integrand in the first step. It should be $\sin(x/2)\sin(nx)=1/2\bigg(\cos(x/2-nx)-\cos(x/2+nx)\bigg)$

Then the cosine terms no longer cancel and you find something like $b_n=\frac{(-1)^n 2n}{\pi(n^2+1/4)}$

There might be some mistakes in what follows but this is how I got to that result: \begin{align*} b_n&=\frac{2}{\pi}\int_0^{\pi}\sin(\frac{x}{2})\sin(nx)dx\\ &=\frac{1}{\pi}\int_0^{\pi}\cos\big((\frac{1}{2}-n)x\big)-\cos\big((\frac{1}{2}+n)x\big)\\ &=\frac{1}{\pi}\bigg[\frac{\sin\big((\frac{1}{2}-n)x\big)}{\frac{1}{2}-n}-\frac{\sin\big(\frac{1}{2}+n)x\big)}{\frac{1}{2}+n}\bigg]^{\pi}_0\\ &=\frac{1}{\pi}\bigg(\frac{\sin\big(\frac{\pi}{2}-n\pi\big)}{\frac{1}{2}-n}-\frac{\sin\big(\frac{\pi}{2}+n\pi\big)}{\frac{1}{2}+n}\bigg)\\ &=\frac{1}{\pi}\bigg(\frac{\cos\big(n\pi\big)}{\frac{1}{2}-n}-\frac{\cos\big(n\pi\big)}{\frac{1}{2}+n}\bigg)\\ &=\frac{1}{\pi}\bigg(\frac{(-1)^n}{\frac{1}{2}-n}-\frac{(-1)^n}{\frac{1}{2}+n}\bigg)\\ &=\frac{2(-1)^n n}{\pi(\frac{1}{4} -n^2)} \end{align*}