# Various ways to calculate $\int \sin(x) \cos(x) \, \mathrm{d}x$

Consider the integral


• Substitution with $$u = \sin(x)$$ gives $$\II = \frac{\sin^2(x)}{2} + C$$

• Substitution with $$u = \cos(x)$$ gives $$\II = - \frac{\cos^2(x)}{2} + C$$

• (Noted in comments by Koro) Make the substitution $$u = \sec(x) \implies \d u = \sec(x) \tan(x) \, \d x= \frac{\sin(x)}{\cos^2(x)} \, \d x$$ Then \begin{align*} \II &= \int \sin(x) \cos(x) \frac{\cos^2(x)}{\sin(x)} \, \d u\\ &= \int u^{-3} \, \d u\\ &= - \frac{1}{2\sec^2(x)} + C\\ &= - \frac{\cos^2(x)}{2} + C \end{align*} A similarly motivated substitution: $$u = \csc(x) \implies \d u = -\cot(x) \csc(x) \, \d x = - \frac{\cos(x)}{\sin^2(x)} \, \d x$$ yields \begin{align*} \II &= -\int \sin(x) \cos(x) \frac{\sin^2(x)}{\cos(x)} \, \d u\\ &= -\int u^{-3} \, \d u\\ &= \frac{1}{2\csc^2(x)} + C\\ &= \frac{\sin^2(x)}{2} + C \end{align*}

• Using $$\sin(2x) = 2 \sin(x) \cos(x)$$ readily leads to $$\II = -\frac{\cos(2x)}{4} + C$$

• Integration by parts differentiating $$\sin(x)$$ yields $$\II = \sin^2(x) - \II$$ which will yield a previous solution on solving for $$\II$$.

• Integration by parts differentiating $$\cos(x)$$ yields $$\II = -\cos^2(x)- \II$$ which, similarly, yields a previous solution once we solve for $$\II$$.

• Using the Weierstrass substitution $$t = \tan(x/2)$$ gives $$\II = \int \frac{2t}{1+t^2} \frac{1-t^2}{1+t^2} \frac{2}{1+t^2} \, \mathrm{d}t = \frac{2t^2}{(1+t^2)^2} + C=\frac{2 \tan^2(x/2)}{(1 + \tan^2(x/2))^2} + C$$

• We can use the complex sine and cosine: $$\sin(x) = \frac{e^{ix} - e^{-ix}}{2i} \qquad \cos(x) = \frac{e^{ix} + e^{-ix}}{2}$$ Then $$\II = \int \frac{e^{2ix} - e^{-2ix}}{4i} \, \mathrm{d} x = - \frac 1 8 \left( e^{2ix} + e^{-2ix} \right) + C = -\frac 1 4 \cos(2x) + C$$

(Warning for Novices: The $$C$$ constant in each expression may not be the same as in others. These answers are equivalent ones for the integral, but the solutions without the $$+C$$ terms are not equal expressions. These hint at certain trigonometry identities, which is why I find them interesting.)

This has given us a set of solutions to $$\II$$ via a few basic methods, and a few less-basic but accessible methods.

My question is, what other solutions can you come up with for $$\II$$?

I'm particularly interested in answers which:

• are obviously not functionally equivalent to those already given
• give answers other than those already expressed (perhaps a hint at other identities or concepts of note?)
• use methods that you don't see in a typical calculus class, or methods that are rarely used
• use unusual but slick and effective techniques

or any combination thereof! I have no real motivation for this but my own curiosity, but I'm curious to see what you guys can think of.

• Hah. I gave this problem to my students and indicated the various ways to solve it as well. You could also take a series approach, though it would probably be messy. Sep 28, 2021 at 3:03
• The last one should be $-\frac14\cos(2x)+C.$ Sep 28, 2021 at 3:28
• This is a common one for me to give to my students, though I've only shown them 1-3. 4 and 5 are accessible at low level though
– Alan
Sep 28, 2021 at 3:33
• One way could be: Substituting $u=\sec x$ so that $du=\sec x\tan x$; and $I=\int \sin x\cos x\,dx=\int \cos x\cos^2 x\,du=\int\frac 1{u^3}\,du=-\frac 12\frac 1{u^2}+c=-\frac{\cos^2x} 2+c$
– Koro
Sep 28, 2021 at 3:50
• (It's Weierstrass, not "Weierstrauss".) Sep 28, 2021 at 8:08

This integral tolarates almost any substitution. In general, let $$\sin x = f(u)$$, where the substitution function $$f(u)$$ is of suitable range, but otherwise arbitrary. Then, $$\cos x \> dx =f’(u)\>du$$ and $$\int \sin x \cos x \>dx =\int f(u)f’(u)du =\frac12f^2(u)=\frac12\sin^2 x+C\tag1$$

Thus, whatever form of $$f(u)$$ to be used, regardless of its complexity, invariably leads to the result $$\frac12\sin^2x+C$$, as shown in (1). As an example, the substitution $$u=\sec x$$ listed in OP corresponds to $$f(u)=\sin(\sec^{-1} u)=\frac{\sqrt{u^2-1}}u,\>\>\> f’(u)= \frac1{u^2\sqrt{u^2-1}}$$ Hence, there are countless number of ways to integrate $$\int \sin x \cos x \>dx$$, all because of unlimited choices of $$f(u)$$.

Write

\begin{align*} \mathcal{J}_+ &= \int (\cos x + \sin x)^2 \, \mathrm{d}x, & \mathcal{J}_- &= \int (\cos x - \sin x)^2 \, \mathrm{d}x. \end{align*}

On one hand, we have

\begin{align*} \mathcal{J}_+ - \mathcal{J}_- = 4 \int \cos x \sin x \, \mathrm{d}x = 4\mathcal{I}. \end{align*}

On the other hand, integration by parts shows that

$$\mathcal{J}_- = (\cos x - \sin x)(\cos x + \sin x) + \mathcal{J}_+.$$

Therefore it follows that

$$\mathcal{I} = \frac{1}{4}(\mathcal{J}_+ - \mathcal{J}_-) = \frac{\sin^2 x - \cos^2 x}{4} + C$$

The following may also be noted:

1. Let $$I'=2\int \sin ^2(x+\frac \pi 4)$$ so that

$$I'=2\int \sin ^2(x+\frac \pi 4)=\int1-\cos(2x+\frac\pi 2)=x-\frac 12\cos 2x$$

Also, $$I'=\int (\sin x+\cos x)^2\,dx=\int1+2\sin x\cos x\,dx=x+2I$$

It follows by FTC that: $$(x+2I)=(x-\frac 12 \cos 2x)+c\implies I=-\frac 14\cos 2x+c'$$, where $$c'$$ is integration constant.

1. Substitution $$u:=\sin^2x$$ quickly gives $$I=\frac u2+c.$$ (Similarly, substitution $$u:=\cos^2x$$ also works).

\begin{align*} \int\sin{x}\cos{x}dx &= \frac{1}{4}\int\frac{4\tan{x}\sec^2{x}}{\sec^2{x}\sec^2{x}}dx\\ &= \frac{1}{4}\int\frac{4\tan{x}\sec^2{x}}{(1+\tan^2{x})^2}dx\\ &=\frac{1}{4}\int\frac{2\tan{x}\sec^2{x}((1+\tan^2{x})-(\tan^2{x}-1))}{(\tan^2{x}+1)^2}dx\\ &=\frac{1}{4}\int\frac{2\tan{x}\sec^2{x}(1+\tan^2{x})-(\tan^2{x}-1) \cdot 2\tan{x}\sec^2{x}}{(\tan^2{x}+1)^2}dx\\ &=\frac{1}{4}\int\frac{(1+\tan^2{x})\frac{d(\tan^2x-1)}{dx}-(\tan^2{x}-1)\frac{d(\tan^2{x}+1)}{dx}}{(1+\tan^2{x})^2}dx\\ &=\frac{1}{4}\int\frac{d}{dx}\frac{(\tan^2x-1)}{(\tan^2x+1)}dx\\ &=\frac{(\tan^2x-1)}{4(\tan^2x+1)}+ C_0 \end{align*}

• If same answer with different methods are allowed then this could be possible.

\begin{align*} I & =\int SC \\ &= S\int C - \int( {S' .\int C})\\ & = S^2 - \int CS = S^2-I \end{align*}

\begin{align*} 2I & =S^2\\ &\implies I = \frac{\sin^2x}{2} +c_0\\ \end{align*}

Of course! When you will take $$CS$$ type you will get $$-\frac{\cos^2{x}}{2}+c_1$$

Let's make a series out of integration by parts. Let

$$I = \int \frac{1}{2}\sin 2x\:dx = \frac{1}{2}x\sin2x-\int x\cos 2x\:dx$$

Then keep going

$$I = \frac{1}{2}x\sin 2x - \frac{1}{2}x^2\cos 2x - \int x^2\sin 2x \;dx$$

$$= \frac{1}{2}x\sin 2x - \frac{1}{2}x^2\cos 2x - \frac{1}{3}x^3\sin 2x + \int\frac{2}{3}x^3\cos 2x\:dx$$

$$= \frac{1}{2}x\sin 2x - \frac{1}{2}x^2\cos 2x - \frac{1}{3}x^3\sin 2x + \frac{1}{6}x^4\cos2x + \int \frac{1}{3}x^4\sin 2x\:dx$$

or in other words the sum of the following two series

$$I = \sin 2x\left(\frac{1}{2}x-\frac{1}{3}x^3+\frac{1}{15}x^5-\cdots\right)-\cos 2x\left(\frac{1}{2}x^2-\frac{1}{6}x^4+\frac{1}{45}x^6-\cdots\right)$$

This needs a small trick.
We know that $$\frac{d}{dx}(\sin x+x)=\cos x + 1$$

\begin{align}\int\sin x \cos x dx &= \int(\sin x \cos x +x\cos x+\sin x+x)dx-\int (x\cos x+\sin x+x)dx\\&=\int(\sin x+x)(\cos x +1)dx-\int x \cos xdx+\int -\sin x dx-\int xdx\end{align} The first part can be solved by assuming $$\sin x + x = u$$ and thus becomes $$\int u du$$, The second part can be solved by IBP. The third part is $$\cos x$$ and the fourth part is $$-\frac{x^2}2$$.

• What is IBP here? Oct 24, 2021 at 4:48

I found another studid (maybe strange and useless way to do that) substitution to find this integral (I don't write $$+C$$ for my comfort):

$$$$\begin{split} \int \sin(x) \cos(x) dx &= \int \sin(x) \cos(x) \frac{\cos(x)}{\cos(x)} dx \\ &= \int \frac{\sin(x)}{\cos(x)} \cos^2(x) dx \hspace{5mm} \text{via} \hspace{2mm} \left(1+\tan^2(x) = \frac{1}{\cos^2(x)}\right)\\ &= \int \frac{\tan(x)}{\tan^2(x)+1} dx \hspace{5mm} \text{via} \hspace{2mm} u = \tan(x)\\ &= \int \frac{u}{(u^2+1)^2}du \\ &= \frac{1}{2} \int \frac{1}{(u^2+1)^2} d(u^2) \\ &= \frac{1}{2} \int \frac{1}{(u^2+1)^2} d(u^2+1) \hspace{5mm} \text{via} \hspace{2mm} t=u^2+1\\ &= \frac{1}{2} \int \frac{dt}{t^2} = \\ &= -\frac{1}{2t} \end{split}$$$$

Now, we do reverse substitution: $$t = u^2+1 \rightarrow u = \tan(x)$$

$$\int sin(x) cos(x) dx = -\frac{1}{2t} = -\frac{1}{2(u^2+1)} = -\frac{1}{2(1 + \tan^2(x))} = -\frac{\cos^2(x)}{2} + C$$

There are a lot of different ways to solve this integral, but must of them a boring and can be done using different substitutions (most of them makeing process of solving integral more complex).

Another way, using half-angles: $$\int\sin x\cos xdx=\int2\sin\frac12x\cos\frac12x\left(2\cos^2\frac12x-1\right)dx$$

Now substitute $$u=\cos\frac12x\implies du=-\frac12\sin\frac12xdx$$

$$\implies I=-4\int(2u^3-u)du=-2u^4+2u^2+c$$ $$\implies I=-2\cos^4\frac12x+2\cos^2\frac12x+c$$

The Wiki page of the Beta function addresses the following substitution \begin{align*} u&=\tan^2 (x)\\ du&=2\tan (x)\left(1+\tan^2 (x)\right) \,dx \end{align*}

We obtain \begin{align*} \color{blue}{\int \sin(x)\cos(x)\,dx}&=\frac{1}{2}\int \sin(2x)\,dx\\ &=\int\frac{\tan(x)}{1+\tan^2(x)}\,dx\\ &=\frac{1}{2}\int\frac{du}{(1+u)^2}\\ &=-\frac{1}{2(1+u)}+C\\ &\,\,\color{blue}{=-\frac{1}{2\left(1+\tan^2(x)\right)}+C} \end{align*}