Example 5. Find the integral $\int \operatorname{tg} x d x$.

Note: In English, the tangent function is usually denoted as $\tan x$ rather than $\operatorname{tg} x$. So the integral would typically be written as $\int \tan x \, dx$.
## Solution.

$$
\int \tan x \, dx = \int \frac{\sin x}{\cos x} \, dx = -\int \frac{d(\cos x)}{\cos x} = -\ln |\cos x| + C
$$