Consider the function $f \in C_{st}$ which on the interval $-]\pi, \pi[$ is equal to the fucntion $x \mapsto x \cos(x)$. Then I have to find the Fourier coefficient $c_1$. I have tried to calculate it by using the indentity $cos(x) = \frac{e^{ix}-e^{-ix}}{2}$ and integration by parts $\int_a^b f(x)g(x) = \left[f(x)G(x)\right]_a^b - \int_a^b f'(x)G(x) dx$ to have that
\begin{align*} c_1 & = \frac{1}{2 \pi} \int_{- \pi}^{\pi} x \cos(x) e^{-ix} dx \\ & = \frac{1}{4 \pi} \int_{-\pi}^{\pi} x(1-e^{-2ix} dx \\ & = \frac{1}{4 \pi} \left( \left[x(x-\frac{1}{2}ie^{-2ix}) \right]_{x=-\pi}^{\pi} - \left[x-\frac{1}{2}ie^{-2ix} \right]_{x=-\pi}^{\pi} \right) \\ & = \frac{1}{4\pi} \left( \pi(\pi - \frac{1}{2}ie^{-2i\pi}) + \pi (-\pi - \frac{1}{2}ie^{2\pi}) -\left(\pi -\:\frac{1}{2}ie^{-2i\pi }-\left(-\pi -\frac{1}{2}ie^{2\pi }\right)\right)\right) \\ & = \frac{1}{4 \pi} \left( \pi^2 - \frac{1}{2}i\pi - \pi^2 - \frac{1}{2}i\pi -2\pi \right) \\ & = -\frac{i}{4} - \frac{1}{2} \end{align*} which does not give the right answer as I know th answer is just $-i/4$ where am I doing wrong?