practicecalculus
Trigonometric integrals

Integral of sec² x: Formula, Derivation and Examples

The integral of sec² x is tan x + C. See why it follows from the derivative of tan x, the sec²(ax) form, related integrals like tan² x and csc² x, and examples.

Trigonometric integrals Updated 3 min read

At a glance

\int \sec^2 x\,dx = \tan x + C
Antiderivative
\tan x + C
Also written
\int\dfrac{1}{\cos^2 x}\,dx = \tan x + C
Linear form
\int\sec^2(ax + b)\,dx = \dfrac{1}{a}\tan(ax + b) + C
Cosecant partner
\int\csc^2 x\,dx = -\cot x + C
From 0 to π/4
1
On this page
  1. Graph of sec² x and its antiderivative
  2. Derivation
  3. Check by differentiating
  4. Definite integrals
  5. Substitution variants
  6. Related integrals
  7. Worked example: two correct answers
  8. Common mistakes

The integral of \sec^2 x is \tan x + C. It is a direct reversal of the derivative of \tan x, so there is nothing to compute, only a fact to recognise.

\int \sec^2 x\,dx = \tan x + C

Graph of sec² x and its antiderivative

Area under y = sec² x from 0 to π/4, with the antiderivative y = tan x
The shaded area is \tan\frac{\pi}{4} - \tan 0 = 1. The dashed curve y = \tan x is steepest where \sec^2 x is largest, near the asymptotes.

The smallest value of \sec^2 x is 1, at x = 0. That matches the slope of \tan x at the origin.

Derivation

  1. Recall the derivative of tan x: \frac{d}{dx}\tan x = \sec^2 x.
  2. So \tan x is an antiderivative of \sec^2 x.
  3. Add C: \int\sec^2 x\,dx = \tan x + C.

If you have forgotten why \frac{d}{dx}\tan x = \sec^2 x, apply the quotient rule to \frac{\sin x}{\cos x}:

\frac{\cos x\cdot\cos x - \sin x\cdot(-\sin x)}{\cos^2 x} = \frac{1}{\cos^2 x} = \sec^2 x

Check by differentiating

\frac{d}{dx}(\tan x + C) = \sec^2 x \checkmark

Definite integrals

\int_0^{\pi/4}\sec^2 x\,dx = 1, \qquad \int_0^{\pi/3}\sec^2 x\,dx = \sqrt{3}, \qquad \int_{-\pi/4}^{\pi/4}\sec^2 x\,dx = 2

Any interval that reaches \pm\frac{\pi}{2} gives a divergent improper integral, because \tan x \to \infty.

Substitution variants

\int\sec^2(ax + b)\,dx = \frac{1}{a}\tan(ax + b) + C

Example 1. \int\sec^2(5x)\,dx = \frac{1}{5}\tan(5x) + C.

Example 2. \int x\sec^2(x^2)\,dx = \frac{1}{2}\tan(x^2) + C, with u = x^2.

Example 3. \int\sec^2 x\,e^{\tan x}\,dx = e^{\tan x} + C, with u = \tan x.

Example 4. \int\frac{\sec^2 x}{\tan x}\,dx = \ln\lvert\tan x\rvert + C, since the top is the derivative of the bottom.

The six "square" and "product" trig integrals come straight from the six trig derivatives:

Integral Answer Comes from
\int\sec^2 x\,dx \tan x + C (\tan x)' = \sec^2 x
\int\csc^2 x\,dx -\cot x + C (\cot x)' = -\csc^2 x
\int\sec x\tan x\,dx \sec x + C (\sec x)' = \sec x\tan x
\int\csc x\cot x\,dx -\csc x + C (\csc x)' = -\csc x\cot x
\int\tan^2 x\,dx \tan x - x + C \tan^2 x = \sec^2 x - 1

The last row is worked out on the integral of tan² x page, and the third row on the integral of sec x tan x page.

Worked example: two correct answers

Find \int\sec^2 x\tan x\,dx.

  • With u = \tan x, du = \sec^2 x\,dx: the answer is \frac{\tan^2 x}{2} + C.
  • With u = \sec x, du = \sec x\tan x\,dx: the integrand is \sec x\cdot(\sec x\tan x), so the answer is \frac{\sec^2 x}{2} + C.

Both are right. Since \sec^2 x = \tan^2 x + 1, the two answers differ only by the constant \frac{1}{2}, which C absorbs.

Common mistakes

  1. Using the power rule: \frac{\sec^3 x}{3}. The power rule needs the derivative of the inside, \sec x\tan x, to be present. It is not.
  2. Answering 2\sec x\cdot\sec x\tan x. That is the derivative of \sec^2 x.
  3. Confusing it with \int\sec x\,dx. That one is \ln\lvert\sec x + \tan x\rvert + C. See the integral of sec x.
  4. Forgetting to divide by a in \int\sec^2(ax)\,dx.

Practise on trig integral problems.

Practice it now

Sine, cosine, eˣ and 1/x

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

Frequently asked questions

What is the integral of sec² x?

The integral of \sec^2 x is \tan x + C.

What is the integral of 1/cos² x?

Since \frac{1}{\cos^2 x} = \sec^2 x, it is \tan x + C.

What is the integral of sec²(3x)?

It is \frac{1}{3}\tan(3x) + C.

What is the integral of sec² x tan x?

With u = \tan x it is \frac{\tan^2 x}{2} + C. With u = \sec x you get \frac{\sec^2 x}{2} + C. Both are correct, since they differ by the constant \frac{1}{2}.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.