The Fourier series of the function $f(x) = \left\{ \begin{array}{rcl} -4\,x & \text{if} & -\pi<x<0 \\ 4\,x & \text{if} & 0<x<\pi \end{array}\right.$
is given by $f(x) \sim c_0 - \displaystyle \sum\limits_{n=0}^\infty c_n\;\cos\big((2\,n+1)\,x\big) - \sum\limits_{n=1}^\infty b_n\;\sin\big(n\,x\big)$
I'm asked to find $c_0$, $c_n$, and $b_n$.
Given that this is an even function, we get $b_n =0$.
I have already found $c_0=4\pi$, but I am having trouble finding $c_n$.
Here is where I get confused. The general formula that I am given to find $c_n$ is given as
$$c_n=\frac{2}{L} \int_{0}^{L} f(x)\cos(\frac{n\pi x}{L})dx$$
where $L$ are the boundary conditions.
However, given that I have $cos((2n+1)x)$, I'm assuming I would have to modify the general formula to accommodate this term.
Solving for $c_n$, I get
$$c_n=\frac{2}{\pi} \int_{0}^{\pi} 4x\cos((2n+1)x)dx$$
$$c_n=\frac{2}{\pi} [\frac{-4\pi(2n+1)\sin(2\pi n)-4\cos(2\pi n)}{(2n+1)^2} -\frac{4}{(2n+1)^2}]$$
$$c_n=\frac{-8}{\pi} \frac{\pi(2n+1)\sin(2\pi n)+\cos(2\pi n)+1}{(2n+1)^2}$$
Apparently this is not correct, so I'm not sure what I'm doing wrong. Any help would be appreciated!