AP Calculus AB and BC

Integral of sec x: Proof, Formula, and Mistakes

The integral of sec x is ln|sec x + tan x| + C. The proof multiplies sec x by (sec x + tan x)/(sec x + tan x), so the numerator becomes exactly the derivative of the denominator, and the substitution u = sec x + tan x turns the problem into the integral of du/u.

∫sec⁡x dx=ln⁡∣sec⁡x+tan⁡x∣+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C

How to integrate sec x

There is no rule in Unit 6 that hands you ∫sec⁡x dx\int \sec x\,dx directly. The standard route is a multiplication by 1, chosen so that a substitution appears. Multiply the integrand by sec⁡x+tan⁡xsec⁡x+tan⁡x\frac{\sec x + \tan x}{\sec x + \tan x}.

∫sec⁡x dx=∫sec⁡x⋅sec⁡x+tan⁡xsec⁡x+tan⁡x dx=∫sec⁡2x+sec⁡xtan⁡xsec⁡x+tan⁡x dx\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

Now set u=sec⁡x+tan⁡xu = \sec x + \tan x. Differentiating gives sec⁡xtan⁡x+sec⁡2x\sec x \tan x + \sec^2 x, which is exactly the numerator you just built.

u=sec⁡x+tan⁡x,du=(sec⁡xtan⁡x+sec⁡2x) dxu = \sec x + \tan x, \qquad du = \left(\sec x \tan x + \sec^2 x\right)\,dx

The whole integral collapses to the logarithm pattern.

∫duu=ln⁡∣u∣+C=ln⁡∣sec⁡x+tan⁡x∣+C\int \frac{du}{u} = \ln|u| + C = \ln\left|\sec x + \tan x\right| + C

Why the conjugate works

Nothing mystical is happening: multiplying by 1 is always legal, and this particular 1 is picked so the numerator becomes the derivative of the denominator. That is the pattern ∫u′u dx=ln⁡∣u∣+C\int \frac{u'}{u}\,dx = \ln|u| + C, and recognizing it is the real skill Topic 6.9 is testing.

Checking the answer by differentiating

Every antiderivative is verifiable in one line, and on a free-response question that check costs almost nothing. Differentiate ln⁡∣sec⁡x+tan⁡x∣\ln\left|\sec x + \tan x\right| with the chain rule, using ddx[sec⁡x]=sec⁡xtan⁡x\frac{d}{dx}[\sec x] = \sec x \tan x and ddx[tan⁡x]=sec⁡2x\frac{d}{dx}[\tan x] = \sec^2 x.

ddx[ln⁡∣sec⁡x+tan⁡x∣]=sec⁡xtan⁡x+sec⁡2xsec⁡x+tan⁡x\frac{d}{dx}\left[\ln\left|\sec x + \tan x\right|\right] = \frac{\sec x \tan x + \sec^2 x}{\sec x + \tan x}

Factor sec⁡x\sec x out of the numerator and the bracket cancels the denominator.

sec⁡x(tan⁡x+sec⁡x)sec⁡x+tan⁡x=sec⁡x\frac{\sec x\left(\tan x + \sec x\right)}{\sec x + \tan x} = \sec x

On any interval where sec⁡x\sec x is defined, such as (−π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right), the formula holds. It is also valid on the next branch (π2,3π2)\left(\frac{\pi}{2}, \frac{3\pi}{2}\right), where sec⁡x+tan⁡x\sec x + \tan x is negative and the absolute value does the work.

Where the integral of sec x fits in AP Calculus

This belongs to Unit 6, Integration and Accumulation of Change, which carries a weighting of 15 to 20 percent on both AB and BC. The move that solves it is Topic 6.9 (Integrating Using Substitution), and recognizing that substitution is the right tool here is Topic 6.14 (Selecting Techniques for Antidifferentiation).

The two derivative facts the proof rests on come from Unit 2, Topic 2.10 (Finding the Derivatives of Tangent, Cotangent, Secant, and/or Cosecant Functions), a unit weighted 10 to 15 percent on AB and 5 to 10 percent on BC.

Not the same as the sec rules you already memorized

∫sec⁡2x dx=tan⁡x+C\int \sec^2 x\,dx = \tan x + C and ∫sec⁡xtan⁡x dx=sec⁡x+C\int \sec x \tan x\,dx = \sec x + C are just Unit 2 derivative rules read backwards. ∫sec⁡x dx\int \sec x\,dx is not one of those; it needs the conjugate trick, which is exactly why it gets memorized as a result in its own right.

Common mistakes with the integral of sec x

  • Answering tan⁡x+C\tan x + C. That is ∫sec⁡2x dx\int \sec^2 x\,dx. One power of sec⁡\sec makes the whole problem different.
  • Answering sec⁡x+C\sec x + C. That is ∫sec⁡xtan⁡x dx\int \sec x \tan x\,dx, the product, not the bare secant.
  • Writing ln⁡∣sec⁡x∣+C\ln\left|\sec x\right| + C. Differentiating that gives tan⁡x\tan x, not sec⁡x\sec x, so the +tan⁡x+\tan x inside the logarithm is not optional.
  • Forgetting the inside factor on a composite. ∫sec⁡(3x) dx=13ln⁡∣sec⁡3x+tan⁡3x∣+C\int \sec(3x)\,dx = \frac{1}{3}\ln\left|\sec 3x + \tan 3x\right| + C, with the 13\frac{1}{3} out front.
  • Integrating straight across x=π2x = \frac{\pi}{2}. There is an infinite discontinuity there, so something like ∫0πsec⁡x dx\int_0^{\pi} \sec x\,dx is improper and diverges; evaluating the antiderivative at the endpoints anyway produces a number that means nothing.
  • Dropping the absolute value. Write ln⁡∣sec⁡x+tan⁡x∣\ln\left|\sec x + \tan x\right|; on branches where sec⁡x+tan⁡x\sec x + \tan x is negative, ln⁡(sec⁡x+tan⁡x)\ln(\sec x + \tan x) is undefined.

Worked examples

Example 1. Evaluate ∫0π/4sec⁡x dx\int_0^{\pi/4} \sec x\,dx. Use the antiderivative and the endpoint values sec⁡π4=2\sec\frac{\pi}{4} = \sqrt{2}, tan⁡π4=1\tan\frac{\pi}{4} = 1, sec⁡0=1\sec 0 = 1, tan⁡0=0\tan 0 = 0.

∫0π/4sec⁡x dx=[ln⁡∣sec⁡x+tan⁡x∣]0π/4=ln⁡(2+1)−ln⁡(1)=ln⁡(1+2)≈0.8814\int_0^{\pi/4} \sec x\,dx = \Big[\ln\left|\sec x + \tan x\right|\Big]_0^{\pi/4} = \ln\left(\sqrt{2} + 1\right) - \ln(1) = \ln\left(1 + \sqrt{2}\right) \approx 0.8814

Example 2. Find ∫sec⁡(3x) dx\int \sec(3x)\,dx. Substitute w=3xw = 3x, so dw=3 dxdw = 3\,dx and dx=13 dwdx = \frac{1}{3}\,dw.

∫sec⁡(3x) dx=13∫sec⁡w dw=13ln⁡∣sec⁡3x+tan⁡3x∣+C\int \sec(3x)\,dx = \frac{1}{3}\int \sec w\,dw = \frac{1}{3}\ln\left|\sec 3x + \tan 3x\right| + C

Example 3. Evaluate ∫0π/3sec⁡x dx\int_0^{\pi/3} \sec x\,dx, where sec⁡π3=2\sec\frac{\pi}{3} = 2 and tan⁡π3=3\tan\frac{\pi}{3} = \sqrt{3}.

∫0π/3sec⁡x dx=ln⁡(2+3)−ln⁡(1)=ln⁡(2+3)≈1.3170\int_0^{\pi/3} \sec x\,dx = \ln\left(2 + \sqrt{3}\right) - \ln(1) = \ln\left(2 + \sqrt{3}\right) \approx 1.3170

Both endpoints stayed on one branch

In each definite integral above, the interval sits inside (−π2,π2)\left(-\frac{\pi}{2}, \frac{\pi}{2}\right), so sec⁡x\sec x is continuous and the Fundamental Theorem applies. Always check that before substituting endpoints into the antiderivative.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

What is the integral of sec x?

∫sec⁡x dx=ln⁡∣sec⁡x+tan⁡x∣+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C. You can confirm it by differentiating: the chain rule gives sec⁡xtan⁡x+sec⁡2xsec⁡x+tan⁡x\frac{\sec x \tan x + \sec^2 x}{\sec x + \tan x}, and factoring sec⁡x\sec x out of the numerator cancels the denominator, leaving sec⁡x\sec x.

Why do you multiply by sec x + tan x?

Because it manufactures a substitution. Multiplying by sec⁡x+tan⁡xsec⁡x+tan⁡x\frac{\sec x + \tan x}{\sec x + \tan x} leaves the integrand unchanged in value, but the new numerator sec⁡2x+sec⁡xtan⁡x\sec^2 x + \sec x \tan x is precisely the derivative of the new denominator. That is the ∫u′u dx=ln⁡∣u∣+C\int \frac{u'}{u}\,dx = \ln|u| + C pattern.

Is -ln|sec x - tan x| + C also a correct answer?

Yes, and it is the same function, not merely a shifted one. Since sec⁡2x−tan⁡2x=1\sec^2 x - \tan^2 x = 1, we get ∣sec⁡x−tan⁡x∣=1∣sec⁡x+tan⁡x∣\left|\sec x - \tan x\right| = \frac{1}{\left|\sec x + \tan x\right|}, so its negative logarithm equals ln⁡∣sec⁡x+tan⁡x∣\ln\left|\sec x + \tan x\right| exactly. The form ln⁡∣tan⁡(x2+π4)∣+C\ln\left|\tan\left(\frac{x}{2} + \frac{\pi}{4}\right)\right| + C is equivalent too.

How is the integral of sec x different from the integral of sec squared x?

They share no method. ∫sec⁡2x dx=tan⁡x+C\int \sec^2 x\,dx = \tan x + C is a memorized derivative rule reversed, since ddx[tan⁡x]=sec⁡2x\frac{d}{dx}[\tan x] = \sec^2 x. The single power, ∫sec⁡x dx=ln⁡∣sec⁡x+tan⁡x∣+C\int \sec x\,dx = \ln\left|\sec x + \tan x\right| + C, requires the conjugate multiplication and a substitution.

What is the domain of the antiderivative?

Wherever sec⁡x\sec x itself is defined, which excludes x=π2+kπx = \frac{\pi}{2} + k\pi. The formula is valid on each interval between consecutive vertical asymptotes, and the constant CC can differ from one interval to the next. A definite integral whose limits straddle an asymptote is improper.