Where did I go wrong in my evaluation of the integral of cosine squared? $$\int{\cos^2(x)}dx$$
Where did I go wrong in my evaluation of this integral?
$$=x\cos^2x - \int-2x\sin(x)\cos(x)\,dx$$
$$=x\cos^2x + \int x\sin(2x)\,dx$$
$$=x\cos^2x + \left(\frac {-x\cos(2x)}2 -\int \frac{-\cos(2x)}2\,dx\right)$$
$$=x\cos^2x + \left(\frac {-x\cos(2x)}2 + \frac 12\cdot\frac{\sin(2x)}2\right)$$
$$x\cos^2x-\frac{x\cos(2x)}2+\frac{\sin(2x)}4 + C$$
And this is clearly wrong, but I don't know where I messed up in my calculations. Would anyone mind correcting me somewhere?
 A: $$
\int \cos^2 x dx = \int \frac{1 + \cos(2x)}{2}dx = \frac{x}{2} + \frac{\sin(2x)}{4} + C
$$
A: As noted above, your answer is actually correct, you just have a duplication that cancels.
Alternatively, $\int (1-\sin^2x)\,dx = \int\cos^2 x\,dx$
So: $$\int(\cos^2 x + 1 -\sin^2 x)\,dx = 2\int\cos^2x\,dx.$$ 
Now, $\cos^2 x -\sin^2 x = \cos 2x$. So the left hand side is:
$$\int(1+\cos(2x))\,dx = x + \frac{1}{2}\sin(2x) + C$$
Dividing by $2$ and substituting for $\sin(2x)=2\sin x\cos x$, we get:
$$\frac{x+\sin(x)\cos(x)}{2}+C'$$
A: Your answer is perfectly correct, albeit it is given in a more complicated form than necessary. A little simplification (replacing the $\cos 2x$ by $2\cos^2 x-1$) will put it in standard form.
A: Using the formula $\displaystyle \bullet \; 2\cos^2 x = 1+\cos 2x$
So $$\displaystyle I = \frac{1}{2}\int 2\cos^2 xdx =\frac{1}{2}\int \left[1+\cos 2x\right]$$
So $$\displaystyle I = \frac{1}{2}\int 1 dx + \frac{1}{2}\int \cos 2x dx = \frac{1}{2}x+\frac{1}{4}\sin 2x+\mathcal{C}$$
A: Notice, 
$$\int \cos^2 x dx=\int \cos x \cos x dx$$
$$=\int \cos x\sqrt{1-\sin ^2 x}dx$$
Let $\sin x=t\implies \cos x dx=dt$
$$\int \sqrt {1-t^2}dt$$
$$=\frac{1}{2}\left[t\sqrt {1-t^2}+\sin^{-1}(t)\right]$$ 
$$=\frac{1}{2}\left[\sin x\sqrt {1-sin^2x}+\sin^{-1}(\sin x)\right]$$ 
$$=\frac{1}{2}\left[\sin x\cos x+x\right]+C$$ 
$$=\frac{1}{2}\sin x\cos x+\frac{x}{2}+C$$ 
$$=\frac{x}{2}+\frac{1}{4}\sin2x+C$$ 
A: Notice,Let  $$I=\int \cos^2 xdx$$
$$\implies I=\int \cos x\cos xdx$$ $$=\cos x\int \cos x-\int (-\sin x)\sin xdx$$ $$=\cos x(\sin x)+\int \sin^2 xdx$$ $$=\frac{1}{2}(2\sin x \cos x)+\int (1-\cos^2 x)dx$$ $$=\frac{1}{2}\sin 2x+\int dx-\int \cos^2 xdx$$
$$I=\frac{1}{2}\sin 2x+x-I+c$$
$$2I=\frac{1}{2}\sin 2x+x+c$$
$$I=\frac{1}{4}\sin 2x+\frac{x}{2}+C$$
