Calculus – Curious Result from Mathematica on ?sin?xcos?x dx

calculustrigonometric-integrals

While creating an answer key for my Calc 2 students and trying to save a bit of time, I plugged a trigonometric integral into Mathematica and was a little confused about how it approached the problem. The integral was
$$
\int\sin^5x\cos^7x \,dx
$$

The typical way to evaluate this integral would be to use the Pythagorean identity and a substitution. Something like this:

\begin{align*}
\int\sin^5x\cos^7x \,dx
&= \int (\sin x)\big(\sin^4 x\big)\cos^7x\,dx \\
&= \int(\sin x)\big(1-\cos^2 x\big)^2\cos^7 x\, dx \\
&= -\int \big(1-u^2\big)^2u^7\, du \\
&= -\int u^7-2u^9+u^{11}\,du \\
&= -\frac{u^8}{8}+\frac{u^{10}}{5}-\frac{u^{12}}{12}+C \\
&= -\frac{\cos^8 x}{8}+\frac{\cos^{10}x}{5}-\frac{\cos^{12}x}{12}+C
\end{align*}

Where I've used the substitution $u=\cos x$. We also could have used $u=\sin x$ to get
$$
\int\sin^5x\cos^7x \,dx = \frac{\sin^6 x}{6} -\frac{3\sin^8 x}{8}+\frac{3\sin^{10}}{10}-\frac{\sin^{12} x}{12}+C
$$

which is equivalent up to an added constant.

When I plugged the integral into Mathematica, it spat out
$$
-\frac{5\cos 2x}{1024}
-\frac{5\cos 4x}{8192}
+\frac{5\cos 6x}{6144}
+\frac{\cos 8x}{4096}
-\frac{\cos 10x}{10240}
-\frac{\cos 12x}{24576}
+C
$$

I know this is equivalent to the other two answers. It's a bit tedious to do, but playing around with identities will show this. My question is how could we arrive at this result in a natural way?

From the arguments of $\cos$ being even multiples of $x$ and the powers of 2 showing up in the denominators, it's clear that the power reducing identities are being used. (That is, $\cos^2 x = \frac{1+\cos 2x}2$ and/or $\sin^2 x = \frac {1-\cos 2x}2$.) Typically we would use these if we were evaluating $\int \sin^mx\cos^nx\,dx$, where $m$ and $n$ are both even. But with $m$ and $n$ both odd, I'm perplexed. I haven't been able to find an approach that doesn't require applying these identities after integrating.

I've attempted to rewrite the integrand in terms of even powers of $\sin$ and $\cos$, but that was a dead end. I also tried rewriting the integral as
\begin{align*}
\int\sin^5x\cos^7x \,dx
&= \frac 1{32} \int \big(\sin^5 2x\big) \big(\cos^2 x\big)\,dx \\
&= \frac 1{64} \int \big(\sin^5 2x\big) \big(1+\cos 2x\big)\,dx
\end{align*}

but this didn't quite get me there.

I'd appreciate any help figuring this out, thanks!

Best Answer

Let $z=e^{ix}$. $$\begin{align}\sin^5x\cos^7x&=\left(\frac{z-\bar z}{2i}\right)^5\left(\frac{z+\bar z}2\right)^7\\ &=\frac1{2^{12}i}\left(z^5-5z^3+10z-10\bar z+5\bar z^3-\bar z^5\right)\\ &\quad\left(z^7+7z^5+21z^3+35z+35\bar z+21\bar z^3+7\bar z^5+\bar z^7\right)\\ &=\frac1{2^{12}i}\left(z^{12}+2z^{10}-4z^8-10z^6+5z^4+20z^2\right.\\&\quad\left.-20\bar z^2-5\bar z^4+10\bar z^6+4\bar z^8-2\bar z^{10}-\bar z^{12}\right)\\ &=\frac1{2^{11}}\left(\sin(12x)+2\sin(10x)-4\sin(8x)-10\sin(6x)+5\sin(4x)+20\sin(2x)\right), \end{align} $$ hence $$\begin{align} \int\sin^5x\cos^7x \,dx &=-\frac{\cos(12x)}{2^{10}\cdot24}-\frac{\cos(10x)}{2^{10}\cdot10}+\frac{\cos(8x)}{2^{10}\cdot4}+5\frac{\cos(6x)}{2^{10}\cdot6}-5\frac{\cos(4x)}{2^{10}\cdot8}-5\frac{\cos(2x)}{2^{10}}+C, \end{align} $$ which is Mathematica's result.