TITLE: Various ways to calculate $\int \sin(x) \cos(x) \, \mathrm{d}x$
QUESTION [28 upvotes]: 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.

REPLY [2 votes]: 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*}