Skip to content
ihateDesmos

Integral of sec x

Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The integral of sec x
∫
sec(x)
dx =
ln(|sec(x)+tan(x)|)+C

The integral of sec x is ln|sec x + tan x| + C. The trick is multiplying the top and bottom by sec x + tan x, so the top becomes the derivative of the bottom.

−1.0−0.50.51.0−2240
Open in calculator
y=sec(x)
in blue and its integral
y=ln(|sec(x)+tan(x)|)
(with C = 0) in red. Defined for x ≠ π/2 + nπ.

How to integrate sec x

Method: a clever multiplication.

  1. 1
    Multiply by a form of 1: sec x · (sec x + tan x)/(sec x + tan x).
  2. 2
    The top becomes sec²x + sec x tan x.
  3. 3
    Let u = sec x + tan x. Then du = (sec x tan x + sec²x) dx, which is exactly the top.
  4. 4
    So the integral becomes ∫(1/u) du = ln|u|.
  5. 5
    Substitute back: ln|sec x + tan x| + C.

What it means

This integral appears on every Mercator map: the distance from the equator to latitude x on the map is the integral of sec x. Historians trace it to navigators in the 1600s, before calculus existed.

The integral from 0 to π/4

Using the antiderivative: F(π/4) − F(0) = ln(1 + √2), which is about 0.881374. A direct numerical integration of sec x gives 0.881374, which agrees.

−1.5−1−0.50.511.5−4−3−2−1123456

Check by differentiating

The derivative of the answer should give back the original function. The last column measures that slope directly from the answer, and it matches.

Checking the integral
xsec xSlope of the answer
−11.850821.85082
−π/4√2√2
011
π/4√2√2
11.850821.85082

Common mistakes

  • Writing sec x tan x, which is the derivative of sec x, not its integral.
  • Writing tan x, which is the integral of sec²x.

Frequently asked questions

What is the integral of sec x?
The integral of sec x is ln|sec x + tan x| + C, for x ≠ π/2 + nπ.
What is the integral of sec x from 0 to π/4?
ln(1 + √2), which is about 0.881374.
What is the integral of sec³x?
(1/2)(sec x tan x + ln|sec x + tan x|) + C, found by integration by parts.

Keep going

Integrate any function

Type your own function into the integral calculator for the steps, the answer and a graph.

Open the integral calculator