# How to integrate this : $\int \frac{\cos5x+\cos 4x}{1-2\cos 3x}\,dx$ [duplicate]

How to integrate this :

$\int \frac{\cos 5x+\cos 4x}{1-2\cos 3x}\,dx$

My approach :

We know that $\cos A+cosB = 2\cos(\frac{A+B}{2})\cos(\frac{A-B}{2})$ But it is not working here, please suggest, thanks.

The integrand function can be greatly simplified. If $n\in\mathbb{N}$ we have that $\cos(nx)$ is a polynomial in $\cos(x)$ with degree $n$. By setting $z=\cos\theta$ we have: $$\cos(4x)+\cos(5x) = T_4(z)+T_5(z) = 1+5 z-8 z^2-20 z^3+8 z^4+16 z^5\tag{1}$$ $$1-2\cos(3x) = 1- 2\,T_3(z) = 1 + 6 z - 8 z^3\tag{2}$$ and it is not difficult to notice that the RHS of $(2)$ is a divisor of the RHS of $(1)$: $$\frac{\cos(4x)+\cos(5x)}{1-2\cos(3x)} = 1 - z - 2 z^2 = -\cos(x)-\cos(2x) \tag{3}$$ so the wanted integral is simply $\color{red}{C-\sin(x)-\frac{1}{2}\sin(2x)}$.
$$\begin{equation}\begin{split}\int\dfrac{\cos 5x+\cos 4x}{1-2\cos 3x}\,dx&=\int\dfrac{2\cos \left(\frac{5x+4x}{2}\right)\cos \left(\frac{5x-4x}{2}\right)}{1-2\left[2\cos^2 \left(\frac{3x}{2}\right)-1\right]}\,dx\\&=\int\dfrac{2\cos \left(\frac{9x}{2}\right)\cos \left(\frac{x}{2}\right)}{3-4\cos^2 \left(\frac{3x}{2}\right)}\,dx\\&=\int\dfrac{2\cos \left(\frac{9x}{2}\right)\cos \left(\frac{x}{2}\right)\cos \left(\frac{3x}{2}\right)}{3\cos \left(\frac{3x}{2}\right)-4\cos^3 \left(\frac{3x}{2}\right)}\,dx\\&=-\int\dfrac{2\cos \left(\frac{9x}{2}\right)\cos \left(\frac{x}{2}\right)\cos \left(\frac{3x}{2}\right)}{\cos \left(\frac{9x}{2}\right)}\,dx\\&=-\int 2\cos \left(\frac{x}{2}\right)\cos \left(\frac{3x}{2}\right)\,dx\\&=-\int\left(\cos 2x + \cos x\right)\,dx\\&=-\int\cos 2x\,dx - \int\cos x\,dx\\&=-\dfrac{\sin 2x}{2} - \sin x + C\\&=-\left(\dfrac{\sin 2x}{2} + \sin x\right) + C \end{split}\end{equation}$$ Remember the fact that $$\cos 3x = 4\cos^3x - 3\cos x$$
I think the following is easier. $$\cos5x+\cos4x=\cos5x+\cos{x}+\cos4x+\cos2x-\cos{x}-\cos{2x}=$$ $$=2\cos3x\cos2x+2\cos3x\cos{x}-\cos{x}-\cos{2x}=(2\cos3x-1)(\cos2x+\cos{x})$$ and the rest is smooth.