Integral of sec x: Formula, Derivation and Examples
The integral of sec x is ln|sec x + tan x| + C. See the multiply-by-one trick step by step, the equivalent forms, a check by differentiating and examples.
Trigonometric integrals Updated 3 min read
At a glance
- Antiderivative
- \ln\lvert\sec x + \tan x\rvert + C
- Method
- Multiply by \dfrac{\sec x + \tan x}{\sec x + \tan x}
- Equivalent form
- \dfrac{1}{2}\ln\left\lvert\dfrac{1 + \sin x}{1 - \sin x}\right\rvert + C
- Another form
- \ln\left\lvert\tan\left(\dfrac{x}{2} + \dfrac{\pi}{4}\right)\right\rvert + C
- From 0 to π/4
- \ln\left(1 + \sqrt{2}\right) \approx 0.881
On this page
The integral of \sec x is \ln\lvert\sec x + \tan x\rvert + C. It is famous because the standard derivation relies on a trick that nobody would guess at first, and it shows up again inside harder integrals like \int\sec^3 x\,dx.
Graph of sec x and the area under it
Derivation, step by step
- Multiply by a clever form of 1: \int\sec x\,dx = \int\sec x\cdot\frac{\sec x + \tan x}{\sec x + \tan x}\,dx = \int\frac{\sec^2 x + \sec x\tan x}{\sec x + \tan x}\,dx
- Look at the denominator u = \sec x + \tan x. Its derivative is \sec x\tan x + \sec^2 x, which is exactly the numerator.
- So du = (\sec^2 x + \sec x\tan x)\,dx and the integral becomes \int\frac{du}{u}.
- Integrate: \ln\lvert u\rvert + C = \ln\lvert\sec x + \tan x\rvert + C.
Step 2 uses the derivative of sec x and the derivative of tan x. Step 4 uses the integral of 1/x.
Check by differentiating
Equivalent forms
You may see other answers in tables or from software. They are all the same function.
Since \sec x + \tan x = \frac{1 + \sin x}{\cos x}, squaring gives
So \ln\lvert\sec x + \tan x\rvert = \frac{1}{2}\ln\left\lvert\frac{1 + \sin x}{1 - \sin x}\right\rvert. A half-angle identity also gives \ln\left\lvert\tan\left(\frac{x}{2} + \frac{\pi}{4}\right)\right\rvert. This last form is the one Mercator's map projection uses to space lines of latitude, which is how the integral was first discovered.
Definite integrals
Because \sec x is even, \int_{-a}^{a}\sec x\,dx = 2\ln(\sec a + \tan a) for 0 < a < \frac{\pi}{2}.
Substitution variants
For example, \int\sec(2x)\,dx = \frac{1}{2}\ln\lvert\sec 2x + \tan 2x\rvert + C.
Worked examples
Example 1: rewrite first. \int\frac{1}{\cos x}\,dx is just \int\sec x\,dx = \ln\lvert\sec x + \tan x\rvert + C.
Example 2: a sum. \int(\sec x + \sec^2 x)\,dx = \ln\lvert\sec x + \tan x\rvert + \tan x + C.
Example 3: inside a bigger integral. Integration by parts turns \int\sec^3 x\,dx into \frac{1}{2}\sec x\tan x + \frac{1}{2}\int\sec x\,dx. See the integral of sec³ x.
Example 4: from a trig substitution. \int\frac{dx}{\sqrt{x^2 + 1}} with x = \tan\theta becomes \int\sec\theta\,d\theta = \ln\lvert\sec\theta + \tan\theta\rvert + C = \ln\left(\sqrt{x^2 + 1} + x\right) + C.
Common mistakes
- Answering \sec x\tan x. That is the derivative of \sec x. Its integral is in the integral of sec x tan x page, going the other way.
- Answering \ln\lvert\sec x\rvert. That is the integral of tan x.
- Answering \tan x. That comes from \sec^2 x, not \sec x.
- Dropping the absolute value on intervals where \sec x + \tan x < 0.
The cosecant version works the same way: see the integral of csc x.
Practice it now
Powers of sine and cosine
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson