I have $f(t)=t-t^2$ defined on $t\in [0,1]$ with period $T=2$. Using the Fourier series formulas,
\begin{equation} a_n=\frac{2}{T}\int_d^{T+d}f(t)\cos(n\pi t) \,{\rm d}t \end{equation}
I thought it was natural to find $a_0$ by setting $n=0$ in the above equation, so I get
\begin{equation} a_0=\frac{2}{2}\int_0^{1+2}(t-t^2)\cos(0\pi t) \,{\rm d}t = \bigg[\frac{t^2}{2}+\frac{t^3}{3}\bigg]_0^3=-\frac{9}{2} \end{equation}
Is this a good way to solve that, and later solve for $a_n$ with $n=n$?