I need to find the Fourier Series for $f\in \mathcal{C}_{st}$ that is given by
$$f(x)=\begin{cases}0,\quad-\pi<x\le 0\\ \cos(x),\quad0\le x<\pi\end{cases}.$$
in the interval $]-\pi,\pi[$ and give the sum of the series for $x=p\pi,p\in\mathbb{Z}$.
What I know:
If $f(x)=\sum_{n=-\infty}^{\infty}\alpha_ne^{inx}$ on $[-\pi,\pi]$, then
$\alpha_n=\frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)e^{-inx}dx$.
Questions:
Can I use the above formula (the intervals are different)?
Should I use integration by parts?
To compute the sum, do I just substitute $x=p\pi$ in?