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

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

Solution

Let $$$u=\frac{x}{2}$$$.

Then $$$du=\left(\frac{x}{2}\right)^{\prime }dx = \frac{dx}{2}$$$ (steps can be seen »), and we have that $$$dx = 2 du$$$.

Therefore,

$${\color{red}{\int{\tan{\left(\frac{x}{2} \right)} d x}}} = {\color{red}{\int{2 \tan{\left(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=2$$$ and $$$f{\left(u \right)} = \tan{\left(u \right)}$$$:

$${\color{red}{\int{2 \tan{\left(u \right)} d u}}} = {\color{red}{\left(2 \int{\tan{\left(u \right)} d u}\right)}}$$

Rewrite the tangent as $$$\tan\left( u \right)=\frac{\sin\left( u \right)}{\cos\left( u \right)}$$$:

$$2 {\color{red}{\int{\tan{\left(u \right)} d u}}} = 2 {\color{red}{\int{\frac{\sin{\left(u \right)}}{\cos{\left(u \right)}} d u}}}$$

Let $$$v=\cos{\left(u \right)}$$$.

Then $$$dv=\left(\cos{\left(u \right)}\right)^{\prime }du = - \sin{\left(u \right)} du$$$ (steps can be seen »), and we have that $$$\sin{\left(u \right)} du = - dv$$$.

The integral can be rewritten as

$$2 {\color{red}{\int{\frac{\sin{\left(u \right)}}{\cos{\left(u \right)}} d u}}} = 2 {\color{red}{\int{\left(- \frac{1}{v}\right)d v}}}$$

Apply the constant multiple rule $$$\int c f{\left(v \right)}\, dv = c \int f{\left(v \right)}\, dv$$$ with $$$c=-1$$$ and $$$f{\left(v \right)} = \frac{1}{v}$$$:

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

The integral of $$$\frac{1}{v}$$$ is $$$\int{\frac{1}{v} d v} = \ln{\left(\left|{v}\right| \right)}$$$:

$$- 2 {\color{red}{\int{\frac{1}{v} d v}}} = - 2 {\color{red}{\ln{\left(\left|{v}\right| \right)}}}$$

Recall that $$$v=\cos{\left(u \right)}$$$:

$$- 2 \ln{\left(\left|{{\color{red}{v}}}\right| \right)} = - 2 \ln{\left(\left|{{\color{red}{\cos{\left(u \right)}}}}\right| \right)}$$

Recall that $$$u=\frac{x}{2}$$$:

$$- 2 \ln{\left(\left|{\cos{\left({\color{red}{u}} \right)}}\right| \right)} = - 2 \ln{\left(\left|{\cos{\left({\color{red}{\left(\frac{x}{2}\right)}} \right)}}\right| \right)}$$

Therefore,

$$\int{\tan{\left(\frac{x}{2} \right)} d x} = - 2 \ln{\left(\left|{\cos{\left(\frac{x}{2} \right)}}\right| \right)}$$

Add the constant of integration:

$$\int{\tan{\left(\frac{x}{2} \right)} d x} = - 2 \ln{\left(\left|{\cos{\left(\frac{x}{2} \right)}}\right| \right)}+C$$

Answer

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