Integral of $$$x \tan{\left(x \right)}$$$

The calculator will find the integral/antiderivative of $$$x \tan{\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 x \tan{\left(x \right)}\, dx$$$.

Solution

For the integral $$$\int{x \tan{\left(x \right)} d x}$$$, use integration by parts $$$\int \operatorname{u} \operatorname{dv} = \operatorname{u}\operatorname{v} - \int \operatorname{v} \operatorname{du}$$$.

Let $$$\operatorname{u}=x$$$ and $$$\operatorname{dv}=\tan{\left(x \right)} dx$$$.

Then $$$\operatorname{du}=\left(x\right)^{\prime }dx=1 dx$$$ (steps can be seen ») and $$$\operatorname{v}=\int{\tan{\left(x \right)} d x}=- \ln{\left(\cos{\left(x \right)} \right)}$$$ (steps can be seen »).

So,

$${\color{red}{\int{x \tan{\left(x \right)} d x}}}={\color{red}{\left(x \cdot \left(- \ln{\left(\cos{\left(x \right)} \right)}\right)-\int{\left(- \ln{\left(\cos{\left(x \right)} \right)}\right) \cdot 1 d x}\right)}}={\color{red}{\left(- x \ln{\left(\cos{\left(x \right)} \right)} - \int{\left(- \ln{\left(\cos{\left(x \right)} \right)}\right)d x}\right)}}$$

Apply the constant multiple rule $$$\int c f{\left(x \right)}\, dx = c \int f{\left(x \right)}\, dx$$$ with $$$c=-1$$$ and $$$f{\left(x \right)} = \ln{\left(\cos{\left(x \right)} \right)}$$$:

$$- x \ln{\left(\cos{\left(x \right)} \right)} - {\color{red}{\int{\left(- \ln{\left(\cos{\left(x \right)} \right)}\right)d x}}} = - x \ln{\left(\cos{\left(x \right)} \right)} - {\color{red}{\left(- \int{\ln{\left(\cos{\left(x \right)} \right)} d x}\right)}}$$

This integral does not have a closed form:

$$- x \ln{\left(\cos{\left(x \right)} \right)} + {\color{red}{\int{\ln{\left(\cos{\left(x \right)} \right)} d x}}} = - x \ln{\left(\cos{\left(x \right)} \right)} + {\color{red}{\left(\frac{i x^{2}}{2} - x \ln{\left(e^{2 i x} + 1 \right)} + x \ln{\left(\cos{\left(x \right)} \right)} + \frac{i \operatorname{Li}_{2}\left(- e^{2 i x}\right)}{2}\right)}}$$

Therefore,

$$\int{x \tan{\left(x \right)} d x} = \frac{i x^{2}}{2} - x \ln{\left(e^{2 i x} + 1 \right)} + \frac{i \operatorname{Li}_{2}\left(- e^{2 i x}\right)}{2}$$

Add the constant of integration:

$$\int{x \tan{\left(x \right)} d x} = \frac{i x^{2}}{2} - x \ln{\left(e^{2 i x} + 1 \right)} + \frac{i \operatorname{Li}_{2}\left(- e^{2 i x}\right)}{2}+C$$

Answer

$$$\int x \tan{\left(x \right)}\, dx = \left(\frac{i x^{2}}{2} - x \ln\left(e^{2 i x} + 1\right) + \frac{i \operatorname{Li}_{2}\left(- e^{2 i x}\right)}{2}\right) + C$$$A