Various ways to calculate $\int \sin(x) \cos(x) \, \mathrm{d}x$ Consider the integral
$$\mathcal{I} := \int \sin(x) \cos(x) \, \mathrm{d} x$$
$
\newcommand{\II}{\mathcal{I}}
\newcommand{\d}{\mathrm{d}}
$
This is one of my favorite basic integrals to think about as an instructor, because on the face of it, there are a lot of different ways to solve it, many are accessible to Calculus I students, and can give some insights into the nature of integration and to some trigonometry identities. For instance:


*

*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.
 A: $$\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$$
A: The following may also be noted:

*

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


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

A: 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$.
A: 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)$$
A: 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{equation}
\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}
\end{equation}
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).
A: 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)$.
A: 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$$
A: 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*}

A: 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 $$
A: Using that $\dfrac{e^{ix}-e^{-ix}}{2i}=\sin x$ and $\dfrac{e^{ix}+e^{-ix}}{2}=\cos x$:$$\int\sin x\cos xdx=\frac{1}{4i}\int e^{2ix}-e^{-2ix}dx=\frac{1}{4i}\left(\frac{1}{2i}e^{2ix}+\frac{1}{2i}e^{-2ix}\right)+C=-\frac{1}{8}\left(e^{2ix}+e^{-2ix}\right)$$It will take some manipulation to realize that $e^{2ix}+e^{-2ix}=2\cos 2x$ (multiply by $2$ in the top and bottom of the fraction) and so we finally get: $$\int\sin x\cos xdx=-\frac{1}{4}\cos 2x+C$$
