Integral of tan x

∫tan⁡(x) dx=−ln⁡(∣cos⁡(x)∣)+C\int \tan\left(x\right)\,dx = -\ln\left(\left|\cos\left(x\right)\right|\right) + C

Write tan x = sin x / cos x and substitute u = cos x: the numerator is −du, which gives −ln|cos x|, equivalently ln|sec x|.

Step by step

  1. Trig rule

    ∫tan u du = −ln|cos u|.

    ∫tan⁡(x) dx=−ln⁡(∣cos⁡(x)∣)\int \tan\left(x\right)\,dx = -\ln\left(\left|\cos\left(x\right)\right|\right)
-1-0.50.51-4-224
  • f(x) = tan x
  • F(x) + C

Every choice of C gives a valid antiderivative, since shifting up or down doesn’t change the slope.

Open in the integral calculator

Questions students ask

What is the integral of tan x?

∫tan⁡(x) dx=−ln⁡(∣cos⁡(x)∣)+C\int \tan\left(x\right)\,dx = -\ln\left(\left|\cos\left(x\right)\right|\right) + C.

How do you integrate tan x?

Write tan x = sin x / cos x and substitute u = cos x: the numerator is −du, which gives −ln|cos x|, equivalently ln|sec x|.

How can I check the answer?

Differentiate it: the derivative of −ln⁡(∣cos⁡(x)∣)-\ln\left(\left|\cos\left(x\right)\right|\right) is tan⁡(x)\tan\left(x\right). CalcViz checks every antiderivative this way before showing it.