I just have a quick question about setting up my fourier series before integration
If I have $$ f(x) = \begin{cases} 1-x/\pi,& -\pi\leqslant x\leqslant \pi\\ 0,& \text{ otherwise} \end{cases} $$
How would I setup my intial $a_o$, $a_n$ and $b_n$ values before integration.
So far I think $a_0= 1/2\pi \cdot \int_0^{2\pi}(1-t/\pi) \ \mathsf dt$.
Thank you for any help provided.
The Fourier series of a function $f(t)$ of period $T$ in the interval $[-T/2,T/2]$, where it is also (piecewise) continuous - as it is your case, can be written in the form:
$$f(t)=a_0+\sum_{n=1}^{\infty} \left( a_n \cos\left( \frac{2\pi n}{T} t \right) + b_n \sin\left( \frac{2\pi n}{T}t \right) \right)$$ where the coefficients then are: $$a_0= \frac{1}{T} \int_{ -\frac{T}{2} }^{ \frac{T}{2} } f(t) \mathrm{d}t = \frac{1}{2\pi} \int_{ -\pi }^{\pi } \left(1-t/\pi\right) \mathrm{d}t = 1 $$ and for $n>0$:
$$a_n=\frac{1}{T/2}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(t) \cos\left(\frac{2\pi n}{T} t\right) \mathrm{d}t = \frac{1}{\pi} \int_{ -\pi }^{\pi } \left(1-t/\pi\right) \cos\left(n t\right) \mathrm{d}t = 2\frac{1}{\pi} \int_{ 0 }^{\pi } \cos\left(n t\right) \mathrm{d}t $$
$$b_n=\frac{1}{T/2}\int_{-\frac{T}{2}}^{\frac{T}{2}} f(t) \sin\left(\frac{2\pi n}{T} t\right) \mathrm{d}t = \frac{1}{\pi} \int_{ -\pi }^{\pi } \left(1-t/\pi\right) \sin\left(n t\right) \mathrm{d}t = 2 \frac{1}{\pi} \int_{ 0}^{\pi }-t/\pi \sin\left(n t\right) \mathrm{d}t$$ (Where the results are shown for your case; see Bungo's comment for the simplifications.)
You can also integrate between $0$ and $T$ as you state in your question, just change the variable $t$ to $t-T/2$ both in the integrals and in the series; the coefficients won't be the same (some will be of opposite sign), but the terms in the series will.