# Can Mathematica solve $\int \frac{\cot^2\left(\frac12\sec^{-1}(x)\right)}{\sqrt{\tan\left(\frac12\csc^{-1}(x)\right)}} \, dx$?

Can Mathematica solve integral $$(1)$$?

$$\int \frac{\cot^2\left(\frac12\sec^{-1}(x)\right)}{\sqrt{\tan\left(\frac12\csc^{-1}(x)\right)}} \, dx.\tag{1}$$

This is

Integrate[Cot[1/2 ArcSec[x]]^2 / Sqrt[Tan[1/2 ArcCsc[x]]], x]

Perhaps it is worth clarifying that it is not that I do not know how to solve it. The integral can be mechanically solved using the method described in this blog post. But I have noticed that both Wolfram Alpha and this Integral Calculator are unable to simplify it, let alone solve it (I mean they do not provide the closed form of the integral).

• Please post the integral in Mathematica/Wolfram Language code. Commented Jun 12 at 15:34
• @MichaelE2: You refer to this: Integrate[Cot[1/2 ArcSec[x]]^2 / Sqrt[Tan[1/2 ArcCsc[x]]], x] ? Commented Jun 12 at 15:45
• Please include all Mathematica code in the original post! That helps us help you by allowing us to copy and paste into our own copies of Mathematica and get right to work. So yes, edit your post with that Mathematica code, please, by clicking the grey edit button below your post. Commented Jun 12 at 15:52
• It seems that you don't use Mathematica. Since this is a site for helping people, who know how to use Mathematica at a basic level, with problems they face using it; and since you already have an answer to the mathematical question: I don't feel a lot of motivation for a solving a random difficult integral. Difficult integrals are a dime a dozen. Is there something missing from the statement of the problem that would make it more interesting? Commented Jun 12 at 15:55
• Version 14 integrates this expression without difficulty. Commented Jun 12 at 18:01

General case:

FullSimplify[
Integrate[
FullSimplify[
TrigToExp[Cot[1/2 ArcSec[x]]^2/Sqrt[Tan[1/2 ArcCsc[x]]]]], x]]


In case x>1 a simpler version exists:

FullSimplify[
Integrate[
FullSimplify[
TrigToExp[Cot[1/2 ArcSec[x]]^2/Sqrt[Tan[1/2 ArcCsc[x]]]],
Assumptions -> x > 1], x], Assumptions -> x > 1]

-(2/3) (-6 - 2 x + Sqrt[-1 + x^2]) Sqrt[x + Sqrt[-1 + x^2]] -
8 ArcTanh[Sqrt[x - Sqrt[-1 + x^2]]]
FullSimplify[%% == %, Assumptions -> x > 1]


What I get:

Integrate[Cot[1/2  ArcSec[x]]^2/Sqrt[Tan[1/2  ArcCsc[x]]], x]

(* Out[40]= (4 (-1 +
x) (-7 + (12 - 5 Sqrt[1 - 1/x^2]) x + (59 -
29 Sqrt[1 - 1/x^2]) x^2 + (4 + 8 Sqrt[1 - 1/x^2]) x^3 +
60 (-1 + Sqrt[1 - 1/x^2]) x^4 + 24 (-1 + Sqrt[1 - 1/x^2]) x^5 -
12 Sqrt[x -
Sqrt[1 - 1/x^2]
x] (-1 + (3 - Sqrt[1 - 1/x^2]) x + (8 -
4 Sqrt[1 - 1/x^2]) x^2 + (-4 +
4 Sqrt[1 - 1/x^2]) x^3 + (-8 +
8 Sqrt[1 - 1/x^2]) x^4) ArcTanh[Sqrt[
x - Sqrt[1 - 1/x^2] x]]))/(3 (-1 + Sqrt[
1 - 1/x^2])^2 x^2 (-1 + (-1 + Sqrt[1 - 1/x^2]) x) (1 + (-1 +
Sqrt[1 - 1/x^2]) x)^2 Sqrt[x - Sqrt[1 - 1/x^2] x]) *)

In[41]:= FullSimplify[%]

(* Out[41]=
2/3 Sqrt[
x - Sqrt[1 - 1/x^2]
x] (1 + ((6 + x) (x^2 + Sqrt[x^2] Sqrt[-1 + x^2]))/x) -
8 ArcTanh[Sqrt[x - Sqrt[1 - 1/x^2] x]] *)


We can also use FunctionExpand to rewrite the integrand:

integrand = Cot[1/2  ArcSec[x]]^2/Sqrt[Tan[1/2  ArcCsc[x]]];
newIntegrand = integrand // FunctionExpand // FullSimplify


result = Integrate[newIntegrand, x] // FullSimplify


And verify result is the integral of integrand:

(D[result, x] == integrand) // FunctionExpand // FullSimplify

(*True*)


For x > 0 (I need x to be positive because PowerExpand assumes positive real numbers), We can also do FullSimplify , PowerExpand, and FullSimplify again to get a result with a slightly smaller LeafCount but I feel like this is a very ugly thing to do:

Integrate[newIntegrand, x] // FullSimplify // PowerExpand // FullSimplify


This does the job in 14 on Windows 10.

Integrate[ FullSimplify[ TrigExpand[Cot[1/2*ArcSec[x]]^2/
Sqrt[Tan[1/2*ArcCsc[x]]]]], x]
LeafCount[%]


7693

Integrate[TrigExpand[Cot[1/2*ArcSec[x]]^2/
Sqrt[Tan[1/2*ArcCsc[x]]]],   x];
LeafCount[%]


560

FullSimplify[%%]


-((2 (Sqrt[ x - Sqrt[1 - 1/x^2] x] (6 + (4 - Sqrt[1 - 1/x^2]) x + 12 (-1 + Sqrt[1 - 1/x^2]) x^2 + 6 (-1 + Sqrt[1 - 1/x^2]) x^3) + 12 x (-3 + Sqrt[ 1 - 1/x^2] + (4 - 4 Sqrt[1 - 1/x^2]) x^2) ArcTanh[Sqrt[ x - Sqrt[1 - 1/x^2] x]]))/(3 x (-3 + Sqrt[1 - 1/x^2] + 4 x^2 - 4 Sqrt[x^2] Sqrt[-1 + x^2])))

• FullSimplify[ TrigExpand[...]] returns the original integrand. It's a red herring. Commented Jun 12 at 16:01
• I'm out of MMA at the moment so I'll try to response later. Commented Jun 12 at 16:14