Given the above function I have to show that the Fourier series is :
$$f(t)=\frac{1}{2}+\frac{6}{\pi}(\cos\omega_0t -\frac{1}{3}\cos3\omega_0t+\frac{1}{5}\cos5\omega_0t-\frac{1}{7}\cos7\omega_0t+\cdots)$$
Can I get help on how to start solving this?
Step number 1 is to fins the periodicity of the function. By looking at the graph, you can see that the period is $T$. You also notice that the function is even, so only cosine terms will contribute to the Fourier series.
Step number 2 involves writing out explicitly what your function looks like (not the series). You should only write it for one period. You can choose any start point $t$ and write how it should look in the interval $[t, t+T]$. If you start at $0$, you need to describe 3 intervals $([0,T/4], [T/4,3T/4], [3T/4,T])$. The same thing if you go from $-T/2$ to $T/2$. In this case, your best bet is to go from $-T/4$ to $3T/4$, since you have only two intervals to think of. If $-T/4\le t\lt T/4$ then $f(t)=2$. For $T/4\le t\lt3T/4$, $f(t)=-1$
Now you write $f(t)$ as a Fourier series containing only cosine terms:
$$f(t)=a_0/2+\sum_{n=1}^\infty a_n\cos\left(\frac{2\pi}{T} n t\right)$$ You can identify $\omega_0=\frac{2\pi}{T}$. The coefficients $a_n$ can be found from $$a_n=\frac{2}{T}\int_{t_0}^{t_0+T}f(t)\cos(n\omega_0 t)dt$$ And you should choose $t_0$ to be $-T/4$
For example $$a_0=\frac{2}{T}\int_{-T/4}^{3T/4}f(t)dt=\frac{2}{T}\int_{-T/4}^{T/4}f(t)dt+\frac{2}{T}\int_{T/4}^{3T/4}f(t)dt=\\=\frac{2}{T}\frac{T}{2}(2-1)=1$$ This way the first term in the series is $a_0/2=1/2$
The function is even so $b_n=0$ for all $n$. Then \begin{eqnarray} a_0 &=& \dfrac{1}{L}\int_{-L}^{L}f(x)dx\\ &=& \dfrac{1}{L}\int_{-\frac12T}^{\frac12T}f(x)dx\\ &=& \dfrac{2}{L}\int_{0}^{\frac12T}f(x)dx\\ &=& \dfrac{2}{T}\int_{0}^{\frac14T}2\,dx+\dfrac{2}{T}\int_{\frac14T}^{\frac12T}-1\,dx\\ &=& 1-\frac12\\ &=& \frac12 \end{eqnarray} and \begin{eqnarray} a_n&=& \dfrac{1}{L}\int_{-L}^{L}f(x)\cos\frac{n\pi x}{L}dx\\ &=& \dfrac{2}{T}\int_{-\frac12T}^{\frac12T}f(x)\cos\frac{2n\pi x}{T}dx\\ &=& \dfrac{4}{T}\int_{0}^{\frac14T}2\cos\frac{2n\pi x}{T}dx+\dfrac{4}{T}\int_{\frac14T}^{\frac12T}-\cos\frac{2n\pi x}{T}dx\\ &=& \dfrac{4}{T}(2)\frac{T}{2n\pi}\sin\frac{2n\pi x}{T}\Big|_{0}^{\frac14T}+\dfrac{4}{T}(-1)\frac{T}{2n\pi}\sin\frac{2n\pi x}{T}\Big|_{\frac14T}^{\frac12T}\\ &=& \frac{4}{n\pi}\sin\frac{n\pi}{2}-\frac{2}{n\pi}(\sin n\pi-\sin\frac{n\pi}{2})\\ &=& \frac{6}{n\pi}\sin\frac{n\pi}{2} \end{eqnarray} with $\omega_0=\dfrac{2\pi}{T}$ we have \begin{eqnarray} f(x)&=& \frac12+\sum_{n=1}^{\infty}\frac{6}{n\pi}\sin\frac{n\pi}{2}\cos\frac{2n\pi x}{T}\\ &=& \frac12+\sum_{n=1}^{\infty}\frac{6}{n\pi}\sin\frac{n\pi}{2}\cos n\omega_0x\\ &=& \frac12+\frac{6}{\pi}\left(\cos\omega_0x-\frac{1}{3}\cos3\omega_0x+\frac{1}{5}\cos5\omega_0x+\cdots\right) \end{eqnarray}