Help with setting up the Fourier series for the following functions. i. $f(x) = \operatorname{sgn}(x)$ for $-\pi < x < \pi$ where 
$$\operatorname{sgn}(x) = \begin{cases} 1, & x>0, \\
0, & x=0, \\
-1, & x<0. \end{cases} $$
ii. $f(x) = \displaystyle\frac{\pi - x}{2}$ for $-\pi < x < 2\pi$
I want to find the Fourier series of the functions given above. Its been a long time since I have done these, so I was wondering if anyone could help set them up for me, but not go through the computation as I want to do that myself, and then if it is not to much to ask provide a solution. I would say that is okay since solutions don't mean much if one does not know how to get to it, so I wanted to see if the work I go through gets to the right solution. If thats to much to ask then just help with setting up would be appreciated!!!!
 A: "Fourier series" could mean
$$
a_0 + a_1\cos x+b_1\sin x + a_2\cos(2x)+b_2\sin (2x)+\cdots\tag1
$$
or it could mean
$$
\cdots+c_{-2}e^{-2ix}+c_{-1}e^{-ix}+c_0 + c_1e^{ix} +c_2 e^{2ix} + \cdots.\tag2
$$
Either way, the basic idea is this:
\begin{align}
& \int_{-\pi}^\pi f(x)\cdot((\sin\text{ or }\cos)(nx)\text{ or }e^{inx})\,dx \tag 3 \\[8pt]
= {} & \int_{-\pi}^\pi (\text{infinite series (1) or (2) above})\cdot((\sin\text{ or }\cos)(nx)\text{ or }e^{inx})\,dx. \tag 4
\end{align}
If you evaluate the integral in $(4)$, all but one of the terms will be $0$.  Which one depends on $n$, and one whether you're looking at $\sin(nx)$ or $\cos(nx)$ or $e^{inx}$.  What you get will be an expression involving the coefficient $a_n$ or $b_n$ or $c_n$.  That expression will be equal to whatever you get when you evalutate the integral in $(4)$.  So you get
\begin{align}
& \text{expression from evaluating }(3) \\[8pt]
= {} & (c_n\cdot\text{expression from evaluating }(4))
\end{align}
and thus you find $c_n$ (or $a_n$ or $b_n$, as the case may be).
A: For $f$ defined on $[a,b]$, the corresponding Fourier series is defnied as
$$\sum_{n=-\infty}^{\infty}c_ne^{\frac{in\pi x}{T}}$$ where $$T=\frac{b-a}{2}, c_n=\frac{1}{2T}\int_{a}^b f(t)e^{-\frac{in\pi x}{T}}\ dt$$
What you need to do is to evaluate corresponding integral by definition.
