Integration – Evaluate $\int_1^2 \frac{1}{\tan{\left(\frac{\sec^{-1}(x)}{2}\right)}-x}\,dx$

definite integralsintegrationtrigonometric-integrals

In a previous question of mine (see here and here), I suggested the following general transformation for integrals involving $\tan{\left(\frac12\csc^{-1}{(x)}\right)}$ or $\tan{\left(\frac12\sec^{-1}{(x)}\right)}$ or both.

$$\int f\left(\tan{\left(\frac12\csc^{-1}(x)\right)}, \tan{\left(\frac12\sec^{-1}(x)\right)} \right)\,dx=\int f\left(e^{i\cos^{-1}(x)}, \frac{1-e^{i\cos^{-1}(x)}}{1+e^{i\cos^{-1}(x)}}\right)\,dx.\tag{1}$$

Let's consider the following integral:

$$\int_1^2 \frac{1}{\tan{\left(\frac{\sec^{-1}(x)}{2}\right)}-x}\,dx.\tag{2}$$

Wolfram Alpha is unable to provide the closed form but it gives the following approximation $-0.943421002112422…$ This integral calculator (IC) also fails. In my previous question, Quanto suggested the simplification $$\tan{\left(\frac{\csc^{-1}(x)}{2}\right)}=x-\sqrt{x^2-1}\tag{3}$$ for the integral $\int_2^5 \sqrt{\tan\left(\frac{\csc^{-1}(x)}{2}\right)} \,dx$, so I thought that using a similar simplification, this is $$\tan{\left(\frac{\sec^{-1}(x)}{2}\right)}=\frac{\sqrt{x-1}}{\sqrt{x+1}},\tag{4}$$ WA or IC could provide a closed form… But they can't either.However, after applying transformation $(1)$ both WA and IC can yield the closed form (although it's horrendous).

This evidences that transformation $(1)$ could be more effective for a whole class of integrals of the form

$$\int\frac{a}{\tan{\left(\frac{\sec^{-1}(x)}{2}\right)}+p(x)}\,dx.\tag{5}$$

However, there is still room for a clever substitution that the machine may have missed (it is well known that computers are not very good with substitutions and tricks, and in this forum there are countless examples of humans outsmarting the machine). And that's my question: Is there any substitution that can turn $(2)$ into an integral of a rational function as or even more quickly as transformation $(1)$ does?

Edited. By the way, transformation $(1)$ allows rewriting what is arguably the most famous integral in this forum into four simpler (though still challenging) integrals:

$$
\int_{-1}^1 \frac{1}{x}\sqrt{\frac{1+x}{1-x}}\ln\left(\frac{2x^2+2x+1}{2x^2-2x+1}\right)\ \mathrm dx = -i\int_{-1}^{1} \frac{(1 + e^{i\arccos(x)})\ln\left(\frac{2x^2+2x+1}{2x^2-2x+1}\right)}{(1 – e^{i\arccos(x)})x} \, dx = 4\pi\operatorname{arccot}\sqrt\phi.
$$

Best Answer

$$I=\int \frac{dx}{\tan{\left(\frac{\sec^{-1}(x)}{2}\right)}-x}=\int \frac{dx}{\frac{\sqrt{x-1}}{\sqrt{x+1}}-x}$$ $$x=\frac{1+t^2}{1-t^2}\quad \implies \quad I=\int \frac{4 t}{(t-1) (t+1) \left(t^3+t^2-t+1\right)}\,dt$$ Partial fraction decomposition $$\frac{4 t}{(t-1) (t+1) \left(t^3+t^2-t+1\right)}=\frac{1}{t+1}+\frac{1}{t-1}-\frac 23\frac{3 t^2+2 t-1}{t^3+t^2-t+1}-\frac 23 \frac{t+1}{t^3+t^2-t+1}$$

Now, the most tedious $$t^3+t^2-t+1=(t-a)(t^2+b t+c)$$ where $$a=-\frac{1}{3} \left(1+4 \cosh \left(\frac{1}{3} \cosh ^{-1}\left(\frac{19}{8}\right)\right)\right)$$

$$\frac {t+1}{(t-a)(t^2+b t+c)}=\frac 1{a^2+a b+c} \Big(\frac{1+a}{t-a }-\frac {(1+a)t+(a-b+c)}{t^2+b t+c }\Big)$$

For $t$, the limits of integration are $0$ and $\frac{1}{\sqrt{3}}$ and then a (nasty) explicit result.