How do I solve $\int4\cos^2(x) dx$? I have the basic idea of how to work out the integral of a trig function, but am having trouble in applying the concept. Would really appreciate it if someone could help me. Thanks!

$\int 4 \cos^2(x) dx$

$\mathrm{Take\:the\:constant\:out}:\quad \int a\cdot f\left(x\right)dx=a\cdot \int f\left(x\right)dx$

$=4\int\cos^2(x) dx$

$\mathrm{Use\:the\:following\:identity}:\quad \cos ^2\left(x\right)=\frac{1+\cos \left(2x\right)}{2}$

$=4\int \frac{1+\cos \left(2x\right)}{2}dx$

$\mathrm{Take\:the\:constant\:out}:\quad \int a\cdot f\left(x\right)dx=a\cdot \int f\left(x\right)dx$

$=4\frac{1}{2}\int \:1+\cos \left(2x\right)dx$

$\mathrm{Apply\:Integral\:Substitution:}\:\int
> f\left(g\left(x\right)\right)\cdot g^{'}\left(x\right)dx=\int
> f\left(u\right)du,\:\quad u=g\left(x\right)$
$\mathrm{Substitute:}\:u=2x$
$\frac{du}{dx}=2$
$\quad \Rightarrow \:du=2dx$
$\Rightarrow \:dx=\frac{1}{2}du$
$=\int \left(1+\cos \left(u\right)\right)\frac{1}{2}du$

$=4\frac{1}{2}\int \left(1+\cos \left(u\right)\right)\frac{1}{2}du$

$\mathrm{Take\:the\:constant\:out}:\quad \int a\cdot f\left(x\right)dx=a\cdot \int f\left(x\right)dx$

$=4\frac{1}{2}\frac{1}{2}\int \:1+\cos \left(u\right)du$

$\mathrm{Apply\:the\:Sum\:Rule}:\quad \int f\left(x\right)\pm g\left(x\right)dx=\int f\left(x\right)dx\pm \int g\left(x\right)dx$

$=4\frac{1}{2}\frac{1}{2}\left(\int \:1du+\int \cos \left(u\right)du\right)$
$=4\frac{1}{2}\frac{1}{2}\left(u+\sin \left(u\right)\right)$

$\mathrm{Substitute\:back}\:u=2x$

$=4\frac{1}{2}\frac{1}{2}\left(2x+\sin \left(2x\right)\right)$

$\mathrm{Simplify}$

$=2x+\sin \left(2x\right)$

$Add\:a\:constant\:to\:the\:solution$

$=2x+\sin \left(2x\right)+C$
