[Math] Did I solve the integral of $\ln (\sec x + \tan x)$ correctly

calculusintegrationspecial functions

I attempted this integral, and I got a wildly different answer from wolframalpha, so I couldn't get a proper confirmation whether or not the answer I got is correct.

To simplify this integral, first I recalled somewhere from the back of my head that:

$$\sec x-\tan x=\tan {x\over 2}$$

Don't ask me why I know such obscure trigonometric identities, I just do. This is by the way not hard to prove, when you start from the right side and use half-angle formulas to arrive at the left side. 😉 Also, I noticed after some work that the following holds:

$$\sec x+\tan x={1\over \sec x – \tan x}$$

Those two observations combined allowed me to change this integral into:

$$\int \ln(\sec x + \tan x)\,dx\;=\;-\int \ln\Big(\tan {x\over 2}\Big)\,dx$$

At this point, I used the obvious Weierstrass substitution of $u=\tan{x\over 2}$, and $dx={2du\over u^2+1}$. This turns the integral into:

$$-\int \ln\Big(\tan {x\over 2}\Big)\,dx\;=\;-2\int {\ln u\over u^2+1}\,du$$

Next, I integrated by parts:

\begin{array}{c}
a=\ln u\\
da={du\over u}\\
db={du\over u^2+1}\\
b=\arctan u\\
\end{array}

Thus, we have:

$$-2\int {\ln u\over u^2+1}\,du\;=\;-2\ln u\arctan u\;+\;2\int{\arctan u\over u}\,du$$

At this stage, I was forced to focus on solving the arctangent integral that is trailing on the end up there. To simplify that integral, I used the complex logarithm definition of $\arctan u$, which is:

$$\arctan u = {1\over 2i}\ln\Big({1+ui \over 1-ui}\Big)$$

So that the arctangent integral becomes:

$$\int{\arctan u\over u}\,du\;=\;{1\over 2i}\int{\ln(1+ui)\over u}\,du\;-\;{1\over 2i}\int{\ln(1-ui)\over u}\,du$$

For the first integral, I used the substitution $t=-ui$ and I used $w=ui$ for the second integral. The differentials are respectively $du=i\,dt$ and $du=-i\,dw$. After substitution, the integrals become:

$$\int{\arctan u\over u}\,du\;=\;{1\over 2i}\int{\ln(1-t)\over t}\,dt\;-\;{1\over 2i}\int{\ln(1-w)\over w}\,dw$$

The two integrals, are now simply the dilogarithm function, $\text{Li}_2$.

$$\int{\arctan u\over u}\,du\;=\;{1\over 2i}\Big(\text{Li}_2(t)-\text{Li}_2(w)\Big)\;=\;{1\over 2i}\Big(\text{Li}_2(-ui)-\text{Li}_2(ui)\Big)$$

This arctangent integral can now be substituted back into the original integral to get:

$$\int\ln (\sec x + \tan x)\,dx\;=\;-2\ln u\arctan u\;+\;2\int{\arctan u\over u}\,du$$
$$=\;-2\ln u\arctan u\;+\;2\cdot{1\over 2i}\Big(\text{Li}_2(-ui)-\text{Li}_2(ui)\Big)$$
$$=\;i\Big(\text{Li}_2(ui)-\text{Li}_2(-ui)\Big)\;-\;2\ln u\arctan u$$

Back-substituting $x$ for $u$, we get the final answer of:

$$i\Big(\text{Li}_2\big(i(\sec x – \tan x)\big)-\text{Li}_2\big(-i(\sec x – \tan x)\big)\Big)\;-\;2\cdot\ln(\sec x – \tan x)\cdot\arctan\Big(\tan{x\over 2}\Big) + c$$

Cleaning things up, the final final answer is:

$$\boxed{\;\ln(\sec x + \tan x)\;+\;i\Big(\text{Li}_2(i\sec x – i\tan x)-\text{Li}_2(i\tan x – i\sec x)\Big)\,+\,c\;}$$

Did I make any errors? I have no idea how to interpret wolframalpha's wild answer; it's crazily different from mine: https://www.wolframalpha.com/input/?i=integral+of+ln(sec+x+%2B+tan+x)+dx

Best Answer

Using Tangent half-angle substitution, $$\sec2y-\tan2y=\dfrac{1-\sin2y}{\cos2y}=\dfrac{(1-\tan y)^2}{1-\tan^2y}=\tan\left(\dfrac\pi4-y\right)$$

which is not in general $=\tan y$

Related Question