How to integrate $\int \cos^2(3x)dx$ $$\int \cos^2(3x)dx$$
The answer according to my instructor is:
$${1 + \cos(6x) \over 2} + C$$
But my book says that:
$$\int \cos^2(ax)dx = {x \over 2} + {\sin(2ax) \over 4a} + C$$
I'm not really sure which one is correct. 
 A: What your instructor (hopefully) meant is that you need to use $$\cos^2(3x) = {1 + \cos(6x) \over 2},$$
which is a specialization of the trig identity $$\cos^2(x) = {1 + \cos(2x) \over 2}.$$
Using this identity we can integrate $$\int \cos^2(3x) dx = \int{1 + \cos(6x) \over 2} dx$$ to get the  answer from the book.
A: There are two methods you can use. Integration by parts and solving for the integral, or the half angle formula.
Remember that the half angle formula is given by $\cos^2(x) = \frac12 (1+\cos(2x))$ and also $\sin^2(x) = \frac12(1-\cos(2x))$.
Thus $$\int \cos^2(3x) dx = \frac12 \int (1+\cos(6x)) dx = \frac12 \left(x + \frac{\sin(6x)}{6}\right) + C.$$

The method of using integration by parts goes like this (I am changing $\cos(3x)$ to $\cos(x)$ for this example).
$$\int \cos^2(x) dx = \cos(x)\sin(x) + \int \sin^2(x) dx$$ we used $u=\cos(x)$ and $dv = \cos(x)dx$. Now using the pythagorean identity we have:
$$\int \cos^2(x) dx = \cos(x)\sin(x) + \int (1-\cos^2(x)) dx$$
Which leads to:
$$2 \int \cos^2(x) dx =\cos(x)\sin(x) + \int 1 dx.$$
So we have:
$$\int \cos^2(x) dx = \frac12 \left( x + \cos(x)\sin(x) \right) +C.$$
Finally using the double angle formula for $\sin(x)$ we have:
$$\int \cos^2(x) dx = \frac12 \left( x + \frac{\sin(2x)}{2} \right) +C.$$
This is the form we would find if we used the half angle formula.
A: What your instructor told you is $\cos^2(ax) = \frac{1+\cos(2ax)}{2}$ (half angle formula), then you can integrate it easily.
