To find the integral of tangent \( x \), we start by rewriting it in terms of sine and cosine. The integral can be expressed as:
\[ \int \tan x \, dx = \int \frac{\sin x}{\cos x} \, dx \]
Next, we use substitution. Let \( u = \cos x \), which gives us \( du = -\sin x \, dx \). Rearranging this, we have \( -du = \sin x \, dx \). Substituting these into the integral, we get:
\[ \int \tan x \, dx = -\int \frac{1}{u} \, du \]
This integral is straightforward to evaluate, yielding:
\[ -\ln |u| + C \]
Substituting back for \( u \), we find:
\[ -\ln |\cos x| + C \]
Using properties of logarithms, we can rewrite this as:
\[ \ln |\sec x| + C \]
Thus, the integral of tangent \( x \) is:
\[ \int \tan x \, dx = \ln |\sec x| + C \]
Now, let's consider the integral of cotangent \( x \). We rewrite cotangent in terms of sine and cosine:
\[ \int \cot x \, dx = \int \frac{\cos x}{\sin x} \, dx \]
Using a similar substitution, let \( u = \sin x \), which gives \( du = \cos x \, dx \). This allows us to rewrite the integral as:
\[ \int \cot x \, dx = \int \frac{1}{u} \, du \]
Evaluating this integral results in:
\[ \ln |u| + C \]
Substituting back for \( u \), we have:
\[ \ln |\sin x| + C \]
Therefore, the integral of cotangent \( x \) is:
\[ \int \cot x \, dx = \ln |\sin x| + C \]
In summary, the integrals of the tangent and cotangent functions are:
\[ \int \tan x \, dx = \ln |\sec x| + C \]
\[ \int \cot x \, dx = \ln |\sin x| + C \]
