Hola Bloost.
Tenemos una función \( f:[0,T/2]\to\mathbb{R} \) (en tu caso \( \color{red}T/2=4 \)). Entonces una opción es primero hacer las extensiones par e impar de \( f \) respectivas: \( f_{P}:[-T/2,T/2]\to\mathbb{R} \) y \( f_{I}:[-T/2,T/2]\to\mathbb{R}, \) definiendo \( f_{P}(t)=f(-t) \) para \( t\in[0,T/2] \) y \( f_{I}(t)=-f(-t) \) para \( t\in[0,T/2]. \) Luego los coeficientes que buscamos serán
\( \displaystyle a_{n}=\frac{2}{T}\int_{-T/2}^{T/2}f_{P}(t)\cos\Big(\frac{2n\pi}{T}t\Big)\,dt \) y \( \displaystyle b_{n}=\frac{2}{T}\int_{-T/2}^{T/2}f_{I}(t)\sen\Big(\frac{2n\pi}{T}t\Big)\,dt. \)
Nota que se está integrando en el intervalo \( [-T/2,T/2]. \) Este proceso nos genera las extensiones par e impar que buscamos,
con periodo \( T. \) Intenta hacer las cuentas y si tienes dificultades, pregunta.
Saludos.
P.S: \( a_{0}=\frac{2}{T}\int_{-T/2}^{T/2}f_{P}(t)\,dt \)
Mensaje editado.