# 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

• Why do you want to integrate by parts? Your integral is really simple, for it is of the type $\int f(x) f^\prime (x)\ \text{d} x = \frac{1}{2}\ f^2(x) + C$ with $f(x) = \sin x$. Commented Jul 25, 2020 at 23:56
• @Pacciu nevermind I misread what OP wrote. OP meant they did IBP via ${u=\sin(x), dv=\cos(x)dx}$, I thought they did substitution with ${u=\sin(x)}$. I'll edit my answer to explain that substitution is easier Commented Jul 25, 2020 at 23:59
• @Riemann'sPointyNose Yep. And it is not a proper substitution… Maybe it’s one of the most basic rule of integration, coming from the chain rule for differentiation. Commented Jul 26, 2020 at 0:03
• @Pacciu it is a proper substitution, integration by substitution says ${\int_{a}^{b}f(\phi(x))\phi'(x)dx=\int_{\phi(a)}^{\phi(b)}f(u)du}$. In this case, ${f(x)=x,\phi(x)=\sin(x)}$ Commented Jul 26, 2020 at 0:07
• A third way is to note that $\sin(x)\cos(x)=\frac12 \sin(2x)$. Commented Jul 26, 2020 at 0:11

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}$$

• thanks :D I knew the other one was easier, or at least more likely to be thought of first, but I did want to try out different methods to compare answers. Either way, it's good to see it laid out like this too :)
– user612996
Commented Jul 26, 2020 at 0:08
• @Sat no problem! I did think that might be the case (that you wanted to try different methods out to compare), but just in case thought I'd add the little bit about substitution too. Glad it helped! Commented Jul 26, 2020 at 0:09
• And yet a third way is to use the identity $\sin(x)\cos(x)=\frac12 \sin(2x)$. Commented Jul 26, 2020 at 0:12
• @MarkViola Indeed! If OP is interested in extra methods for comparison sake, he might be interested in this too Commented Jul 26, 2020 at 0:13

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.$$

• Per my comment ... Commented Jul 26, 2020 at 0:17