Fourier Series Expansion for Half-Wave Sine Problem so I have a problem and I ALMOST have it, but get stuck at the very end (you'll see why)
so what we are given is a simple periodic function:
$f(t)\begin{cases}5\sin t & 0\leq t\leq\pi\\0 & \pi \leq t \leq 2\pi \end{cases}$
where $T=2\pi$ and $\omega=1$
I'm really uncomfortable using the even/odd shortcuts, because my teacher has done a very poor job explaining it all, so I just used the general formulae...
what I got was this:
$a_{n}=\frac{1}{\pi}\left[\int_{0}^{\pi}5 \sin t \cos (nt)+\int_{\pi}^{2\pi}0*\cos (nt) \right]$
and therefore only:
$a_{n}=\frac{5}{\pi}\left[\int_{0}^{\pi}\sin t \cos (nt) \right]$
using
$\sin(mt)\cos(nt) = \frac{1}{2}\left[\sin((m-n)t)+\sin((m+n)t)\right]$
we have:
$a_{n}=\frac{5}{2\pi}\left[\int_{0}^{\pi}\sin((m-n)t)+\int_{0}^{\pi}\sin((m+n)t) \right]$
$a_{n}=\frac{5}{2\pi}\left[\left(\left(\frac{-1}{1-n}\right)\cos((1-n)t)\right)_0^\pi+\left(\left(\frac{-1}{1+n}\right)\cos((1+n)t)\right)_0^\pi \right]$
$a_{n}=\frac{5}{2\pi}\left[\left(\left(\frac{-1}{1-n}\right)\left(-1-1\right)\right)+\left(\left(\frac{-1}{1+n}\right)\left(-1-1\right)\right) \right]$
$a_{n}=\frac{5}{2\pi}\left[\left(\frac{2}{1-n}\right)+\left(\frac{2}{1+n}\right) \right]$
$a_{n}=\frac{5}{\pi}\left[\frac{1+n+1-n}{1-n^{2}} \right]$
$a_{n}=\frac{10}{\pi}\left(\frac{1}{1-n^{2}} \right)$
I wont bore you with the $b_{n}$ coefficient as it comes up as zero...
>
ok, this is all fine and dandy so far... but once I need to actually apply it to the formulae
$f(t) = \frac{1}{2}a_{0}+\sum_{n=1}^\infty a_n\cos(nt)$
my coefficient immediately falls apart once you sub in $n=1$
I've looked over my work many times and the only thing I can think that I have have wrong was when I was subbing in $\pi$ and $0$ into my $\cos$ functions... where do I go from here?? or did I miss something completely??
--GD
 A: I list three things that went wrong.
Mistake 1. For $a_1$ you really need to do a seperate case since $\int \sin((1-n)t)\,dt\neq \frac{-1}{1-n}\cos((1-n)t)$ for $n=1$. We find $a_1$ as follows \begin{align} 
a_1&=\frac{1}{\pi}\int^\pi_0 5\sin(t)\cos(t)\,dt\\
&=\frac{5}{2\pi}\int^\pi_0 \sin(2t)\,dt\\
&=0
\end{align} 
Mistake 2. As pointed out in the other answer $\cos(k\pi)=(-1)^k$.
Mistake 3. $b_n = 0$ for all $n\geq 2$ is true,  but $b_1\neq 0$ , because:
$$b_1 = \frac{1}{\pi}\int^\pi_0 5 \sin^2t\,dt>0$$
There is a positive integrand except on a null set.
You could know the last mistake by just noting that you cannot get only a cosine Fourier series when having a piecewise smooth function which is not even. So that should ring a bell. A theorem says so, which I think is given in every lecture about Fourier series. But I don't bother you with it if you don't know it.
A: The step from 
$$a_{n}=\frac{5}{2\pi}\left[\left(\left(\frac{-1}{1-n}\right)\cos((1-n)t)\right)_0^\pi+\left(\left(\frac{-1}{1+n}\right)\cos((1+n)t)\right)_0^\pi \right]$$
to 
$$a_{n}=\frac{5}{2\pi}\left[\left(\left(\frac{-1}{1-n}\right)\left(-1-1\right)\right)+\left(\left(\frac{-1}{1+n}\right)\left(-1-1\right)\right) \right]$$
is wrong because $\cos(k \pi) = \begin{cases}-1:& k \text{ odd} \\ +1:& k\text{ even}\end{cases}$, but you just substitute $-1$ in any case.
