How does one find the relations of the trigonometric integrals of $\cos(kt)\cos(nt)dt, \sin(kt)\cos(nt)dt, \sin(kt)\sin(nt)dt$

For $k,n \in \mathbb{Z}$ of these integrals: \begin{align} 1) \quad & \int_{-\pi}^{\pi}\cos(nt)\cos(kt)dt \\ 2) \quad & \int_{-\pi}^{\pi}\cos(kt)\sin(nt)dt \\ 3) \quad & \int_{-\pi}^{\pi}\sin(nt)\sin(kt)dt \end{align}

The book says: the relations for 1) is : $\pi$ for $n=k$ greater than 0 , $2\pi$ for $n=k=0$, 0 for $n$ not equal to k ; 2) is always equal to 0 , 3) is $\pi$ for $n=m> 0$ or 0 otherwise

What I have tried to show this:

I calculated with twice partial integration for 1., deriving for the factor with k \begin{align} I:= &\int \cos(kt)\cos(nt)dt \\ = & \frac{1}{n}\sin(nt)\cos(kt)+\frac{k}{n}\int \sin(nt)\sin(kt)dt\\ = & \int \sin(nt)\sin(kt)dt \\ = & \frac{-1}{n}\cos(nt)\sin(kt)-\int\frac{-1}{n}\cos(nt)k\cos(kt)dt \\ \end{align} $${\Huge \Downarrow}$$ \begin{align} I = & \frac{1}{n} \sin (nt) \cos(kt)+\frac{k}{n} \left(\frac{-1}{n}\cos(nt)\sin(kt)+\frac{k}{n}I\right) \\ = & \frac{1}{n}\sin(nt)\cos(kt)-\frac{k}{n^2}\cos(nt)\sin(kt)+\frac{k^2}{n^2}I \\ = & \frac{n^2}{n^2-k^2} \left(\frac{1}{n}\sin(nt)\cos(kt)-\frac{k}{n^2}\cos(nt)\sin(kt)\right) \end{align}

what was done wrong here? It can't be true because even if i take $\int_{-\pi}^{\pi}$ the denominator will go to $0$ for $n=k$ then why do they write $2\pi$ ?

-

Hint: For $n=0$ the antiderivative of $\cos(nt)$ is not $\frac{1}{n} \sin(nt)$. You'll need to make a separate calculation for this case.
\eqalign{2\cos x\cos y&=\cos(x+y)+\cos(x-y)\ ,\cr 2\cos x\sin y&=\sin(x+y)-\sin(x-y)\ ,\cr 2\sin x\sin y&=\cos(x-y)-\cos(x+y)\ .\cr}
$$e^{i(x+y)}=cos(x+y)+isin(x+y)=e^{ix}e^{iy}= (cos(x)+isin(x))(cos(y)+isin(y)= cos(x)cos(y)+icos(x)sin(y)+isin(x)cos(y)-sin(x)sin(y)$$ and $$e^{i(x-y)} = cos(x-y)+isin(x-y) = e^{ix}\cdot e^{-iy} =(cos(x)+isin(x))(cos(-y)+isin(-y)) = (cos(x)+isin(x))(cos(y)-isin(y)) = cos(x)cos(y)-icos(x)sin(y)+isin(x)cos(y)+sin(x)sin(y)$$ ? –  bakabakabaka Jan 28 '13 at 13:32