Skip to content
ihateDesmos

Integral of tan 2x

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

The integral of tan 2x is −ln|cos 2x|/2 + C. It is the integral of tan u, divided by 2.

−0.6−0.4−0.20.20.40.6−220
Open in calculator
y=tan(2x)
in blue and its integral
y=−ln(|cos(2x)|)2
(with C = 0) in red. Defined for x ≠ π/4 + nπ/2.

How to integrate tan 2x

Method: u-substitution.

  1. 1
    Let u = 2x, so dx = du/2.
  2. 2
    The integral becomes (1/2) ∫tan u du.
  3. 3
    The integral of tan u is −ln|cos u|.
  4. 4
    So the result is −ln|cos 2x|/2 + C.

What it means

tan 2x has asymptotes twice as often as tan x, at x = π/4 + nπ/2, and its integral blows up at each of them.

The integral from 0 to π/8

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

−0.6−0.4−0.20.20.40.6−3−2−1123

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
xtan 2xSlope of the answer
−1/2−1.55741−1.55741
−1/4−0.546302−0.546302
000
1/40.5463020.546302
1/21.557411.55741

Common mistakes

  • Forgetting the factor of 1/2.

Frequently asked questions

What is the integral of tan 2x?
The integral of tan 2x is −ln|cos 2x|/2 + C, for x ≠ π/4 + nπ/2.
What is the integral of tan 2x from 0 to π/8?
(ln 2)/4, which is about ln 2/4.

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