# Integral of $\tan{\left(x \right)}$

The calculator will find the integral/antiderivative of $\tan{\left(x \right)}$, with steps shown.

Related calculator: Definite and Improper Integral Calculator

Please write without any differentials such as $dx$, $dy$ etc.
Leave empty for autodetection.

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please write it in the comments below.

Find $\int \tan{\left(x \right)}\, dx$.

### Solution

Rewrite the tangent as $\tan\left(x\right)=\frac{\sin\left(x\right)}{\cos\left(x\right)}$:

$$\color{red}{\int{\tan{\left(x \right)} d x}} = \color{red}{\int{\frac{\sin{\left(x \right)}}{\cos{\left(x \right)}} d x}}$$

Let $u=\cos{\left(x \right)}$.

Then $du=\left(\cos{\left(x \right)}\right)^{\prime }dx = - \sin{\left(x \right)} dx$ (steps can be seen here), and we have that $\sin{\left(x \right)} dx = - du$.

The integral can be rewritten as

$$\color{red}{\int{\frac{\sin{\left(x \right)}}{\cos{\left(x \right)}} d x}} = \color{red}{\int{\left(- \frac{1}{u}\right)d u}}$$

Apply the constant multiple rule $\int c f{\left(u \right)}\, du = c \int f{\left(u \right)}\, du$ with $c=-1$ and $f{\left(u \right)} = \frac{1}{u}$:

$$\color{red}{\int{\left(- \frac{1}{u}\right)d u}} = \color{red}{\left(- \int{\frac{1}{u} d u}\right)}$$

The integral of $\frac{1}{u}$ is $\int{\frac{1}{u} d u} = \ln{\left(u \right)}$

$$- \color{red}{\int{\frac{1}{u} d u}} = - \color{red}{\ln{\left(u \right)}}$$

Recall that $u=\cos{\left(x \right)}$:

$$- \ln{\left(\color{red}{u} \right)} = - \ln{\left(\color{red}{\cos{\left(x \right)}} \right)}$$

Therefore,

$$\int{\tan{\left(x \right)} d x} = - \ln{\left(\left|{\cos{\left(x \right)}}\right| \right)}$$

$$\int{\tan{\left(x \right)} d x} = - \ln{\left(\left|{\cos{\left(x \right)}}\right| \right)}+C$$
Answer: $\int{\tan{\left(x \right)} d x}=- \ln{\left(\left|{\cos{\left(x \right)}}\right| \right)}+C$