# Ask Uncle Colin: Integrating $\sec$ and $\cosec$

Dear Uncle Colin,

I keep forgetting how to integrate $\sec(x)$ and $\cosec(x)$. Do you have any tips?

- Literally Nothing Memorable Or Distinctive

Hi, LNMOD, and thanks for your message!

Integrating $\sec(x)$ and $\cosec(x)$ relies on a trick, and one the average mathematician probably wouldn’t come up with without a hint.

### Multiply by 1

Two of the mathematician’s greatest tricks are “adding zero” and “multiplying by 1” (in a sense, that’s only one trick). Here, we’ll be multiplying by 1; the tricky bit of the trick is to pick exactly *how* to multiply by 1.

For $\int \sec(x) \dx$, the way to do it is to multiply by $\frac{1 + \sin(x)}{1+\sin(x)}$ – one more than the ‘other’ trig function.

Now you have $\int \frac{1}{\cos(x)} \cdot \frac{1 + \sin(x)}{1+\sin(x)} \dx$ or $\frac{1+\sin(x)}{\cos(x)\br{1+\sin(x)}}$.

Split the 1 on top up into $\cos^2(x) + \sin^2(x)$ and do a little factorising magic to make it $\frac{\cos^2(x) + \sin(x)\br{1+\sin(x)}}{\cos(x)\br{1+\sin(x)}}$.

Now you can split the fraction into two as $\frac{\cos^2(x)}{\cos(x)\br{1+\sin(x)} }+ \frac{\sin(x)\br{1+\sin(x)}}{\cos(x)\br{1+\sin(x)}}$, or $\frac{\cos(x)}{1+\sin(x)} + \frac{\sin(x)}{\cos(x)}$.

We know how to integrate both of those things! Either you spot that $\int \frac{\cos(x)}{1+\sin(x)} \dx$ is function-derivative, or you use the substitution $u = 1+\sin(x)$ and find that it’s $\ln \left| 1 + \sin(x) \right|+C$. Meanwhile, $\int \tan(x) \dx = \ln | \sec(x) | + c$.

Adding those together gives $\ln |1 + \sin(x) | + \ln |\sec(x)| + K$, or $\ln | \sec(x) + \tan(x) | + K$ - the way the answer is typically given.

### And for $\cosec(x)$?

It goes almost exactly the same way - the only real differences being that the multiplier is $\frac{1+\cos(x)}{1+\cos(x)}$ and there are minus signs knocking about in the integral.

Hope that helps!

- Uncle Colin