Fourier Series for $f(x)=\sin(x)+\cos(2x)$ 
Find the Fourier Series for $$f(x)=\sin(x)+\cos(2x)$$

I got $a_0=0$ which seems correct but I'm struggling with $a_n$ and $b_n$. Here are my attempts:
$$\begin{align}
a_n&=\frac{1}{2\pi} \overbrace{\int\limits_0^{2\pi} \cos(nx)\sin(x)dx}^{\text{odd function}}+\int\limits_0^{2\pi} \cos(nx)\cos(2x)dx\\ 
&= \frac{1}{2\pi} \left[\frac{\sin(nx)}{n}\cos(2x)\right]_0^{2\pi}-2\cdot\int\limits_0^{2\pi}\frac{\sin(nx)}{n}\sin(2x)\\
\end{align}$$
If I integrate the second term again I get an even function again and again. I need a fitting addtion theorem or something else. Any hints?
 A: $$\text{a}_{0}=\frac{1}{\pi}\int_{-\pi}^{\pi}(\sin(x)+\cos(2x))\space\text{d}x=$$
$$\frac{1}{\pi}\left[\int_{-\pi}^{\pi}\sin(x)\space\text{d}x+\int_{-\pi}^{\pi}\cos(2x)\space\text{d}x\right]=$$

Now, use: $\int\sin(x)\space\text{d}x=\text{C}-\cos(x)$

$$\frac{1}{\pi}\left[\left[-\cos(x)\right]_{-\pi}^{\pi}+\int_{-\pi}^{\pi}\cos(2x)\space\text{d}x\right]=$$

Substitute $u=2x$ and $\text{d}u=2\space\text{d}x$.
This gives a new lower bound $u=-2\pi$ and upper bound $u=2\pi$:

$$\frac{1}{\pi}\left[\left[-\cos(x)\right]_{-\pi}^{\pi}+\frac{1}{2}\int_{-2\pi}^{2\pi}\cos(u)\space\text{d}u\right]=$$

Now, use: $\int\cos(x)\space\text{d}x=\sin(x)+\text{C}$

$$\frac{1}{\pi}\left[\left[-\cos(x)\right]_{-\pi}^{\pi}+\frac{1}{2}\left[\sin(u)\right]_{-2\pi}^{2\pi}\right]=0$$
NEXT:
$$\text{a}_{n}=\frac{1}{\pi}\int_{-\pi}^{\pi}(\sin(x)+\cos(2x))\cos(nx)\space\text{d}x=$$
$$\frac{1}{\pi}\left[\int_{-\pi}^{\pi}\sin(x)\cos(nx)\space\text{d}x+\int_{-\pi}^{\pi}\cos(2x)\cos(nx)\space\text{d}x\right]=$$

Now, as you noticed already:
Since $\sin(x)\cos(nx)$ is an odd function and the interval $[\pi,\pi]$ is symmetric about $0$, so:
$$\int_{-\pi}^{\pi}\sin(x)\cos(nx)\space\text{d}x=0$$

$$\frac{1}{\pi}\int_{-\pi}^{\pi}\cos(2x)\cos(nx)\space\text{d}x=$$

Use the trigonometric identity $\cos(a)\cos(b)=\frac{\cos(a-b)+cos(a+b)}{2}$:

$$\frac{1}{2\pi}\int_{-\pi}^{\pi}(\cos(x(n-2))+\cos(x(n+2)))\space\text{d}x=$$
$$\frac{1}{2\pi}\left[\int_{-\pi}^{\pi}\cos(x(n+2))\space\text{d}x+\int_{-\pi}^{\pi}\cos(x(n-2))\space\text{d}x\right]=$$

For the left integral:
Substitute $u=x(n+2)$ and $\text{d}u=(n+2)\space\text{d}x$.
This gives a new lower bound $u=(-\pi)(n+2)=-\pi(n+2)$ and upper bound $u=\pi(n+2)$:

$$\frac{1}{2\pi}\left[\frac{1}{n+2}\int_{-\pi(n+2)}^{\pi(n+2)}\cos(u)\space\text{d}u+\int_{-\pi}^{\pi}\cos(x(n-2))\space\text{d}x\right]=$$

For the right integral:
Substitute $s=x(n-2)$ and $\text{d}s=(n-2)\space\text{d}x$.
This gives a new lower bound $s=(-\pi)(n-2)=-\pi(n-2)$ and upper bound $s=\pi(n-2)$:

$$\frac{1}{2\pi}\left[\frac{1}{n+2}\int_{-\pi(n+2)}^{\pi(n+2)}\cos(u)\space\text{d}u+\frac{1}{n-2}\int_{-\pi(n-2)}^{\pi(n-2)}\cos(s)\space\text{d}s\right]=$$

Now, use: $\int\cos(x)\space\text{d}x=\sin(x)+\text{C}$

$$\frac{1}{2\pi}\left[\frac{1}{n+2}\left[\sin(u)\right]_{-\pi(n+2)}^{\pi(n+2)}+\frac{1}{n-2}\left[\sin(s)\right]_{-\pi(n-2)}^{\pi(n-2)}\right]=$$
$$\frac{\sin(\pi n)}{\pi(n+2)}+\frac{\sin(\pi n)}{\pi(n-2)}=\frac{2n\sin(\pi n)}{\pi(n^2-4)}$$
NEXT:
$$\text{b}_{n}=\frac{1}{\pi}\int_{-\pi}^{\pi}(\sin(x)+\cos(2x))\sin(nx)\space\text{d}x=$$
$$\frac{1}{\pi}\left[\int_{-\pi}^{\pi}\sin(x)\sin(nx)\space\text{d}x+\int_{-\pi}^{\pi}\cos(2x)\sin(nx)\space\text{d}x\right]=$$

Now, as you noticed already:
Since $\cos(2x)\sin(nx)$ is an odd function and the interval $[\pi,\pi]$ is symmetric about $0$, so:
$$\int_{-\pi}^{\pi}\cos(2x)\sin(nx)\space\text{d}x=0$$

$$\frac{1}{\pi}\int_{-\pi}^{\pi}\sin(x)\sin(nx)\space\text{d}x=$$

Use the trigonometric identity $\sin(a)\sin(b)=\frac{\cos(a-b)-cos(a+b)}{2}$:

$$\frac{1}{2\pi}\int_{-\pi}^{\pi}(\cos(x(n-1))-\cos(x(n+1)))\space\text{d}x=$$
$$\frac{1}{2\pi}\left[\int_{-\pi}^{\pi}\cos(x(n-1))\space\text{d}x-\int_{-\pi}^{\pi}\cos(x(n+1))\space\text{d}x\right]=$$

For the right integral:
Substitute $u=x(n+1)$ and $\text{d}u=(n+1)\space\text{d}x$.
This gives a new lower bound $u=(-\pi)(n+1)=-\pi(n+1)$ and upper bound $u=\pi(n+1)$:

$$\frac{1}{2\pi}\left[\int_{-\pi}^{\pi}\cos(x(n-1))\space\text{d}x-\frac{1}{n+1}\int_{-\pi(n+1)}^{\pi(n+1)}\cos(u)\space\text{d}u\right]=$$

For the left integral:
Substitute $s=x(n-1)$ and $\text{d}s=(n-1)\space\text{d}x$.
This gives a new lower bound $s=(-\pi)(n-1)=-\pi(n-1)$ and upper bound $s=\pi(n-1)$:

$$\frac{1}{2\pi}\left[\frac{1}{n-1}\int_{-\pi(n-1)}^{\pi(n-1)}\cos(s)\space\text{d}s-\frac{1}{n+1}\int_{-\pi(n+1)}^{\pi(n+1)}\cos(u)\space\text{d}u\right]=$$

Now, use: $\int\cos(x)\space\text{d}x=\sin(x)+\text{C}$

$$\frac{1}{2\pi}\left[\frac{1}{n-1}\left[\sin(s)\right]_{-\pi(n-1)}^{\pi(n-1)}-\frac{1}{n+1}\left[\sin(u)\right]_{-\pi(n+1)}^{\pi(n+1)}\right]=$$
$$\frac{\sin(\pi n)}{\pi(1-n)}+\frac{\sin(\pi n)}{\pi(1+n)}=\frac{2\sin(\pi n)}{\pi(1-n^2)}$$
CONCLUSION:


*

*$$\text{a}_0=0$$

*$$\text{a}_n=\frac{2n\sin(\pi n)}{\pi(n^2-4)}$$

*$$\text{b}_n=\frac{2\sin(\pi n)}{\pi(1-n^2)}$$

