Calculus · Indefinite integrals
Trigonometric integrals are everywhere: areas bounded by curves in polar coordinates, arc lengths, Fourier series, oscillations in physics. There is one substitution that handles them all, and a toolbox of shortcuts that handles most of them faster. This post explains both: when the heavy machinery is needed, and how to avoid it when it is not.
As in the previous post, \(R(u, v)\) denotes a rational function: an expression built from \(u\), \(v\) and constants using \(+, -, \times, \div\). Here \(u = \sin x\), \(v = \cos x\), e.g. \( \frac{1 + \sin x}{\sin x(1 + \cos x)} \).
Where the formulas come from. Using the double-angle formulas and dividing by \( 1 = \cos^2\frac x2 + \sin^2\frac x2 \):
\[ \sin x = \frac{2\sin\frac x2\cos\frac x2}{\cos^2\frac x2 + \sin^2\frac x2} = \frac{2\tan\frac x2}{1 + \tan^2\frac x2}, \qquad \cos x = \frac{\cos^2\frac x2 - \sin^2\frac x2}{\cos^2\frac x2 + \sin^2\frac x2} = \frac{1 - \tan^2\frac x2}{1 + \tan^2\frac x2}, \]and from \( x = 2\arctan t \), \( dx = \frac{2\,dt}{1 + t^2} \). All three are rational in \(t\), so the whole integrand becomes rational, and partial fractions finish the job. That is why the substitution is called universal: it always works.
The universal substitution often leads to unpleasant rational functions of high degree. In many common cases a simpler substitution does the job, and the symmetry of \(R\) tells you which:
| If | Substitute | Typical example |
|---|---|---|
| \(R(-\sin x, \cos x) = -R(\sin x, \cos x)\) (odd in \(\sin\)) | \(t = \cos x\) | \(\sin^3 x\), \(\frac{\sin x}{1 + \cos^2 x}\) |
| \(R(\sin x, -\cos x) = -R(\sin x, \cos x)\) (odd in \(\cos\)) | \(t = \sin x\) | \(\sin^2 x\cos^3 x\) |
| \(R(-\sin x, -\cos x) = R(\sin x, \cos x)\) | \(t = \tan x\) | \(\frac{1}{1 + \sin^2 x}\), \(\frac{1}{\sin x\cos x}\) |
Why the first one works: if \(R\) is odd in \(\sin x\), then \( R(\sin x, \cos x) = \sin x\cdot R_1(\sin^2 x, \cos x) \) for a rational \(R_1\). With \(t = \cos x\), \( \sin x\,dx = -dt \) and \( \sin^2 x = 1 - t^2 \): everything is rational in \(t\). The other two cases are similar (for the third, \(\sin^2 x = \frac{t^2}{1 + t^2}\), \(\cos^2 x = \frac{1}{1 + t^2}\), \(dx = \frac{dt}{1 + t^2}\)).
For odd powers the shortcut of Section 2 is quickest. For even powers, there are two options: lower the power with \( \sin^2 x = \frac{1 - \cos 2x}{2} \), \( \cos^2 x = \frac{1 + \cos 2x}{2} \), or use a reduction formula.
Derivation (for the sine). Write \( \sin^n x = \sin^{n-1}x\cdot\sin x \) and integrate by parts with \( u = \sin^{n-1}x \), \( dv = \sin x\,dx \):
\[ I_n = -\sin^{n-1}x\cos x + (n - 1)\int\sin^{n-2}x\cos^2 x\,dx. \]Replace \( \cos^2 x = 1 - \sin^2 x \): the last integral is \( I_{n-2} - I_n \). So \( I_n = -\sin^{n-1}x\cos x + (n - 1)I_{n-2} - (n - 1)I_n \), and solving for \(I_n\) gives the formula. The trick of "the integral reappearing on the right" is worth remembering; it comes up again and again.
Each application lowers the power by \(2\), until \( \int dx = x \) or \( \int\sin x\,dx = -\cos x \) is reached.
On \([0, \frac\pi2]\) the boundary term \( \sin^{n-1}x\cos x \) vanishes at both ends, so the reduction formula becomes simply \( W_n = \frac{n - 1}{n}W_{n-2} \) for \( W_n = \int_0^{\pi/2}\sin^n x\,dx \) (and the same for cosine). Starting from \( W_0 = \frac\pi2 \), \( W_1 = 1 \):
\[ \int_0^{\pi/2}\sin^n x\,dx = \begin{cases}\dfrac{(n - 1)(n - 3)\cdots 1}{n(n - 2)\cdots 2}\cdot\dfrac\pi2, & n \text{ even},\\[2ex] \dfrac{(n - 1)(n - 3)\cdots 2}{n(n - 2)\cdots 3}, & n \text{ odd}.\end{cases} \]For example \( \int_0^{\pi/2}\sin^4 x\,dx = \frac34\cdot\frac12\cdot\frac\pi2 = \frac{3\pi}{16} \) and \( \int_0^{\pi/2}\sin^5 x\,dx = \frac45\cdot\frac23 = \frac{8}{15} \).
These are the formulas of Section 3 run "backwards": put \(n \to -n + 2\) into the formula for \(\int\sin^n x\,dx\) and solve for the integral with the more negative power. The chain ends at
\[ \int\frac{dx}{\sin x} = \ln\Big|\tan\frac x2\Big|, \qquad \int\frac{dx}{\cos x} = \ln\Big|\tan\Big(\frac x2 + \frac\pi4\Big)\Big|, \qquad \int\frac{dx}{\sin^2 x} = -\cot x, \qquad \int\frac{dx}{\cos^2 x} = \tan x. \]The first formula lowers the power of the cosine by 2, the second the power of the sine. In practice, it is usually faster to choose by parity:
These follow by adding or subtracting the addition formulas, e.g. \( \cos(\alpha - \beta) - \cos(\alpha + \beta) = 2\sin\alpha\sin\beta \). After the conversion, each term is a single sine or cosine, which integrates immediately.
| Integral | Method |
|---|---|
| \( \int R(\sin x, \cos x)\,dx \) | \( t = \tan\frac x2 \) (always works), or the shortcuts \( t = \cos x \), \( t = \sin x \), \( t = \tan x \) |
| \( \int\sin^n x\,dx \), \( \int\cos^n x\,dx \) | odd \(n\): \(t = \cos x\) / \(t = \sin x\); even \(n\): halve the angle or reduction formula |
| \( \int_0^{\pi/2}\sin^n x\,dx \) | Wallis: \( W_n = \frac{n - 1}{n}W_{n-2} \) |
| \( \int\frac{dx}{\sin^n x} \), \( \int\frac{dx}{\cos^n x} \) | reduction formulas, ending at \( \ln|\tan\frac x2| \) or \( \ln|\tan(\frac x2 + \frac\pi4)| \) |
| \( \int\sin^m x\cos^n x\,dx \) | an odd power: split off one factor; both even: double angle; or reduction formulas |
| \( \int\sin px\cos qx\,dx \) etc. | product-to-sum identities |
Try each one before opening the solution. More solved problems from this topic are in Integrals.
\( \int(1 - \sin^2 x)^2\cos x\,dx \), \(t = \sin x\): \( \int(1 - 2t^2 + t^4)\,dt = \sin x - \frac23\sin^3 x + \frac15\sin^5 x + C \).
The integrand is unchanged under \( (\sin, \cos) \to (-\sin, -\cos) \), so \(t = \tan x\): \( \int\frac{dt}{t} = \ln|\tan x| + C \). (Or: \( \frac{1}{\sin x\cos x} = \frac{2}{\sin 2x} \).)
Wallis: \( \frac56\cdot\frac34\cdot\frac12\cdot\frac\pi2 = \frac{5\pi}{32} \).
\(t = \tan\frac x2\): the denominator becomes \( \frac{(1 + t^2) + 2t + (1 - t^2)}{1 + t^2} = \frac{2(1 + t)}{1 + t^2} \), so the integral is \( \int\frac{dt}{1 + t} = \ln\big|1 + \tan\frac x2\big| + C \).
\( \cos x\cos 3x = \frac12(\cos 2x + \cos 4x) \), so the integrand is \( \frac12(\cos^2 2x + \cos 2x\cos 4x) = \frac14(1 + \cos 4x) + \frac14(\cos 2x + \cos 6x) \). Integral: \( \frac x4 + \frac{\sin 2x}{8} + \frac{\sin 4x}{16} + \frac{\sin 6x}{24} + C \).
Parts with \( u = \cos^{n-1}x \), \( dv = \cos x\,dx \): \( I_n = \cos^{n-1}x\sin x + (n - 1)\int\cos^{n-2}x\sin^2 x\,dx = \cos^{n-1}x\sin x + (n - 1)(I_{n-2} - I_n) \). Solve for \(I_n\).
For trigonometric integrals, the universal substitution \(t = \tan\frac x2\) is the guarantee: it turns any rational expression in \(\sin x\) and \(\cos x\) into a rational function. But the guarantee is expensive, so check the cheaper routes first. Is the integrand odd in \(\sin\) or \(\cos\)? Can the powers be halved by the double-angle formulas? Is it a product of different frequencies, ready for product-to-sum? Reduction formulas, all derived by the same parts-and-solve trick, cover the rest, and on \([0, \frac\pi2]\) they give Wallis's formula almost for free.
Related posts: integrating irrational functions, Fourier series (where orthogonality is used), and Euler integrals (where Wallis-type integrals reappear through the beta function).