Unabashed Naïveté

Forgotten calculus: integrating powers of sine, powers of cosine, and their products

I cannot integrate to save my life. The purpose of this series will be to attempt to remedy this deplorable and embarrassing situation.

Let’s look at integrals of the form $\int \sin^m x \cos^n x\, dx$.

Case 1: We have an odd exponent

If either of $m$ and $n$ is odd, then we can use the following trick: Suppose it is $m$ that is odd. Then we replace $m-1$ of the factors of $\sin x$ by using the identity $\sin^2 x + \cos^2 x = 1$. For example,

$\displaystyle \int \sin^9 x \cos^6 x \,dx = \int \sin x (\sin^2 x)^4 \cos^6 x \, dx = \int \sin x (1-\cos^2 x)^4 \cos^6 x \, dx$

Now we are happy because we can make the key substitution $u = \cos x$ (and $du = -\sin x \,dx$). This will give us a polynomial in $u$. WIN

This even works with nonpositive powers. Let’s try $\int\sec^3 x\, dx$ (that is, when $m=0$ and $n=-3$):

\begin{aligned} \int (\cos x)^{-3}\,dx &= \int (\cos^2 x)^{-2} \cos x\,dx & \\ &= \int (1-\sin^2 x)^{-2} \cos x\,dx & \\ &= \int (1-u^2)^{-2} \,du &\text{(}u=\sin x\text{ and }du = \cos x\,dx\text{)} \\ &= \int \frac{du}{(1-u^2)^2} & \\ &= \int \left(\frac{1/4}{(1+u)^2} + \frac{1/4}{(1-u)^2} + \frac{1/4}{1+u} + \frac{1/4}{1-u}\right)du & \text{partial fractions, phew}\\ &= -\frac{1/4}{1+u} + \frac{1/4}{1-u} + \frac14 \ln (1+u) - \frac14 \ln (1-u) + C & \\ &= \frac{u/2}{1-u^2} + \frac14 \ln \frac{1+u}{1-u} + C &\\ &= \frac{\sin x}{2\cos^2 x} + \frac14 \ln \frac{1+\sin x}{1-\sin x} +C \end{aligned}

So I checked this on WolframAlpha, which gives

$\displaystyle \int \sec^3 x\, dx = \frac12\left( \tan x\sec x - \ln \left(\cos \frac x2 - \sin \frac x2\right) + \ln \left(\cos \frac x2 + \sin \frac x2\right) \right) +C$

It took me some time to verify that my expression was the same as the real part of WolframAlpha’s answer. It feels almost blasphemous to say it, but it’s weird how such ugly stuff can come out of math. I mean, mathematicians endeavor to make every definition and axiom as fundamental and intuitive and simple as possible, and yet the truths we derive from them, while often beautiful, are also sometimes just awful. It is somewhat depressing to think that the almighty eternal universal truths of mathematics (or at least the as-universal-as-anything-ever-gets truths) can be unpretty sometimes.

Case 2: The exponents are even

If both $m$ and $n$ are even, then the substitutions $u = \sin x$ or $u = \cos x$ fail, because there isn’t a good way to get rid of $dx$ without a leftover cosine or sine to go with it. Instead, we can use the following identities:

$\displaystyle \sin^2 x = \frac{1-\cos 2x}{2}\qquad \cos^2 x = \frac{1+\cos 2x}{2}$

These are just equivalent to the half-angle formulas (or the double angle formulas for cosine). The idea is that these formulas get rid of a power of 2 at the expense of changing the argument of the trig function from $x$ to $2x$. The latter is much more manageable in integrals because $\frac{d}{dx} 2x$ is a constant, so we can just substitute the $2x$ out.

In fact those identities immediately resolve one of the first integration headaches one encounters learning calculus: the integrals $\int \sin^2 x\, dx$ and $\int \cos^2 x\,dx$. We have

\begin{aligned} \int \sin^2 x \,dx &= \int \frac{1-\cos 2x}{2} dx \\ &= \int \frac{dx}2 - \int \frac{\cos 2x\, dx}{2} \\ &= \frac{x}{2} - \frac{\sin 2x}4+C\end{aligned}

\begin{aligned} \int \cos^2 x \,dx &= \int \frac{1+\cos 2x}{2} dx \\ &= \int \frac{dx}2 + \int \frac{\cos 2x\, dx}{2} \\ &= \frac{x}{2} + \frac{\sin 2x}4+C\end{aligned}

So I guess one can survive without memorizing those.

With something like $\int\sin^2x \cos^4x\,dx$ there is a lot more work:

\begin{aligned} \int \sin^2 x \cos^4x\,dx &= \int \left(\frac{1-\cos 2x}{2}\right)\left(\frac{1+\cos 2x}{2}\right)^2 dx\end{aligned}

Expanding gives a third-degree polynomial in $\cos 2x$. The third-degree term can be handled as in Case 1, and we just did the second-degree term right above.

In general, the terms of odd degree belong to Case 1 are thus taken care of; the terms of even degree can have their powers iteratively reduced by the half-angle formulas.