How to solve $\int \cos(2x)\cos(3x)\ dx$? I took a shot in the dark and assumed that this is similar to solving $\int e^{x}\sin{x}\ dx$, but wolfram is giving me a different answer than what I got, and on top of that, I tried to differentiate my result and am not getting back what I started with. It's putting into question whether I was doing previous questions right or not..
First step of my attempt: 


*

*let $u=\cos(2x),\ du=-2\sin(2x)\ dx$

*let $dv=\cos(3x)\ dx,\ v=\frac{\sin(3x)}{3}$


$$\int\cos(2x)\cos(3x)\ dx=\frac{\cos(2x)\sin(3x)}{3}+\frac{2}{3}\int\sin(2x)\sin(3x)\ dx $$
Then I did IBP again:


*

*let $u=\sin(2x),\ du=2\cos(2x)\ dx$

*let $dv=\sin(3x)\ dx, v=-\frac{cos(3x)}{3}$


$$=\frac{\cos(2x)\sin(3x)}{3}+\frac{2}{3}\left[-\frac{\cos(3x)\sin(2x)}{3}+\frac{2}{3}\int\cos(2x)\cos(3x)\ dx\right]$$
From there, I simplify and re-arrange to get
$$\frac{1}{3}\int\cos(2x)\cos(3x)\ dx=\frac{3\cos(2x)\sin(3x)-2\cos(3x)\sin(2x)}{9}$$
$$\int\cos(2x)\cos(3x)\ dx=\frac{3\cos(2x)\sin(3x)-2\cos(3x)\sin(2x)}{3}+C$$
So where did I go wrong? Wolfram says the answer should be
$$\int\cos(2x)\cos(3x)\ dx=\frac{1}{10}5\sin(x)+\sin(5x)+C$$
 A: You forgot to distribute the $\frac23$ after your second IBP. You should have $$\int\cos(2x)\cos(3x)\,dx=\frac{\cos(2x)\sin(3x)}3-\frac{2\cos(3x)\sin(2x)}9+\frac49\int\cos(2x)\cos(3x)\,dx.$$ From there, product-to-sum laws should get you the rest of the way (though it would be easier to simply use them from the start).
P.S.: Don't forget the integration constant!
A: You have $\cos x \cos y = \frac{1}{2}(\cos (x+y) + \cos(x-y))$.
Hence $\cos (2x) \cos (3x) = \frac{1}{2} (\cos (5x) + \cos x) $. This should be straightforward to integrate.
A: You did not go wrong, apart from a minor mistake in arithmetic. The denominator should be $5$.
However, the "product to sum" approach that Alpha took is, unusually for Alpha, more efficient.
Remark: You mention that you differentiated your final result and the derivative did not agree with the integrand. It is always possible to make a mistake in differentiating. When I do it, I get $\frac{5}{3}\cos 2x\cos 3x$. That says that your integral is almost right, and suggests that there was an unimportant glitch in the calculation. By the way, I computed the integral by using the  Method of Undetermined Coefficients, looking for $A$ and $B$ such that $A\cos 2x\sin 3x +B\cos 3x\sin 2x$ works. 
