Integral of $$$\tan{\left(x \right)}$$$
Related calculator: Definite and Improper Integral Calculator
Your Input
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)}$$
Add the constant of integration:
$$\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$$$