In 2002, Zafar Ahmed introduced a beautiful and surprisingly tricky definite integral:

\[\int_{0}^{1} \frac{\arctan\bigl(\sqrt{2+x^2}\bigr)}{\sqrt{2+x^2}(1+x^2)} \, \mathrm{d}x = \frac{5\pi^2}{96},\]

This result, now known as Ahmed’s integral, possesses a hidden structure that can be revealed by placing it within a much broader family of integrals. In this post, we’ll explore a powerful three-parameter generalization that does just that.

1. Definition

Let’s define our generalized Ahmed integral, $A(p, q, r)$, as follows:

\[\begin{equation} A(p,q,r) = \int_{0}^{p} \frac{\arctan\bigl( q\sqrt{1+x^2} \bigr)}{\sqrt{1+x^2}} \frac{r}{1+(1+r^2)x^2} \, \mathrm{d}x \tag{1.1} \end{equation}\]

This definition is related to the original Ahmed’s integral as follows:

\[\int_{0}^{1} \frac{\arctan\bigl(\sqrt{2+x^2}\bigr)}{\sqrt{2+x^2}(1+x^2)} \, \mathrm{d}x = A\left(\frac{1}{\sqrt{2}}, \sqrt{2}, 1 \right).\]

Now, let’s explore the properties of this new function. By using the identity $\arctan(z) = \int_{0}^{z} \frac{\mathrm{d}y}{1+y^2}$, we can express $A(p, q, r)$ as a more symmetric double integral:

\[\begin{equation} A(p,q,r) = \int_{0}^{p} \int_{0}^{q} \frac{1}{1+(1+x^2)y^2} \frac{r}{1+(1+r^2)x^2} \, \mathrm{d}y \mathrm{d}x \tag{1.2} \end{equation}\]

The key to unlocking the secrets of $A(p, q, r)$ is a clever change of variables. It turns out that the integral’s structure is best described not by $p, q, r$ directly, but by a new set of auxiliary parameters:

\[\begin{align*} \tilde{p} &= r\sqrt{1+q^2} \\ \tilde{q} &= p\sqrt{1+r^2} \\ \tilde{r} &= q\sqrt{1+p^2} \\ \kappa &= pqr \end{align*}\]

As we’ll see, the value of the integral depends only on these four quantities, which points to a deep underlying symmetry in the problem.

To simplify our analysis, we introduce an augmented Ahmed integral, $\tilde{A}(p, q, r)$, which is our generalization plus a simple correction term, $B(p, q, r)$:

\[\tilde{A}(p, q, r) = A(p, q, r) + B(r, p, q)\]

where the correction term is defined as:

\[B(p, q, r) = \arctan\bigl(p\sqrt{1+r^2}\bigr)\arctan\biggl( \frac{qr}{\sqrt{1+r^2}} \biggr)\]

The power of the auxiliary parameters becomes immediately clear when we rewrite this correction term. It simplifies into:

\[B(p, q, r) = \arctan(\tilde{q})\arctan(\kappa/\tilde{q})\]

These auxiliary parameters are not fully independent. Rather, they are bound by some remarkable algebraic relations. For instance, they satisfy the following identity:

\[\begin{equation} \frac{\kappa^2 + \tilde{p}^2}{1 + \tilde{p}^2} \times \frac{\kappa^2 + \tilde{q}^2}{1 + \tilde{q}^2} \times \frac{\kappa^2 + \tilde{r}^2}{1 + \tilde{r}^2} = \kappa^2. \tag{1.3} \end{equation}\]

With these definitions in place, we’re now ready to see how they all work together to evaluate the integral.

2. Basic Properties

2.1. A Surprising Symmetry

The augmented integral $\tilde{A}(p, q, r)$ isn’t just an arbitrary construction. It obeys a beautiful rule: its value doesn’t change when you cycle its parameters. This is the first key to unlocking its secrets.

Theorem 2.1 (Cyclic Symmetry). The augmented Ahmed integral is symmetric under cyclic permutation of its arguments:

\[\tilde{A}(p, q, r) = \tilde{A}(q, r, p) = \tilde{A}(r, p, q)\]

To prove this, we’ll find two different expressions for the original integral $A(p,q,r)$ and then show how they force the augmented version, $\tilde{A}$, to be symmetric.

Proof. Applying integration by parts to $\text{(1.1)}$, the single-integral definition of $A(p,q,r)$, gives us the following identity:

\[\begin{equation} A(p,q,r) = B(q, r, p) - \int_{0}^{p} \arctan\biggl(\frac{rx}{\sqrt{1+x^2}}\biggr) \frac{qx}{(1+q^2(1+x^2))\sqrt{1+x^2}} \, \mathrm{d}x. \tag{2.1} \end{equation}\]

In doing so, we invoked the following indefinite integral:

\[\int \frac{r}{(1+(1+r^2)x^2)\sqrt{1+x^2}} \, \mathrm{d}x = \arctan\left( \frac{rx}{\sqrt{1+x^2}} \right) + \mathsf{C}.\]

Next, we’ll attack $\text{(1.2)}$, the double-integral form of $A(p, q, r)$, using partial fraction decomposition:

\[\frac{1}{1+(1+x^2)y^2} \frac{r}{1+(1+r^2)x^2} = \frac{1}{1+(1+y^2)r^2} \biggl( \frac{r(1+r^2)}{1 + (1+r^2)x^2} - \frac{ry^2}{1+(1+x^2)y^2} \biggr).\]

Integrating both sides with respect to $x$ first and then to $y$, it follows that

\[\begin{equation} A(p, q, r) = B(p, q, r) - \int_{0}^{q} \arctan\biggl(\frac{py}{\sqrt{1+y^2}}\biggr) \frac{ry}{(1+r^2(1+y^2))\sqrt{1+y^2}} \, \mathrm{d}y. \tag{2.2} \end{equation}\]

Now we have two different formulas, $\text{(2.1)}$ and $\text{(2.2)}$, for $A(p, q, r)$. Comparing these two formulas, we conclude that

\[A(p,q,r) - B(q, r, p) = A(r, p, q) - B(r, p, q),\]

which in turn implies $\tilde{A}(p, q, r) = \tilde{A}(r, p, q)$, completing the proof. $\square$

2.2 Power Series Expansions

We define the binomial coefficient for integer arguments $n, k \in \mathbb{Z}$ using the following contour integral representation:

\[\begin{equation} \binom{n}{k} = \frac{1}{2\pi i} \oint_{(0)+} \frac{(1+z)^n}{z^{k+1}} \, \mathrm{d}z = \begin{cases} \displaystyle \frac{n(n-1)\cdots(n-k+1)}{k!}, & k \geq 0 \\[0.5em] 0, & k < 0 \end{cases} \tag{2.3} \end{equation}\]

Here, the integral is taken along a simple closed curve that winds around the origin in the positive (counter-clockwise) direction within a sufficiently small neighborhood. Using this definition, we get:

Lemma 2.2. For $\alpha \in \mathbb{Z}$ and for $\lvert z \rvert < 1$,

\[\sum_{l=0}^{\infty} \binom{l+\alpha}{l} z^l = \frac{1}{(1 - z)^{\alpha+1}}.\]

Proof. By the principle of analytic continuation, it suffices to prove the identity for $\lvert z \rvert$ sufficiently small. Plugging the definition $\text{(2.3)}$ into the left-hand side, we have:

\[\begin{align*} \sum_{l=0}^{\infty} \binom{l+\alpha}{l} z^l &= \sum_{l=0}^{\infty} \left( \frac{1}{2\pi i} \oint_{(0)+} \frac{(1+\xi)^{l+\alpha}}{\xi^{l+1}} \, \mathrm{d}\xi \right) z^l \\ &= \frac{1}{2\pi i} \oint_{(0)+} \frac{(1+\xi)^{\alpha}}{\xi} \sum_{l=0}^{\infty} \left( \frac{z(1+\xi)}{\xi} \right)^l \, \mathrm{d}\xi \\ &= \frac{1}{2\pi i} \oint_{(0)+} \frac{(1+\xi)^{\alpha}}{\xi\left( 1 - \frac{z(1+\xi)}{\xi} \right)} \, \mathrm{d}\xi \\ &= \frac{1}{2\pi i} \oint_{(0)+} \frac{(1+\xi)^{\alpha}}{(1-z)\xi - z} \, \mathrm{d}\xi \\ &= \frac{1}{(1 - z)^{\alpha+1}}. \end{align*}\]

This lemma allows us to derive the power series for our integrals.

Theorem 2.3. For $p, q, r$ in a neighborhood of the origin, we have

\[\begin{equation} A(p, q, r) = \sum_{a,b,c\geq 0} \frac{(-1)^{a+b}}{(2a+1)(2b+1)} \binom{a-b}{a-c} p^{2a+1} q^{2b+1} r^{2c+1}. \tag{2.4} \end{equation}\]

and

\[\begin{equation} B(r, p, q) = \sum_{a, b, c \geq 0} \frac{(-1)^{a+c}}{(2a+1)(2c+1)} \binom{c-a}{b-a} p^{2a+1} q^{2b+1} r^{2c+1}. \tag{2.5} \end{equation}\]

Proof. We first prove $\text{(2.4)}$. Starting from the right-hand side, we substitute $l = a-c$. Since $\binom{a-b}{a-c}$ is non-zero only for $l \geq 0$, it follows that:

\[\begin{align*} \text{RHS of (2.4)} &= \sum_{b\geq 0} \sum_{c \geq 0} \sum_{l \geq 0} \frac{(-1)^{l+c+b}}{(2l+2c+1)(2b+1)} \binom{l+c-b}{l} p^{2l+2c+1}q^{2b+1} r^{2c+1} \\ &= \sum_{b\geq 0} \sum_{c \geq 0} (-1)^{c+b} r^{2c+1} \left( \int_{0}^{p} x^{2c} \sum_{l \geq 0} \binom{l+c-b}{l}(-x^2)^l \, \mathrm{d}x \right)\left( \int_{0}^{q} y^{2b} \, \mathrm{d}y \right) \\ &= \sum_{c \geq 0} \sum_{b\geq 0} (-1)^{c+b} r^{2c+1} \left( \int_{0}^{p} \frac{x^{2c}}{(1+x^2)^{c-b+1}} \, \mathrm{d}x \right)\left( \int_{0}^{q} y^{2b} \, \mathrm{d}y \right) \end{align*}\]

In the last step, we applied Lemma 2. Interchanging the order of summation and integration, we obtain:

\[\begin{align*} &= \int_{0}^{p} \int_{0}^{q} \left( \sum_{c \geq 0} \frac{(-1)^{c} x^{2c} r^{2c+1}}{(1+x^2)^{c+1}} \right) \left( \sum_{b \geq 0} (-1)^b(1+x^2)^{b}y^{2b} \right) \, \mathrm{d}y \mathrm{d}x \\ &= \int_{0}^{p} \int_{0}^{q} \left( \frac{\frac{r}{1+x^2}}{1 + \frac{r^2 x^2}{1+x^2}} \right) \left( \frac{1}{1 + (1+x^2)y^2} \right) \, \mathrm{d}y \mathrm{d}x \\ &= \int_{0}^{p} \int_{0}^{q} \frac{r}{1+(1+r^2)x^2} \frac{1}{1+(1+x^2)y^2} \, \mathrm{d}y \mathrm{d}x, \end{align*}\]

which is precisely the double-integral definition of $A(p, q, r)$. The identity $\text{(2.5)}$ is proved in a similar manner. $\square$

We can now state the key result of this section.

Theorem 2.4. For $p, q, r$ small enough that $\tilde{p}, \tilde{q}, \tilde{r}, \kappa \in \mathbb{D}$,

\[\begin{equation} \begin{aligned} \tilde{A}(p, q, r) &= 2\chi_2(\kappa) \\ &\quad + \frac{\kappa}{2} \int_{0}^{1} \frac{1}{1-\kappa^2 x^2} \log\left(\frac{1+\tilde{p}^2x^2}{1+\tilde{p}^2} \times \frac{1+\tilde{q}^2x^2}{1+\tilde{q}^2} \times \frac{1+\tilde{r}^2x^2}{1+\tilde{r}^2}\right) \, \mathrm{d}x. \end{aligned} \tag{2.6} \end{equation}\]

Here, $\chi_s(z)$ is the Legendre chi function, defined by

\[\chi_s(z) = \sum_{n=0}^{\infty} \frac{z^{2n+1}}{(2n+1)^s}.\]

Proof. It suffices to prove It is convenient to define the quantities

\[\begin{gather*} U(a,b,c) = \frac{(-1)^{c-a}}{(2a+1)(2c+1)} \binom{c-a}{c-b}, \\ L(a,b,c) = \frac{(-1)^{c-a}}{(2a+1)(2c+1)} \binom{c-a}{b-a}. \end{gather*}\]

From Theorem 1, the coefficient of $p^{2a+1}q^{2b+1}r^{2c+1}$ in the expansion of $\tilde{A}(p, q, r)$ is invariant under cyclic permutation of $(a,b,c)$, which yields the relations:

\[\begin{align*} [p^{2a+1}q^{2b+1}r^{2c+1}] \tilde{A}(p, q, r) &= U(b, c, a) + L(a, b, c) \\ &= U(c, a, b) + L(b, c, a) \\ &= U(a, b, c) + L(c, a, b). \end{align*}\]

We consider several cases for the indices and examine the coefficient in each of the cases:

  • If $a = b = c$, then $U(a, a, a) = L(a, a, a) = \frac{1}{(2a+1)^2}$, and so, the coefficient is $\frac{2}{(2a+1)^2}$.
  • If $a \leq b \leq c$ and $a \neq c$, then $a < c$. This implies $U(b, c, a) = 0$, so the coefficient is simply $L(a, b, c)$.
  • If $b < a \leq c$, then $U(c, a, b) = L(b, c, a) = 0$. Hence, the coefficient is zero.

This analysis, combined with the cyclic symmetry, provides a complete description of the series coefficients for $\tilde{A}(p, q, r)$. This leads to the following expression:

\[\begin{align*} \tilde{A}(p, q, r) &= 2 \sum_{a \geq 0} \frac{(pqr)^{2a+1}}{(2a+1)^2} \\ &\quad + \sum_{\substack{0\leq a \leq b \leq c \\ a \neq c }} L(a, b, c) p^{2a+1}q^{2b+1}r^{2c+1} \\ &\quad + \sum_{\substack{0\leq b \leq c \leq a \\ b \neq a }} L(b, c, a) p^{2a+1}q^{2b+1}r^{2c+1} \\ &\quad + \sum_{\substack{0\leq c \leq a \leq b \\ c \neq b }} L(c, a, b) p^{2a+1}q^{2b+1}r^{2c+1} \end{align*}\]

Simplifying these summations yields the desired integral representation $\text{(2.6)}$. $\square$

2.3. Alternative Representations of $\tilde{A}(p, q, r)$

The integral representation in Theorem 4 is pivotal. To simplify it, we will now analyze the properties of the integral term, which we define as:

\[\begin{equation} I(k, s) := \frac{k}{2} \int_{0}^{1} \frac{1}{1-k^2 x^2} \log\left(\frac{1+s^2x^2}{1+s^2}\right) \, \mathrm{d}x. \tag{2.7} \end{equation}\]

This integral satisfies the following functional equation.

Lemma 2.5. For $0 < k < 1$ and $s > 0$,

\[\begin{equation} I(k, s) + I(k, k/s) = -\chi_2(k) + \arctan(s)\arctan(k/s). \tag{2.8} \end{equation}\]

Proof. We begin with integration by parts, which yields

\[\begin{align*} I(k, s) &= -\int_{0}^{1} \frac{s^2 x}{1+s^2x^2} \operatorname{artanh}(kx) \, \mathrm{d}x \\ &= -\chi_2(k) + \int_{0}^{1} \frac{1}{1+s^2x^2} \frac{\operatorname{artanh}(kx)}{x} \, \mathrm{d}x \\ &= -\chi_2(k) + \int_{0}^{1} \frac{1}{1+s^2x^2} \int_{0}^{k} \frac{1}{1 - x^2 t^2} \, \mathrm{d}t\mathrm{d}x \\ &= -\chi_2(k) + \int_{0}^{1} \int_{0}^{k} \left( \frac{t^2}{1 - x^2 t^2} + \frac{s^2}{1+s^2x^2} \right) \frac{1}{t^2 + s^2} \, \mathrm{d}t\mathrm{d}x \\ &= -\chi_2(k) + \int_{0}^{k} \frac{t \operatorname{artanh}(t) + s \arctan(s)}{t^2 + s^2} \, \mathrm{d}t \\ &= -\chi_2(k) + \arctan(s)\arctan(k/s) + \int_{0}^{1} \frac{k^2 t}{k^2 t^2 + s^2} \operatorname{artanh}(k t) \, \mathrm{d}t. \end{align*}\]

From the first line of the computation, we can identify the final integral as $-I(k,k/s)$. Then the resulting relation rearranges to the desired identity $\text{(2.8)}$. $\square$

Our next step requires the function $F(k,s)$, defined by the integral:

\[\begin{equation} F(k, s) = \int_{0}^{s} \frac{k \arctan t}{k^2 + t^2} \, \mathrm{d}t. \tag{2.9} \end{equation}\]

This function is related to $I(k, s)$ via the following identity:

Lemma 2.6. We have

\[\begin{equation} I(k, s) = \frac{1}{2} \operatorname{artanh}(k) \log\left( \frac{1 + s^2/k^2}{1 + s^2} \right) - F(k, s) \tag{2.10} \end{equation}\]

Proof. We invoke Feynman’s trick of differentiating under the integral sign. Differentiating $I(k,s)$ with respect to $s$, we get:

\[\begin{align*} \frac{\partial I}{\partial s} &= \frac{k}{2} \int_{0}^{1} \frac{1}{1-k^2 x^2} \left( \frac{2s x^2}{1+s^2 x^2} - \frac{2s}{1+s^2} \right) \, \mathrm{d}x \\ &= -\frac{s}{1+s^2} \operatorname{artanh}(k) + ks \int_{0}^{1} \frac{1}{k^2 + s^2} \left( \frac{1}{1-k^2 x^2} - \frac{1}{1+s^2 x^2} \right) \, \mathrm{d}x \\ &= \left( \frac{s}{k^2+s^2} - \frac{s}{1+s^2} \right) \operatorname{artanh}(k) - \frac{k \arctan s}{k^2 + s^2}. \end{align*}\]

The desired identity then follows by integrating both sides with respect to $s$. $\square$

By substituting the result of Lemma 6 into the integral representation from Theorem 4 and invoking the relation $\text{(1.3)}$, we arrive at a new expression for $\tilde{A}(p, q, r)$:

Theorem 2.7. For $p, q, r > 0$, the augmented integral admits the following representations:

\[\begin{align} \tilde{A}(p, q, r) &= 2\chi_2(\kappa) - 2 \operatorname{artanh}(\kappa)\log \kappa - F(\kappa, \tilde{p}) - F(\kappa, \tilde{q}) - F(\kappa, \tilde{r}) \nonumber \\ &= \frac{\pi^2}{4} - 2 \chi_2\left( \frac{1-\kappa}{1+\kappa} \right) - F(\kappa, \tilde{p}) - F(\kappa, \tilde{q}) - F(\kappa, \tilde{r}). \end{align} \tag{2.11}\]

The second equality follows from the well-known identity for the Legendre chi function:

\[\chi_2\left(\frac{1-z}{1+z}\right) + \chi_2(z) = \frac{\pi^2}{8} - \operatorname{artanh}(z)\log(z),\]

which holds for complex $z$ satisfying $\lvert \arg z \rvert < \pi$ and $\lvert \arg(1-z) \rvert < \pi$ and can be easily verified by differentiating both sides. The final expression $\text{(2.11)}$ is particularly convenient, as it does not suffer from the apparent singularity at $\kappa = 1$ and hence is valid for all $\kappa > 0$. As a corollary,

Corollary 2.8. For $p, q, r > 0$ satisfying $pqr = 1$, the augmented integral admits the following closed-form:

\[\begin{align} \tilde{A}(p, q, r) &= \frac{\pi^2}{4} - \frac{1}{2} \left[ \arctan^2(\tilde{p}) + \arctan^2(\tilde{q}) + \arctan^2(\tilde{r}) \right]. \tag{2.12} \end{align}\]

This immediately follows by noting that $F(1, s) = \frac{1}{2}\arctan^2(s)$.

2.4. Properties of $F(k, s)$

Theorem 2.7 highlights the importance of studying the properties of the function $F(k, s)$. The next result provides a representation of $F(k, s)$ in terms of special functions.

Theorem 2.9. For $k, s > 0$, let $\rho = \frac{1-k}{1+k}$ and $\alpha = 2\arctan(s)$. Then we have

\[F\left( k, s \right) = \arctan(s)\arctan(s/k) - \frac{\alpha^2}{8} - \frac{1}{2} \left[ \operatorname{Li}_2(\rho) - \frac{ \operatorname{Li}_2(\rho e^{i\alpha}) + \operatorname{Li}_2(\rho e^{-i\alpha}) }{2} \right]\]

Proof. Differentiating $F(k, s)$ with respect to $k$, we get

\[\begin{align*} \frac{\partial F}{\partial k} &= \int_{0}^{s} \frac{-k^2 + t^2}{(k^2 + t^2)^2} \arctan t \, \mathrm{d}t \\ &= \left[ -\frac{t}{k^2 + t^2} \arctan t \right]_{0}^{s} + \int_{0}^{s} \frac{t}{(k^2 + t^2)(1 + t^2)} \, \mathrm{d}t \\ &= -\frac{s}{k^2 + s^2} \arctan s + \frac{1}{2(1-k^2)} \log\left( \frac{1+s^2/k^2}{1+s^2} \right). \end{align*}\]

Integrating both sides with respect to $k$,

\[\begin{align*} F(k, s) &= F(1, s) + \int_{1}^{k} \frac{\partial F}{\partial k}(l, s) \, \mathrm{d}l \\ &= \frac{1}{2}\arctan^2(s) + \int_{1}^{k} \left[ -\frac{s}{l^2 + s^2} \arctan s + \frac{1}{2(1-l^2)} \log\left( \frac{1+s^2/l^2}{1+s^2} \right) \right] \, \mathrm{d}l. \end{align*}\]

The first term inside of the integral sign is easy to calculate, yielding

\[-\int_{1}^{k} \frac{s}{l^2 + s^2} \arctan s \, \mathrm{d}l = \arctan(s)\arctan(s/k) - \arctan^2(s).\]

For the second term, we apply the substitution $\ell = \frac{1-l}{1+l}$. Then

\[\begin{align*} \int_{1}^{k} \frac{1}{2(1-l^2)} \log\left( \frac{1+s^2/l^2}{1+s^2} \right) \, \mathrm{d}l &= \int_{0}^{\rho} \frac{1}{4l} \left[ 2\log(1-\ell) - \log\left( \ell^2 - 2\ell\cos\alpha + 1 \right) \right] \, \mathrm{d}\ell \\ &= - \frac{1}{2} \left[ \operatorname{Li}_2(\rho) - \frac{ \operatorname{Li}_2(\rho e^{i\alpha}) + \operatorname{Li}_2(\rho e^{-i\alpha}) }{2} \right]. \end{align*}\]

Combining these calculations yields the desired identity. $\square$