# Integration of tan x

#### Understand the Problem

The question is asking for the integral of the function tan x. This involves finding the antiderivative of tan x, which is a process that requires an understanding of integral calculus.

$-\ln|\cos x| + C$

The integral of tan x is -ln|cos x| + C, where C is the constant of integration.

#### Steps to Solve

1. Recall integration by parts

We can use the integration by parts formula, but a more direct method is to use a trigonometric identity. Recall that $\tan x = \frac{\sin x}{\cos x}$.

2. Rewrite the integral

Rewrite the integral using this identity:

$$\int \tan x dx = \int \frac{\sin x}{\cos x} dx$$

1. Substitute u = cos x

Make the substitution $u = \cos x$. Then $du = -\sin x dx$, or $-du = \sin x dx$.

This transforms our integral to:

$$-\int \frac{1}{u} du$$

1. Integrate

The integral of $\frac{1}{u}$ is $\ln|u|$. So we have:

$$-\int \frac{1}{u} du = -\ln|u| + C$$

1. Substitute back

Now substitute back $u = \cos x$:

$$-\ln|u| + C = -\ln|\cos x| + C$$

The integral of tan x is -ln|cos x| + C, where C is the constant of integration.