So...I am trying to find the Fourier series for the following function:
$ f(t)= \begin{cases} 0&\text{if}\, -\pi\leq t\lt -\pi/2\\ \cos(t)&\text{if}\, -\pi/2\leq t\leq \pi/2\\ 0&\text{if}\, \pi/2\lt t\leq \pi\\ \end{cases} $
Where its period,$T$, is $2\pi$ and thus $w=2\pi/T=1$
When I try to find out the terms, I have the following:
$a[0]=\int^{\pi/2}_{-\pi/2}cos(t)dt=2$
$a[n]=\int^{\pi/2}_{-\pi/2}cos(t)cos(nwt)dt=\int^{\pi/2}_{-\pi/2}cos(t)cos(nt)dt=-\frac{(2cos((\frac{\pi n}{2}))}{(n^2-1)}$
$b[n]=\int^{\pi/2}_{-\pi/2}cos(t)sin(nwt)dt=\int^{\pi/2}_{-\pi/2}cos(t)sin(nt)dt=0$ (even function)
Where the weirdness starts... If I evaluate some terms, it's noticeable that the $n=1$ term is not defined. Is that even possible, or did I make a mistake?
Hint
If the general term is not define for some $n$ , then you can separately calculate the term. Suppose it is mentioned in question, is at $n=1$ the coefficient is not defined so you have to substitute $n=1$ in the formula of $a_n$ So if you put $n=1$ in the formula for $a_n$ then it appears as $$a_1 = \frac{1} {\pi} \int_{-\pi}^{\pi} f(x)\cos{{x} } $$ Now you can substitue the value of $f(x)$ and calculate $a_1$ Where $ L = \pi $ (half of the period)