Integral of $$$-1 + \frac{1}{\tan^{2}{\left(x \right)}}$$$

The calculator will find the integral/antiderivative of $$$-1 + \frac{1}{\tan^{2}{\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 contact us.

Your Input

Find $$$\int \left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)\, dx$$$.

Solution

Integrate term by term:

$${\color{red}{\int{\left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)d x}}} = {\color{red}{\left(- \int{1 d x} + \int{\frac{1}{\tan^{2}{\left(x \right)}} d x}\right)}}$$

Apply the constant rule $$$\int c\, dx = c x$$$ with $$$c=1$$$:

$$\int{\frac{1}{\tan^{2}{\left(x \right)}} d x} - {\color{red}{\int{1 d x}}} = \int{\frac{1}{\tan^{2}{\left(x \right)}} d x} - {\color{red}{x}}$$

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

Then $$$x=\operatorname{atan}{\left(u \right)}$$$ and $$$dx=\left(\operatorname{atan}{\left(u \right)}\right)^{\prime }du = \frac{du}{u^{2} + 1}$$$ (steps can be seen »).

Thus,

$$- x + {\color{red}{\int{\frac{1}{\tan^{2}{\left(x \right)}} d x}}} = - x + {\color{red}{\int{\frac{1}{u^{2} \left(u^{2} + 1\right)} d u}}}$$

Perform partial fraction decomposition (steps can be seen »):

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

Integrate term by term:

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

Apply the power rule $$$\int u^{n}\, du = \frac{u^{n + 1}}{n + 1}$$$ $$$\left(n \neq -1 \right)$$$ with $$$n=-2$$$:

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

The integral of $$$\frac{1}{u^{2} + 1}$$$ is $$$\int{\frac{1}{u^{2} + 1} d u} = \operatorname{atan}{\left(u \right)}$$$:

$$- x - {\color{red}{\int{\frac{1}{u^{2} + 1} d u}}} - \frac{1}{u} = - x - {\color{red}{\operatorname{atan}{\left(u \right)}}} - \frac{1}{u}$$

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

$$- x - \operatorname{atan}{\left({\color{red}{u}} \right)} - {\color{red}{u}}^{-1} = - x - \operatorname{atan}{\left({\color{red}{\tan{\left(x \right)}}} \right)} - {\color{red}{\tan{\left(x \right)}}}^{-1}$$

Therefore,

$$\int{\left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)d x} = - x - \operatorname{atan}{\left(\tan{\left(x \right)} \right)} - \frac{1}{\tan{\left(x \right)}}$$

Simplify:

$$\int{\left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)d x} = - 2 x - \frac{1}{\tan{\left(x \right)}}$$

Add the constant of integration:

$$\int{\left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)d x} = - 2 x - \frac{1}{\tan{\left(x \right)}}+C$$

Answer

$$$\int \left(-1 + \frac{1}{\tan^{2}{\left(x \right)}}\right)\, dx = \left(- 2 x - \frac{1}{\tan{\left(x \right)}}\right) + C$$$A