## Evaluate the Integral $$\int_{1}^{a^{2}} \frac{\ln x}{\sqrt{x}(x+a)} dx$$

This problem was posed at Mathematics Stack Exchange, here is my solution.

Let $$t=\sqrt{x}$$

I = \int\limits_{1}^{a^{2}} \frac{\ln x}{\sqrt{x}(x+a)} dx
= 4 \int\limits_{1}^{a} \frac{\ln t}{t^{2}+a} dt

Integrating by parts, we have
\begin{align}
I_{1} &= \int\limits_{1}^{a} \frac{\ln t}{t^{2}+a} dt \\
&= \frac{\ln t}{\sqrt{a}} \tan^{-1}\left( \frac{t}{\sqrt{a}} \right) \Big|_{1}^{a}
\, – \frac{1}{\sqrt{a}} \int\limits_{1}^{a} \frac{1}{t} \tan^{-1}\left( \frac{t}{\sqrt{a}} \right) dt \\
&= \frac{\ln a}{\sqrt{a}} \tan^{-1}(\sqrt{a})
\, – \frac{1}{\sqrt{a}} \int\limits_{1}^{a} \frac{1}{t} \tan^{-1}\left( \frac{t}{\sqrt{a}} \right) dt
\end{align}

Let $$y=t/ \sqrt{a}$$
\begin{align}
I_{2} &= \int\limits_{1}^{a} \frac{1}{t} \tan^{-1}\left( \frac{t}{\sqrt{a}} \right) dt
= \int\limits_{1/\sqrt{a}}^{\sqrt{a}} \frac{1}{y} \tan^{-1}(y) dy \\
\tag{a}
&= \frac{i}{2} \left[ \int\limits_{1/\sqrt{a}}^{\sqrt{a}} \frac{\ln (1-iy)}{y} dy
\, – \int\limits_{1/\sqrt{a}}^{\sqrt{a}} \frac{\ln (1+iy)}{y} dy \right] \\
\tag{b}
&= \frac{i}{2} \left[ \mathrm{Li}_{2}(-iy) – \mathrm{Li}_{2}(iy) \right] \Big|_{1/\sqrt{a}}^{\sqrt{a}} \\
&= \frac{i}{2} \left( \left[ \mathrm{Li}_{2}(-i\sqrt{a}) + \mathrm{Li}_{2}\left(\frac{i}{\sqrt{a}}\right) \right]
– \left[ \mathrm{Li}_{2}(i\sqrt{a}) + \mathrm{Li}_{2}\left(\frac{-i}{\sqrt{a}}\right) \right] \right) \\
\tag{c}
&= \frac{i}{2} \left( \left[ -\frac{\pi ^{2}}{6} – \frac{1}{2} \ln ^{2}(i\sqrt{a}) \right]
– \left[ -\frac{\pi ^{2}}{6} – \frac{1}{2} \ln ^{2}(-i\sqrt{a}) \right] \right) \\
\tag{d}
&= \frac{\pi}{4} \ln a
\end{align}
a. $$\tan^{-1}(y) = \frac{i}{2} [\ln (1-iy) – \ln (1+iy)]$$

b. Dilogarithm function

\mathrm{Li}_{2}(z) = -\int_{0}^{z} \frac{\ln (1-x)}{x} dx

c. Use the identity

\mathrm{Li}_{2}(z) + \mathrm{Li}_{2}(1/z) = -\frac{\pi ^{2}}{6} – \frac{1}{2} \ln ^{2}(-z)

d. $$\ln (\pm iz) = \ln z \pm i\pi /2$$

Now we have

I = 4I_{1} = \frac{4}{\sqrt{a}} (\ln a) \tan^{-1}(\sqrt{a}) \, – \frac{\pi}{\sqrt{a}} \ln a

## Introduction

The Gudermannian function, named in honor of Christoph Gudermann, is a way to relate the trigonometric and hyperbolic functions without the use of complex variables. The basic definition is

\mathrm{gd} u = \int\limits_{0}^{u} \frac{1}{\cosh x} dx
\tag{1}
\label{eq:g1}

## Derivation of the Basic Definition and Basic Properties

To derive equation \eqref{eq:g1}, we begin with the hyperbola $$x^{2} – y^{2} = a^{2}$$. A point on the hyperbola has coordinates $$(x,y)$$ where

x = a \sec\theta = a \cosh u \quad \mathrm{and} \quad y = a \tan\theta = a \sinh u

Thus we have:

Using basic trigonometry we obtain

\cot\theta = \mathrm{csch} u \,\, \cos\theta = \mathrm{sech} u \,\, \sin\theta = \tanh u \,\,
\csc\theta = \coth u

We solve $$\tan\theta = \sinh u$$ for $$\theta$$ to obtain, $$\theta = \tan^{-1}(\sinh u)$$. Differentiating yields

\frac{d\theta}{du} = \frac{\cosh u}{1 + \sinh^{2} u} = \frac{1}{\cosh u}

Integrating yields

\theta = \int_{0}^{u} \frac{1}{\cosh t} dt

If we designate $$\theta$$ as the Gudermannian of $$u$$, $$\theta = \mathrm{gd} u$$, we obtain Equation \eqref{eq:g1}. Also, we can rewrite our relations between the trig and hyperbolic functions as
\begin{align}
\sec(\mathrm{gd} u) &= \cosh u, \quad \tan(\mathrm{gd} u) = \sinh u, \quad \cot(\mathrm{gd} u) = \mathrm{csch} u \\
\cos(\mathrm{gd} u) &= \mathrm{sech} u, \quad \sin(\mathrm{gd} u) = \tanh u, \quad \csc(\mathrm{gd} u) = \coth u
\end{align}

1. Let $$y = \tanh z/2$$
\begin{align}
\frac{1}{2} \mathrm{gd} u &= \frac{1}{2} \int\limits_{0}^{u} \frac{1}{\cosh z} dz
= \int\limits_{0}^{u} \frac{1}{\mathrm{e}^{z}+\mathrm{e}^{-z}} dz \\
&= \int\limits_{0}^{\tanh u/2} \frac{1}{y^{2}+1} dy \\
&= \tan^{-1}\left(\tanh\frac{u}{2} \right)
\end{align}
We can rewrite this as

\tan\left(\frac{1}{2} \mathrm{gd} u \right) = \tanh\frac{u}{2}

2. Let $$y= \mathrm{e}^{z}$$
\begin{align}
\mathrm{gd} u &= 2\int\limits_{0}^{u} \frac{1}{\mathrm{e}^{z}+\mathrm{e}^{-z}} dz
= 2\int\limits_{0}^{u} \frac{\mathrm{e}^{z}}{\mathrm{e}^{2z}+1} dz \\
&= 2\int\limits_{1}^{\mathrm{e}^{u}} \frac{1}{y^{2}+1} dy \\
&= 2\tan^{-1}\mathrm{e}^{u} \, -\frac{\pi}{2}
\tag{2}
\label{eq:g2}
\end{align}

## Derivative of the Gudermannian

\frac{d}{dx}\mathrm{gd}x = \mathrm{sech}(x)

follows from the integral definition.

## Maclaurin Series

$$\mathrm{gd}(0) = 0$$ follows from the integral definition.

\mathrm{gd}^{\prime}(0) = \mathrm{sech}(0) = 1

\mathrm{gd}^{\prime \prime}(0) = \mathrm{sech}^{\prime}(0) = -\mathrm{sech}(0)\tanh(0) = 0

\mathrm{gd}^{\prime \prime \prime}(0) = \mathrm{sech}^{\prime \prime}(0) = \mathrm{sech}(0)\tanh^{2}(0) – \mathrm{sech}^{3}(0) = -1

\mathrm{gd}x = \sum\limits_{n=0}^{\infty} \frac{x^{n}}{n!} \frac{d^{n}\mathrm{gd}(0)}{dx^{n}}
= x \, – \frac{x^{3}}{6} + \cdots

## The Gudermannian is an Odd Function

$$\mathrm{gd}(-x) = -\mathrm{gd}x$$ follows from the Maclaurin series.

## The Exponential Function and the Gudermannian

First:
\begin{align}
\mathrm{e}^{x} &= \sec(\mathrm{gd}x) + \tan(\mathrm{gd}x) \\
&= \cosh x + \sinh x \\
&= \frac{\mathrm{e}^{x} + \mathrm{e}^{-x}}{2} + \frac{\mathrm{e}^{x} – \mathrm{e}^{-x}}{2} \\
&= \mathrm{e}^{x}
\end{align}
Second:
\begin{align}
\mathrm{e}^{x} &= \frac{1+\sin(\mathrm{gd}x)}{\cos(\mathrm{gd}x)} \\
&= \sec(\mathrm{gd}x) + \tan(\mathrm{gd}x) \\
&= \mathrm{e}^{x}
\end{align}
Third:
\begin{align}
\mathrm{e}^{x} &= \tan\left(\frac{\pi}{4} + \frac{1}{2}\mathrm{gd}x \right) \\
&= \sec(\mathrm{gd}x) + \tan(\mathrm{gd}x) \\
&= \mathrm{e}^{x}
\end{align}

## Integral of the Gudermannian

Begin with Equation \eqref{eq:g2}, $$\mathrm{gd}x = 2\tan^{-1}\mathrm{e}^{x} \, – \pi/2$$ so that we have

\int \mathrm{gd}x \, dx = 2\int \tan^{-1}\mathrm{e}^{x} dx – \int \frac{\pi}{2} dx

Using

\tan^{-1}z = \frac{i}{2}\Big[\ln(1-iz) – \ln(1+iz)\Big]

and integrating this expression, yields
\begin{align}
\int \tan^{-1}\mathrm{e}^{x} dx &= \frac{i}{2}\int\Big[\ln(1-i\mathrm{e}^{x}) – \ln(1+i\mathrm{e}^{x})\Big] dx \\
&= \frac{i}{2} [-\mathrm{Li}_{2}(i\mathrm{e}^{x}) + \mathrm{Li}_{2}(-i\mathrm{e}^{x})]
\end{align}
We used the substitution $$y=-i\mathrm{e}^{x}$$ and the dilogarithm function $$\mathrm{Li}_{2}(z)$$.
Putting the pieces together, we obtain

\int \mathrm{gd}x \, dx = i[\mathrm{Li}_{2}(-i\mathrm{e}^{x})-\mathrm{Li}_{2}(i\mathrm{e}^{x})] – \frac{\pi}{2}x

## References

1. Wolfram MathWorld
2. Wikipedia
3. A Treatise on the Integral Calculus – Joseph Edwards; Chapter 3, Article 69.

## Evaluate the Integral $$\int \frac{x}{\mathrm{e}^{x}-1} dx$$

This question was posed at Mathematics Stack Exchange, here is my solution.

I = \int \frac{x}{\mathrm{e}^{x}-1} dx = -I_{1} = -\int \frac{x}{1-\mathrm{e}^{x}} dx

Integrate by parts
\begin{align}
I_{1} &= \int \frac{x}{1-\mathrm{e}^{x}} dx \\
\tag{1}
&= x^{2} – x \ln(1-\mathrm{e}^{x}) – \int x dx + \int \ln(1-\mathrm{e}^{x}) dx \\
\tag{2}
&= x^{2} – x \ln(1-\mathrm{e}^{x}) – \frac{x^{2}}{2} – \mathrm{Li}_{2}(\mathrm{e}^{x})
\end{align}
and thus

\int \frac{x}{\mathrm{e}^{x}-1} dx = x \ln(1-\mathrm{e}^{x}) – \frac{x^{2}}{2} + \mathrm{Li}_{2}(\mathrm{e}^{x})

1. Let $$u=\mathrm{e}^{x}$$
\begin{align}
\int \frac{1}{1-\mathrm{e}^{x}} dx &= \int \frac{1}{u(1-u)} du \\
&= \int \left( \frac{1}{u} + \frac{1}{1-u} \right) du \\
&= \ln \frac{u}{1-u} \\
&= x – \ln(1-\mathrm{e}^{x})
\end{align}

2. Let $$u=\mathrm{e}^{x}$$
\begin{align}
\int \ln(1-\mathrm{e}^{x}) dx &= \int \frac{\ln(1-u)}{u} du \\
&= -\mathrm{Li}_{2}(u) \\
&= -\mathrm{Li}_{2}(\mathrm{e}^{x})
\end{align}
where

\mathrm{Li}_{2}(z) = -\int\limits_{0}^{z} \frac{\ln(1-x)}{x} dx

is the dilogarithm function.

## Prove $$\int_{0}^{1} \frac{\sin^{-1}(x)}{x} dx = \frac{\pi}{2}\ln2$$

I stumbled upon the interesting definite integral

\int\limits_{0}^{1} \frac{\sin^{-1}(x)}{x} dx = \frac{\pi}{2}\ln2

Here is my proof of this result.

Let $$u=\sin^{-1}(x)$$ then integrate by parts,
\begin{align}
\int \frac{\sin^{-1}(x)}{x} dx &= \int u \cot(u) du \\
&= u \ln\sin(u) – \int \ln\sin(u) du
\tag{1}
\label{eq:20161030-1}
\end{align}

\begin{align}
\int \ln\sin(u) du &= \int \ln\left(\frac{\mathrm{e}^{iu} – \mathrm{e}^{-iu}}{i2} \right) du \\
&= \int \ln \left(\mathrm{e}^{iu} – \mathrm{e}^{-iu} \right) du \,- \int \ln (i2) du \\
&= \int \ln \left(1 – \mathrm{e}^{-i2u} \right) du + \int \ln \mathrm{e}^{iu} du \,-\, u\ln (i2) \\
&= \int \ln \left(1 – \mathrm{e}^{-i2u} \right) du + \frac{i}{2}u^{2} -u\ln 2 \,-\, ui\frac{\pi}{2}
\tag{2}
\label{eq:20161030-2}
\end{align}

To evaluate the integral above, let $$y=\mathrm{e}^{-i2u}$$

\int \ln \left(1 – \mathrm{e}^{-i2u} \right) du = \frac{i}{2} \int \frac{\ln (1-y)}{y} dy
= -\frac{i}{2} \mathrm{Li}_{2}(y) = -\frac{i}{2} \mathrm{Li}_{2}\mathrm{e}^{-i2u}
\tag{3}
\label{eq:20161030-3}

Now we substitute equation \eqref{eq:20161030-3} into equation \eqref{eq:20161030-2}, then substitute that result into equation \eqref{eq:20161030-1}, switch variables back to $$x$$, and apply limits,
\begin{align}
\int\limits_{0}^{1} \frac{\sin^{-1}(x)}{x} dx
&= \sin^{-1}(x) \ln (x) + \sin^{-1}(x)\left(\ln 2 + i\frac{\pi}{2}\right) \\
&- \frac{i}{2}[\sin^{-1}(x)]^{2} + \frac{i}{2} \mathrm{Li}_{2}\mathrm{e}^{-i2\sin^{-1}(x)} \Big|_{0}^{1} \\
&= \frac{\pi}{2}\ln2
\end{align}

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

How to evaluate

I = \int\limits_{0}^{1} \tan^{-1}(\mathrm{e}^{x}) \mathrm{d}x

was a question posed at Mathematics Stack Exchange.

Here is my solution. We express the inverse tangent as logarithms:

\tan^{-1}(z) = \frac{i}{2} [\ln(1-iz) – \ln(1+iz)]

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 \frac{x}{e^{x}-1} \mathrm{d}x$$

How to evaluate

\int \frac{x}{e^{x}-1} \mathrm{d}x
\tag{1}
\label{eq:161007-1}

was a question posed at Mathematics Stack Exchange.

Here is my solution.

Begin with

I_{1} = \int \frac{1}{e^{x}-1} \mathrm{d}x = \int \frac{e^{-x}}{1-e^{-x}} \mathrm{d}x = \ln(1-e^{-x})
\tag{2}
\label{eq:161007-2}

and rewrite our result as
\begin{align}
\ln(1-e^{-x}) &= \ln[-e^{-x}(-e^{-x}+1)] \\
&= \ln(-1) + \ln(e^{-x}) + \ln(1-e^{x}) \\
&= i\pi \,- x + \ln(1-e^{x})
\end{align}
and thus

I_{1} = i\pi \,- x + \ln(1-e^{x})

Now we evaluate equation \eqref{eq:161007-1}, our original integral, via integration by parts. For $$\int a\mathrm{d}b = ab – \,\int b\mathrm{d}a$$ we have $$a = x$$, $$\mathrm{d}b = (e^{x}-1)^{-1}$$, and $$b = I_{1}$$

\int \frac{x}{e^{x}-1} \mathrm{d}x = x I_{1} \,- \int I_{1} \mathrm{d}x

\int I_{1} \mathrm{d}x = \int [i\pi \,- x + \ln(1-e^{x})] \mathrm{d}x = i\pi x \,- \frac{1}{2}x^{2} + \int \ln(1-e^{x}) \mathrm{d}x

For the integral on the right hand side, we make the substitution $$y = e^{x}$$,

\int \ln(1-e^{x}) \mathrm{d}x = \int \frac{\ln(1-y)}{y} \mathrm{d}y = -\mathrm{Li}_{2}(y) = -\mathrm{Li}_{2}(e^{x})

Putting all of the pieces together, we have
\begin{align}
\int \frac{x}{e^{x}-1} \mathrm{d}x &= i\pi x \,- x^{2} + x\ln(1-e^{x}) – \left(i\pi x \,- \frac{1}{2}x^{2} -\mathrm{Li}_{2}(e^{x}) \right) \\
&= \mathrm{Li}_{2}(e^{x}) + x\ln(1-e^{x}) \,- \frac{1}{2}x^{2} + \mathrm{const}
\end{align}

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

The proof of

\int\limits_{0}^{\pi /2} \frac{x}{\sin(x)} \mathrm{d}x = 2\mathrm{G}
\tag{1}
\label{eq:xosinx-1}

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

\int \frac{x}{\mathrm{e}^{ix}-\mathrm{e}^{-ix}} \mathrm{d}x = ab \,- \int b \,\mathrm{d}a
\tag{3}
\label{eq:xosinx-3}

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

\int \ln(1-\mathrm{e}^{ix}) \mathrm{d}x = i \mathrm{Li}_{2}(\mathrm{e}^{ix})
\tag{5}
\label{eq:xosinx-5}

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}