We have given the following function: \begin{equation} f(x) = \begin{cases} 0, & -\pi \leq x < 0, \\ \sin(x), & 0 \leq x \leq \pi \end{cases} \end{equation} My task is to calculate the fourier series and show that it converges pointwise against $f$. We start with calculatin $a_0$ \begin{equation} a_0 = \frac{1}{\pi}\int_{0}^{\pi}f(x)dx =\frac{1}{\pi} (-\cos(x)\Bigr|^\pi_0) = \frac{2}{\pi} \end{equation} For $a_n$ we get: \begin{equation} a_n = \frac{1}{\pi}\int_{0}^{\pi}\sin(x) \sin(nx)dx = -\frac{\sin(n\pi)}{\pi (n^2-1)} \end{equation} And for $b_n$ \begin{equation} b_n = \frac{1}{\pi}\int_{0}^{\pi}\sin(x) \cos(nx)dx = \frac{\cos(n\pi)+1}{\pi (1-n^2)} \end{equation} I used wolfram alpha to calculate the last two. With that my series would be: \begin{equation} \frac{1}{2\pi}+\sum_{n=1}^{\infty} \frac{\cos(n\pi)+1}{\pi (1-n^2)} \cos(nx) - \sum_{n=1}^{\infty}\frac{\sin(n\pi)}{\pi (n^2-1)} \sin(nx) \end{equation} This is now something that I cannot really work with. First, $n = \pm 1$ isn't possible, but it's in my series? Additonally, I cannot create my original function with this, at least I do not know how. And showing that it's converges to f seems hard/impossible with what I have. If I calculate some values, I see: \begin{equation} a_n = 0 \ \ b_{2n} = -\frac{2}{(4n^2-1)\pi} \ \ \textrm{and 0 otherwise.} \end{equation} This does not look too bad at all if I plot this in wolfram alpha, yet I know that this is not completely correct and I don't know how to show that this converges to $f$.
Edit:
I now found this series, which seems to be the one I am looking for according to wolfram alpha: $$\frac{\sin(x)}{2}+\frac{1}{\pi}-\sum_{n=1}^{\infty}\frac{2}{(4n^2-1)\pi} \cdot \cos(2nx)$$
Still, I cannot show the convergence of it.