Evaluate the Integral \(\int_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x \)

How to evaluate
\begin{equation}
I = \int\limits_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x
\end{equation}
was a question posed at Mathematics Stack Exchange.

Here is my solution. We express the inverse tangent as logarithms:
\begin{equation}
\tan^{-1}(z) = \frac{i}{2} [\ln(1-iz) – \ln(1+iz)]
\end{equation}
thus our integral becomes
\begin{align}
I &= \frac{i}{2} \int\limits_{0}^{1} \left(\ln(1-i\mathrm{e}^{x}) – \ln(1+i\mathrm{e}^{x}) \right) \mathrm{d}x \\
&= \frac{i}{2} (I_{1} + I_{2})
\end{align}

To evaluate \(I_{1}\) we make the substitution \(z = i\mathrm{e}^{x}\)
\begin{align}
I_{1} &= \int\limits_{0}^{1} \ln(1-ie^{x}) \mathrm{d}x \\
&= \int\limits_{i}^{i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z \\
&= \int\limits_{0}^{i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z – \int\limits_{0}^{i} \frac{\ln(1-z)}{z} \mathrm{d}z\\
&= \mathrm{Li}_{2}(i) – \mathrm{Li}_{2}(i\mathrm{e}) \\
&= i\mathrm{G} – \frac{\pi^{2}}{48} – \mathrm{Li}_{2}(i\mathrm{e})
\end{align}

To evaluate \(I_{2}\) we make the substitution \(-z = i\mathrm{e}^{x}\)
\begin{align}
I_{2} &= \int\limits_{0}^{1} \ln(1+ie^{x}) \mathrm{d}x \\
&= \int\limits_{-i}^{-i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z \\
&= \int\limits_{0}^{-i\mathrm{e}} \frac{\ln(1-z)}{z} \mathrm{d}z – \int\limits_{0}^{-i} \frac{\ln(1-z)}{z} \mathrm{d}z\\
&= \mathrm{Li}_{2}(-i\mathrm{e}) – \mathrm{Li}_{2}(-i) \\
&= \mathrm{Li}_{2}(-i\mathrm{e}) – \left(-i\mathrm{G} – \frac{\pi^{2}}{48} \right)
\end{align}

Putting the pieces together, we obtain our final result
\begin{align}
I &= \frac{i}{2} (I_{1} + I_{2}) \\
&= \frac{i}{2} [\mathrm{Li}_{2}(-i\mathrm{e}) – \mathrm{Li}_{2}(i\mathrm{e})] – \mathrm{G} \\
&= \int\limits_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x
\end{align}

Notes:

  1. \(\mathrm{G}\) is Catalan’s constant.
  2. Expressions for \(\mathrm{Li}_{2}(\pm i)\) can be found here.

Evaluate the Integral \(\int_{0}^{\pi /2} \frac{x}{\sin(x)} \mathrm{d}x \)

The proof of
\begin{equation}
\int\limits_{0}^{\pi /2} \frac{x}{\sin(x)} \mathrm{d}x = 2\mathrm{G}
\tag{1}
\label{eq:xosinx-1}
\end{equation}
where G is Catalan’s constant was part of a question at Mathematics Stack Exchange. The question could be answered without explicitly evaluating this integral, so I decided to evaluate it.

We begin by expanding the denominator in exponential functions and evaluating the following indefinite integral
\begin{align}
\int \frac{1}{\mathrm{e}^{ix}-\mathrm{e}^{-ix}} \mathrm{d}x &= -\int \frac{\mathrm{e}^{ix}}{1-\mathrm{e}^{i2x}} \mathrm{d}x \\
&= -\int \frac{\mathrm{e}^{ix}}{(1+\mathrm{e}^{ix})(1-\mathrm{e}^{ix})} \mathrm{d}x \\
&= -\frac{1}{2} \int \Big[\frac{\mathrm{e}^{ix}}{1+\mathrm{e}^{ix}} + \frac{\mathrm{e}^{ix}}{1-\mathrm{e}^{ix}} \Big] \mathrm{d}x \\
&= \frac{i}{2} \big[\ln(1+\mathrm{e}^{ix}) – \ln(1-\mathrm{e}^{ix})\big] + \mathrm{const}
\tag{2}
\label{eq:xosinx-2}
\end{align}

Now we evaluate the following integral by parts
\begin{equation}
\int \frac{x}{\mathrm{e}^{ix}-\mathrm{e}^{-ix}} \mathrm{d}x = ab \,- \int b \,\mathrm{d}a
\tag{3}
\label{eq:xosinx-3}
\end{equation}
where \(a = x ,\, \mathrm{d}a = \mathrm{d}x ,\, \mathrm{d}b = \mathrm{d}x/(\mathrm{e}^{ix}-\mathrm{e}^{-ix}) ,\, b = \) equation \eqref{eq:xosinx-2}.

The integral on the right in equation \eqref{eq:xosinx-3} is
\begin{align}
\int \ln(1+\mathrm{e}^{ix}) \mathrm{d}x &= i \int \frac{\ln(u)}{1-u} \mathrm{d}u \\
&= -i \int \frac{\ln(1-y)}{y} \mathrm{d}y \\
&= i \mathrm{Li}_{2}(y) \\
& = i \mathrm{Li}_{2}(-\mathrm{e}^{ix})
\tag{4}
\label{eq:xosinx-4}
\end{align}
where we used the following substitutions in succession: \(u = 1 + \mathrm{e}^{ix} ,\, y = 1-u\). \(\mathrm{Li}_{2}(z)\) is the dilogarithm.

Likewise, we have
\begin{equation}
\int \ln(1-\mathrm{e}^{ix}) \mathrm{d}x = i \mathrm{Li}_{2}(\mathrm{e}^{ix})
\tag{5}
\label{eq:xosinx-5}
\end{equation}

Putting all of the pieces together, we obtain the desired result
\begin{align}
\int\limits_{0}^{\pi /2} \frac{x}{\sin(x)} \mathrm{d}x &= i2 \int\limits_{0}^{\pi /2} \frac{x}{\mathrm{e}^{ix}-\mathrm{e}^{-ix}} \mathrm{d}x \\
&= x\big[\ln(1-\mathrm{e}^{ix}) – \ln(1+\mathrm{e}^{ix}) \big] + i\Big[\mathrm{Li}_{2}(-\mathrm{e}^{ix}) – \mathrm{Li}_{2}(\mathrm{e}^{ix}) \Big] \Big|_{0}^{\pi /2} \\
&= \frac{\pi}{2} \big[\ln(1-i) – \ln(1+i) \big] + i\Big[\mathrm{Li}_{2}(-i) – \mathrm{Li}_{2}(i)\Big] – 0 -i\Big[\mathrm{Li}_{2}(-1) – \mathrm{Li}_{2}(1)\Big] \\
&= \frac{\pi}{2} \Big[\frac{\ln(2)}{2} -i\frac{\pi}{4} – \frac{\ln(2)}{2} – i\frac{\pi}{4}\Big] + i\Big[-\frac{\pi^{2}}{48}-i\mathrm{G}+\frac{\pi^{2}}{48}-i\mathrm{G} \Big] – i\Big[-\frac{\pi^{2}}{12}-\frac{\pi^{2}}{6} \Big] \\
&= 2\mathrm{G}
\end{align}

Derivation of an Integral Expression of the Euler-Mascheroni Constant – Part 2

I derived the expression
\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x = -\gamma
\label{eq:1608161}
\tag{1}
\end{equation}
for the Euler-Mascheroni constant here. However, there is a far easier method that was fully derived in Advanced Integration Techniques by Zaid Alyafeai. I recommend this book to readers of this blog. It is free and contains many useful and interesting results.

We start with
\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} x^t \mathrm{d} x = \Gamma(t+1)
\label{eq:1608162}
\tag{2}
\end{equation}
Differentiate with respect to \(t\)
\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} x^t \mathrm{ln}(x) \mathrm{d} x = \frac{d\Gamma(t+1)}{dt} = \Gamma(t+1) \psi^{(0)}(t+1)
\label{eq:1608163}
\tag{3}
\end{equation}

Taking the limit of equation \eqref{eq:1608163}, \(t \to 0\) yields
\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x = \Gamma(1) \psi^{(0)}(1) = -\gamma
\label{eq:1608164}
\tag{4}
\end{equation}

Derivation of an Integral Expression of the Euler-Mascheroni Constant

\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x = -\gamma
\label{eq:1608111}
\tag{1}
\end{equation}

ii boros mollThere are of course an enormous number of integral expressions of the Euler-Mascheroni Constant. This particular expression appeared on the cover of Irresistible Integrals: Symbolics, Analysis and Experiments in the Evaluation of Integrals by George Boros and Victor Moll and was derived in section 9.3 of the book. Here, I will show this derivation and fill in the steps as well as parts that were not shown in the book.

Let us begin by providing a basic definition of the Euler-Mascheroni Constant
\begin{equation}
\gamma := \lim_{n \to \infty} H_{n} – \mathrm{ln}(n)
\label{eq:1608112}
\tag{2}
\end{equation}
where \(H_{n}\) are the harmonic numbers defined as
\begin{equation}
H_{n} = \displaystyle\sum_{k=1}^{n} \frac{1}{k}
\label{eq:1608113}
\tag{3}
\end{equation}

We will break up the derivation into parts to make it easier to follow.

1. Exercise 9.3.1 – Prove
\begin{equation}
\int\limits_{0}^{1} \frac{1-(1-x)^{n}}{x} \mathrm{d} x = H_{n}
\label{eq:1608114}
\tag{4}
\end{equation}

\begin{align}
\label{eq:1608115}
\tag{5}
\int\limits_{0}^{1} \frac{1-(1-x)^{n}}{x} \mathrm{d} x & = \int\limits_{0}^{1} \frac{1-y^{n}}{1-y} \mathrm{d} y \\
& = \int\limits_{0}^{1} \frac{1}{1-y} \mathrm{d} y \, – \int\limits_{0}^{1} \frac{y^{n}}{1-y} \mathrm{d} y \\
& = \int\limits_{0}^{1} \displaystyle\sum_{k=0}^{\infty} y^{k} \mathrm{d} y \,\, – \int\limits_{0}^{1} y^{n} \displaystyle\sum_{k=0}^{\infty} y^{k} \mathrm{d} y \\
& = \displaystyle\sum_{k=0}^{\infty} \frac{y^{k+1}}{k+1} \big|_{0}^{1} \,\, – \displaystyle\sum_{k=0}^{\infty} \frac{y^{k+n+1}}{k+n+1} \big|_{0}^{1} \\
& = (1 + \frac{1}{2} + \frac{1}{3} + \dots) \, – (\frac{1}{n+1} + \frac{1}{n+2} +\frac{1}{n+3} + \dots) \\
& = 1 + \frac{1}{2} + \frac{1}{3} + \dots + \frac{1}{n} = H_{n}
\end{align}

Notes:

  • \(|x| < 1\)
  • Let \(y=1-x\)
  • Expand \(1/(1-y)\) as a geometric series \begin{equation} \frac{1}{1-y} = \displaystyle\sum_{k=0}^{\infty} y^{k} \end{equation}
  • The integrals are improper, we have dropped the limits for clarity.
  • We assumed that the integrals converged uniformly so that we could integrate term by term. We acknowledge that this should be proven, but the assumption is warranted based on the form of the integrand and experience.

2. Proposition 9.3.1 – The Euler constant is given by
\begin{equation}
\gamma = \int\limits_{0}^{1} \frac{1-\mathrm{e}^{-x}}{x} \mathrm{d} x \,\, – \int\limits_{1}^{\infty} \frac{\mathrm{e}^{-x}}{x} \mathrm{d} x
\label{eq:1608116}
\tag{6}
\end{equation}
The proof in the book is fairly straightforward but there are some missing steps.

Make the substitution \(x = \frac{y}{n}\) in \eqref{eq:1608114} to obtain
\begin{align}
H_{n} & = \int\limits_{0}^{n} \frac{1-(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \\
& = \int\limits_{0}^{1} \frac{1-(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \,\, + \int\limits_{1}^{n} \frac{1-(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \\
& = \int\limits_{0}^{1} \frac{1-(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \,\, + \int\limits_{1}^{n} \frac{1}{y} \mathrm{d} y \,\, – \int\limits_{1}^{n} \frac{(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \\
& = \int\limits_{0}^{1} \frac{1-(1-\frac{y}{n})^{n}}{y} \mathrm{d} y \,\, + \mathrm{ln}(n) \, – \int\limits_{1}^{n} \frac{(1-\frac{y}{n})^{n}}{y} \mathrm{d} y
\label{eq:1608117}
\tag{7}
\end{align}

Applying \(\lim n \to \infty\) to equation \eqref{eq:1608117}, noting the limit definition of
\begin{equation}
\mathrm{e}^{\pm x} = \lim_{n \to \infty} \left(1 \pm \frac{x}{n} \right)^{n}
\end{equation}
and invoking equation \eqref{eq:1608112} yields our result.

3. Proposition 9.3.2 – Euler’s constant is given by equation \eqref{eq:1608111}.

Here we require one obvious alteration of the integral in light of \eqref{eq:1608117} and a non obvious trick.

\begin{equation}
\int\limits_{0}^{\infty} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x = \int\limits_{0}^{1} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x + \int\limits_{1}^{\infty} \mathrm{e}^{-x} \mathrm{ln}(x) \mathrm{d} x = \mathrm{I}_{1} + \mathrm{I}_{2}
\label{eq:1608118}
\tag{8}
\end{equation}

Integrating \(\mathrm{I}_{2}\) by parts and applying the appropriate limit yields
\begin{equation}
\mathrm{I}_{2} = \int\limits_{1}^{\infty} \frac{\mathrm{e}^{-x}}{x} \mathrm{d} x
\label{eq:1608119}
\tag{9}
\end{equation}

For \(\mathrm{I}_{1}\) use the substitution
\begin{equation}
\mathrm{e}^{-x} = -\frac{\mathrm d}{\mathrm d x} (\mathrm{e}^{-x} – 1),
\end{equation}
integrate by parts and apply the appropriate limit to obtain
\begin{equation}
\mathrm{I}_{1} = -\int\limits_{0}^{1} \frac{\mathrm{e}^{-x} – 1}{x} \mathrm{d} x
\label{eq:16081110}
\tag{10}
\end{equation}
Substituting equations \eqref{eq:16081110} and \eqref{eq:1608119} into \eqref{eq:1608118} and using \eqref{eq:1608116} yields our final result.