<s>[INST] How to evaluate $\int \cos^2x \ dx$ I am new to integration and I want to evaluate
$ \int \cos^2x \, dx $
What I done
Using simple chain rule,
$ \int(\cos x)^2 \\
= \int t^2 \,dt  \ (t = \cos x) \\
= \frac{t^3}{3} \ + C $
By substitution of $t = \cos(x)$ I got with answer.
 [/INST] Another way is to use integration by parts:
$$ \int \cos^2x \, dx $$
$$=\int \cos x \cdot \cos x \, dx $$
$$=\int \cos x \,d(\sin x)$$
$$=\cos x \cdot \sin x -\int \sin x \, d(\cos x) $$
$$=\cos x \cdot \sin x +\int \sin^2 x \, dx $$
So
$$\int \cos^2x \, dx =\cos x \cdot \sin x +\int (1-  \cos^2 x) \, dx $$
$$=\cos x \cdot \sin x + x + C-\int \cos^2 x \, dx $$
Thus 
$$\int \cos^2 x \, dx = \frac{1}{2} (\cos x \cdot \sin x + x + C)$$
$$=\frac{1}{4}\sin 2x + \frac{1}{2} x + C'$$
</s>