How to find: $\int^{2\pi}_0 (1+\cos(x))\cos(x)(-\sin^2(x)+\cos(x)+\cos^2(x))~dx$? How to find: $$\int^{2\pi}_0 (1+\cos(x))\cos(x)(-\sin^2(x)+\cos(x)+\cos^2(x))~dx$$
I tried multiplying it all out but I just ended up in a real mess and I'm wondering if there is something I'm missing.
 A: $\displaystyle\int_0^{2\pi}(\cos x+\cos^2x)(\cos 2x+\cos x)dx=\int_0^{2\pi}\big(\cos x+\frac{1}{2}+\frac{1}{2}\cos 2x\big)\big(\cos 2x+\cos x\big)dx$
$\displaystyle\int_0^{2\pi}\big(\cos x\cos 2x+\cos^{2}x+\frac{1}{2}\cos 2x+\frac{1}{2}\cos x+\frac{1}{2}\cos^{2} 2x+\frac{1}{2}\cos 2x\cos x\big)dx$
$\displaystyle\int_0^{2\pi}\big(\frac{3}{2}\cos x\cos 2x+\frac{1}{2}+\cos 2x+\frac{1}{2}\cos x+\frac{1}{4}+\frac{1}{4}\cos 4x\big)dx$
$\displaystyle\int_0^{2\pi}\big(\frac{3}{4}(\cos 3x+\cos x)+\frac{3}{4}+\cos 2x+\frac{1}{2}\cos x+\frac{1}{4}\cos4x\big)dx=\frac{3}{4}(2\pi)=\frac{3\pi}{2}$
(since $\sin n\pi=0$ for any integer n)
A: You have to linearise the integrand. The simplest way to do is with Euler's formulae. To shorten the computation, set $u=\mathrm e^{\mathrm ix}$. Starting with $\cos x =\dfrac{u+\bar u}2$ and taking into account the relations 
$$u\bar u=1,\quad u^n+\bar u^n=2\cos nx,$$
we have
\begin{align*}
(1+\cos x)&\cos x(-\sin^2x+\cos x+\cos^2x)=(1+\cos x)\cos x(\cos x+\cos 2x)\\
&=\Bigl(1+\frac{u+\bar u}2\Bigr)\frac{u+\bar u}2\Bigl(\frac{u+\bar u}2+\frac{u^2+\bar u^2}2\Bigr)\\
&=\frac18(2+u+\bar u)(u+\bar u)\bigl(u+\bar u+u^2+\bar u^2\bigr)\\
&=\frac18\bigr(u^4+\bar u^4+3(u^3+\bar u^3)+4(u^2+\bar u^2)+5(u+\bar u)+6\bigl)\\
&=\frac14(\cos 4x+3\cos 3x+4\cos 2x+5\cos x+3)
\end{align*}
Consequently the  integral from $0$ to $2\pi$ is equal to
$$\frac{3\pi}2.$$
A: try to show that the integrand is equivalent to $$\frac{1}{4} (7 \cos (x)+4 \cos (2 x)+\cos (3 x)+4)$$
