Let a real-valued function $f$ be defined as following: $$f\left ( x \right )=\left\{\begin{matrix} 2k-x, x\in\left [ 2k-1,2k \right ) & \\ x-2x , x \in \left[ 2k,2k+1\right )& \end{matrix}\right.$$
Being that the function satisfies Dirichlet's conditions on $\mathbb{R}$, the real valued Fourier series I have come up with does converge to $f$ : $$S(x)=\frac{1}{2}-\frac{4}{\pi ^{2}}\sum_{n=1}^{\infty}\frac {\cos((2n-1)\pi x)}{(2n-1)^{2}}$$ Upon trying to convert this to its equivalent complex representation, several thoughts came to my mind. In many of the textbooks, when examples are given, the $a_{0}$ term in the real valued F.S is non zero, however the authors claim that the complex F.S. is $\sum_{n=-\infty}^{\infty}c_{k}e^{\frac{i2n\pi x}{T}}$, where $T$ denotes the principal period of the function. What happened to $a_{0}$ here? Is it just "hidden" in the complex Fourier coefficients? So I went on to apply the formulae ($c_{n}=\frac{1}{2}(a_{n}-ib_{n})$) presented in the books to my function and got this result: $\frac{1}{2}\sum_{n=-\infty}^{\infty}\frac{e^{in\pi x}}{(2n-1)^{2}}$. But I suspect that I could have come to the same result rewriting $S(x)$ as $$\frac{1}{2}+\sum_{n=1}^{\infty}\frac{1}{2(2n-1)^{2}}(e^{i\pi (2n-1)x}+e^{-i\pi (2n-1)x})$$
However I couldn't come up with a nice way to do this. What is the general way of doing this? The method mentioned first, or the latter one. Or none of them?