There is an exercise to sketch the function $f(x)=\sin(\pi x)$ on the interval $0<x<1$ and then find the complex Fourier series. I tried doing it in two ways:
Firstly, I got $L=1/2$ and while calculating $a_0$ by using $$ a_0=\frac1{2L}\int_{0}^{1} \sin (\pi x)\,dx, $$ I got its value to be $2/\pi$.
Secondly I tried to calculate the $c_n$ directly. But while calculating the complex coefficient $c_0$ directly by using $$ c_0=\frac1{2L}\int_{-L}^{L}\sin (\pi x)\,dx, $$ I got its value to be $0$.
This confused me a lot as $a_0$ and $c_0$ should be equal.
I know I made a mistake somewhere and there is some gap in my understanding. Please help.
The Fourier coefficients $c_n$ of the complex representation is given by
$$ c_n=\frac{1}{T}\int^\frac{T}{2}_{-\frac{T}{2}}f(t)e^{in\omega _0t}dt $$ or
$$ c_n=\frac{1}{T}\int^T_0f(t)e^{in\omega _0t}dt $$ (notice the integration limits)
This is indeed equal to $a_0$ if you evaluate the integral within $(0,1)$ as required.