A student asks:

How do you integrate $\int_{0}^{\frac{\pi}{4}} \sec^4(x) \d x$?


Let me say that again for good measure: yuk.

That’s going to need a trigonometric identity and, I think, a substitution. But that’s ok: we can do that. Let’s roll up our sleeves.

Step 1: get rid of some $\sec^2(x)$s

Very famous trig identity: $\sec^2(x) \equiv 1 + \tan^2(x)$. (You can remember which way round it goes, because $\sec(0)=1$ and $\tan(0)=0$). If we split $\sec^4(x)$ up as $\sec^2(x) \cdot \sec^2(x)$, we can turn the integral into: $ \int_0^{\frac{\pi}{4}} \sec^2(x) \left[ 1 + \tan^2(x) \right] \d x$ This expands into: $ \int_0^{\frac{\pi}{4}} \sec^2(x) + \sec^2(x)\tan^2(x) \d x$

Step 1.5: Deal with the first term

The first half of the integral is almost trivial - it’s just going to be $\left[ \tan(x) \right]_0^{\frac{\pi}{4}} = (1) - (0) = 1$.

That leaves us with: $ 1 + \int_0^{\frac{\pi}{4}} \sec^2(x) \tan^2(x) \d x$

Step 2: make a substitution

Since we know $\sec^2(x)$ is the derivative of $\tan(x)$, it makes sense to pick a substitution like $u = \tan(x)$.

Taking it slowly, start by replacing the $\d x$: you know that $\diff u x = \sec^2(x)$, so $\d x = \frac {1}{\sec^2(x)} \d u$ (one of the rare times you’ll see me write that horror-show of a fraction).

Then replace the $\tan^2(x)$ with $u^2$.

Lastly, the limits: when $x=0$, $u = 0$; when $x=\frac{\pi}{4}$, $u = 1$. We’ve now got: $1 + \int_0^1 \sec^2(x) \cdot u^2 \cdot \frac{1}{\sec^2(x)} \d u$, and the $\sec^2(x)$s cancel. Woohoo! $1 + \int_0^1 u^2 \d u = 1 + \left[ \frac 13 u^3 \right]_0^1 = \frac 43$. That came out nicely, didn’t it?

Step 3: Check the answer anyway

How do you go about checking that’s a plausible answer? Well, the trapezium is your friend. $\sec^4(0) = 1$, and $\sec^4\left(\frac{\pi}{4}\right) = 4$. A decent first estimate of the area under the curve would be $\frac{1}{2} \cdot \frac{\pi}{4} \cdot (1+4) = \frac{5}{8}\pi$. That’s a bit on the high side (a bit less than 2), but not completely implausible. Alternatively, you can use the full-width-half-maximum approximation and say that the half-maximum is when $\sec^4(x) = 2.5$, midway between the top and the bottom of the curve. That’s about $0.65$ radians, and the width at that point is the difference between that and $\frac{\pi}{4}$, which is about $0.13$. The area between the graph and the line $y=1$ is then about $3 \times 0.13 = 0.40$, using the exact answer while the area under the line is $\frac{\pi}{4} \approx 0.79$. Adding those up gives 1.19, which is much closer to the answer we expected. (Why are the approximations some way off? That’s really a question for another blog; it’s because the curve $y=\sec^4(x)$ is slightly badly-behaved – it’s skewed very heavily to the right, while the approximations depend on it being pretty much a straight line (trapezium rule) or pretty much Gaussian (FWHM). Luckily, neither is so far away as to give us too much pause.

In a Core 4 exam, you’d almost certainly be given some sort of a hint of how to do this, if you were asked it at all.