Integrate ${\sin(x)\cos(x)}$ by parts, by letting ${u=\cos(x),dv=\sin(x)dx}$ I was able to integrate by parts using $u=\sin(x)$ but I'm trying to do it the other way.
With $\int \sin\left(x\right) \cos\left(x\right) dx$
$u = \cos\left(x\right)$
$dv = \sin\left(x\right) dx$
$v = -\cos\left(x\right)$
Then,
$I = uv - \int v \ du = -\cos\left(x\right)\cos\left(x\right) + \int \cos\left(x\right)\sin\left(x\right) \ dx$
but then I get $I = -\cos^2\left(x\right) + I \, $ and those $I$'s would cancel out and I would get zero? Assuredly, I'm missing a negative sign somewhere
 A: You are indeed missing a minus sign. ${\frac{d}{dx}(\cos(x))=-\sin(x)}$. So the ${-\int vdu}$ part actually is
$${-\int (-\cos(x))(-\sin(x))dx=-\int\sin(x)\cos(x)=-I}$$
So
$${I = \cos^2(x) - I}$$
Which implies that
$${I = \frac{\cos^2(x)}{2}}$$
(obviously add the +c at the end). As required
Edit: This is a working solution (and nothing wrong with it). However, it's worth noting that it's also doable just by standard substitution. Notice that it is of the form
$${\int f(x)f'(x)dx}$$
where ${f(x) = \sin(x)}$. Letting ${u=\sin(x)}$ you get that ${du = \cos(x)dx\Rightarrow dx=\frac{du}{\cos(x)}}$, hence
$${\Rightarrow \int u\cos(x)\frac{du}{\cos(x)}=\int udu=\frac{1}{2}u^2 + c}$$
but we know ${u=\sin(x)}$ so
$${\int \sin(x)\cos(x)dx = \frac{1}{2}\cos^2(x) + c}$$
So both solutions give the same answer, but indeed substitution is easier :)
Edit Edit: @MarkViola gave yet another way to integrate this by using the identity ${\sin(2x)=2\sin(x)\cos(x)}$. Notice that means your function, ${\sin(x)\cos(x)}$ is nothing but ${\frac{\sin(2x)}{2}}$, and hence
$${\int \sin(x)\cos(x)dx = \int \frac{\sin(2x)}{2}dx=-\frac{1}{4}\cos(2x)+c}$$
A: An easier way to do it is use a double angle identity.
$$I=\int \frac{\sin(2x)}{2}\mathrm{d}x$$
$$I=\frac{-\cos(2x)}{4}+C$$
Integration by parts also works though.
$$I=\int \sin(x)\cos(x)\mathrm{d}x$$
$$u=\cos(x), \mathrm{d}u=-\sin(x)\mathrm{d}x, \mathrm{d}v=\sin(x)\mathrm{d}x, v=-\cos(x)$$
$$I=-\cos(x)\cos(x)-\int -\cos(x)(-\sin(x))\mathrm{d}x$$
$$I=-\cos^2(x)-I$$
$$I=\frac{-\cos^2(x)}{2}+C.$$
