$$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.

  • 1
    $\begingroup$ Could you please show some of your work? $\endgroup$ May 21, 2016 at 16:23
  • $\begingroup$ I added some of it. $\endgroup$
    – mirai
    May 21, 2016 at 16:36

1 Answer 1


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*}

  • $\begingroup$ Are you sure it should be - at one and + at the other one? $\endgroup$
    – mirai
    May 21, 2016 at 17:36
  • 1
    $\begingroup$ Yes, you can derive it from the formulas for addition of angles $\cos(x \pm y)=\cos x \cos y \mp \sin x \sin y$. Just subtract $\cos(x+y)$ from $\cos(x-y)$ to find $2\sin x \sin y=\cos(x+-y)-\cos(x+y)$ $\endgroup$
    – Nikolai
    May 21, 2016 at 17:45
  • $\begingroup$ Can you explain it to me how did you get that solution, please? $\endgroup$
    – mirai
    May 21, 2016 at 17:51
  • $\begingroup$ You have $\cos (x+y)=\cos x\cos y -\sin x\sin y$ and $\cos (x-y)=\cos x\cos y +\sin x\sin y$. When you subtract the former from the latter you get $\cos (x-y)-\cos (x+y)=\cos x\cos y +\sin x\sin y - \big(\cos x\cos y -\sin x\sin y\big)=2\sin x\sin y$. The identity $\cos(x\pm y)=\cos x\cos y \mp \sin x \sin y$ can be derived from $e^{i\theta}=\cos\theta+i\sin\theta$. $\endgroup$
    – Nikolai
    May 21, 2016 at 18:59
  • $\begingroup$ I understood that, i meant for $b_n=\frac{(-1)^n 2n}{\pi(n^2+1/4)}$ $\endgroup$
    – mirai
    May 21, 2016 at 19:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .