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


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$

  • 3
    $\begingroup$ What??! :D Don't tell me that the substitution in the back of my head was wrong. Perhaps it was $\tan{x\over 2}=\csc x-\cot x$ not sec x - tan x. That must be it. Time to do all of the work over again. Fun $\endgroup$ – KKZiomek Jan 17 at 3:47
  • $\begingroup$ And also thank you. See, it is not advised to trust a memory of an identity which you saw the last time months ago ;) $\endgroup$ – KKZiomek Jan 17 at 3:49
  • $\begingroup$ @KKZiomek, No perhaps and rework! Replace $\dfrac\pi4-y=u$ $\endgroup$ – lab bhattacharjee Jan 17 at 3:54
  • $\begingroup$ Yup, thank you! $\endgroup$ – KKZiomek Jan 17 at 4:19
  • $\begingroup$ So the answer was close except for a phase shift and a negation $\endgroup$ – KKZiomek Jan 17 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.