Evaluating $\int_0^{\pi/2} \log(1 - x \cot x) \, dx\;$ (Is there a closed form?)

I am interested in knowing if it is possible to find a closed-form solution to the following challenging log-cotangent integral

$$\int_0^{\frac{\pi}{2}} \log(1 - x \cot x) \, dx$$

I very much doubt a closed form in terms of known mathematical constants can be found and have no reason to suspect one exists.

In the absence of a simple closed-form value being found, maybe the integral can be evaluated in terms of an infinite series. In this direction, since $0 < x \cot x < 1$ for all $x \in (0,\frac{\pi}{2})$ the log term appearing in the integrand can be expanded. Doing so produces $$\int_0^{\frac{\pi}{2}} \log(1 - x \cot x) \, dx = -\sum_{n = 1}^\infty \frac{1}{n} \int_0^{\frac{\pi}{2}} (x \cot x)^n \, dx = -\sum_{n = 1}^\infty \frac{a_n}{n},$$ where $$a_n = \int_0^{\frac{\pi}{2}} (x \cot x)^n \, dx. \tag1$$ Noting that \begin{align*} a_1 &= \int_0^{\frac{\pi}{2}} x \cot x \, dx = \frac{\pi}{2} \log (2)\\ a_2 &= \int_0^{\frac{\pi}{2}} (x \cot x)^2 \, dx = \pi \log (2) - \frac{\pi^3}{24}\\ a_3 &= \int_0^{\frac{\pi}{2}} (x \cot x)^3 \, dx = \frac{9\pi}{16} \zeta (3) - \frac{\pi^3}{16} + \frac{3\pi}{2} \log (2) - \frac{\pi^3}{8} \log (2), \end{align*} perhaps it is possible to find a general expression for $a_n$. Indeed, an attempt at finding (1) can be found here.

Any other approaches or suggestions to this challenging integral would be welcome.


Solution 1:

Edited to make the answer self-contained

We introduce first a representation of the integral which makes use of Bessel functions: \begin{align} I&=\int_0^{\frac{\pi}{2}} \log(1 - x \cot x) \, dx\\ &=\int_0^{\frac{\pi}{2}} \log\left( \frac{\sin x-x\cos x}{\sin x} \right) \, dx\\ &=\int_0^{\frac{\pi}{2}} \log\left( \sqrt{\frac{\pi}{2}}\frac{x^{3/2}J_{3/2}(x)}{\sin x} \right) \, dx\\ &=-\frac{3\pi}{4}+\pi\ln \pi-\frac{\pi}{4}\ln 2-\frac{\pi}{2}\ln 2 -\int_0^{\frac{\pi}{2}}\log\left( J_{3/2}(x) \right)\,dx \end{align}

In a paper by Dickinson a series expansion is given for the derivative of the logarithm of a Bessel function: \begin{equation} \frac{d}{dx}\log J_\nu(x)=\frac{\nu}{x}-\sum_{n=1}^\infty\sum_{k=0}^\infty \frac{2x^{2k+1}}{j_{\nu,n}^{2k+2}} \end{equation} $j_{\nu,n}$ is the $n$-th zero of the Bessel function of order $\nu$. This result holds provided $0<x<j_{\nu,1}$ (which is the case here). By integrating this result, \begin{equation} \log J_\nu(x)=\nu\log(x)-\sum_{n=1}^\infty\sum_{k=0}^\infty \frac{1}{k+1}\frac{x^{2k+2}}{j_{\nu,n}^{2k+2}}+C \end{equation} The constant is determined by adjusting the result for $x\to0$. As $\log J_\nu(x)= \nu\log x-\nu\log 2-\log\Gamma(\nu+1)+O(x^2)$ \begin{equation} C=-\nu\log 2-\log\Gamma(\nu+1) \end{equation} Then, \begin{equation} \log\left(J_{3/2}(x) \right)=\frac{3}{2}\log x-\frac{3}{2}\log 2-\log\left(\frac{3\sqrt{\pi}}{4}\right)-\sum_{k=0}^\infty \frac{x^{2k+2}}{k+1}\sum_{n=1}^\infty\frac{1}{j_{3/2,n}^{2k+2}} \end{equation} The integral reads thus \begin{equation} I=\frac{\pi}{2}\left( 3\ln\pi-3-\ln(12) \right)-\sum_{k=0}^\infty\frac{(\pi/2)^{2k+3}}{(k+1)(2k+3)}\sum_{n=1}^\infty \frac{1}{j_{3/2,n}^{2k+2}} \end{equation} The sum of inverse even powers of zeros of Bessel functions appears in problems involving the diffusion equation and a broad literature exists on the topic. The quantity \begin{equation} \sigma(p,\nu)=\sum_{n=1}^\infty\frac{1}{j_{\nu,n}^{2p}} \end{equation} is discussed here. A recent analysis can be found in a paper by Jorge L. deLyra. The first values for $\nu=3/2$ are \begin{align} &\sigma(1,3/2)=\frac{1}{10}\;;\;\sigma(2,3/2)=\frac{1}{350}\;;\;\sigma(3,3/2)=\frac{1}{7875}\\ &\sigma(4,3/2)=\frac{37}{6063750}\;;\;\sigma(5,3/2)=\frac{59}{197071875} \end{align} we find \begin{align} I&=\frac{\pi}{2}\left( 3\ln\pi-3-\ln(12) \right)-\sum_{k=0}^\infty\frac{\sigma(k+1,3/2)}{(k+1)(2k+3)}\left(\frac{\pi}{2}\right)^{2k+3}\\ &=\frac{\pi}{2}\left(3\ln\frac{\pi}{e}-\ln(12) \right)-\\ &\hspace{1cm}-\frac{\pi^3}{8}\left(\frac{1}{30}+\frac{(\pi/2)^2}{3500}+ \frac{(\pi/2)^4}{165375}+\frac{37(\pi/2)^6}{218295000}+\frac{59(\pi/2)^8}{10838953125}+\cdots \right) \end{align} which is identical to the series proposed by @ClaudeLeibovici.

As remarked by @JamesArathoon in a comment, it is also possible to perform first IBP on the integral. Then, the problem boils down to integrate $J_{1/2}(x)/J_{3/2}(x)$. By using the recurrence formula of the Bessel function, it requires to integrate $J_{5/2}(x)/J_{3/2}(x)$. A series expansion for the ratio of consecutive Bessel functions is also given in the above cited paper. It also makes use of the $\sigma(k,3/2)$, but the convergence is slower in this case.

Solution 2:

Just based on approximations.

First of all, a Taylor expansion $$\log (1-x \cot (x))=2\log(x)-\log(3)+\frac 13\sum_{n=1}^\infty \frac {a_n}{5^n\,b_n} x^{2n}$$ where the first $a_n$'s are $$\{1,13,22,907,55282,298183,738788,11537791247,\cdots\}$$ the first $b_n$'s are $$\{1,42,189,19404,2837835,35756721,202621419,7114443263928,\cdots\}$$ makes the series to converge very fast. Truncating and using $p$ terms give the following numerical results $$\left( \begin{array}{cc} p & I_p\\ 1 & -3.362471345 \\ 2 & -3.354577981 \\ 3 & -3.353531646 \\ 4 & -3.353370377 \\ 5 & -3.353343240 \\ 6 & -3.353338390 \\ 7 & -3.353337483 \\ 8 & -3.353337307 \\ 9 & -3.353337272 \\ 10 & -3.353337265 \end{array} \right)$$ Another,almost equivalent, possibility could be to use the $[2p,4]$ Padé approximant of the integrand and use partial fraction decomposition

$$\left( \begin{array}{cc} p & I_p \\ 1 & -3.353356609 \\ 2 & -3.353338184 \\ 3 & -3.353337337 \\ 4 & -3.353337269 \\ 5 & -3.353337263 \end{array} \right)$$

Just for the fun of it, the result is "close" to $$-\frac{1}{10} \zeta \left(\frac{1}{2}\right) \left(\frac{1}{2}-\Gamma \left(\frac{1}{24}\right)\right)$$ which is in a relative error of $5.75 \times 10^{-7}$%.

Edit

In a comment, @James Arathoon suggested to work instead $$\int_0^{\frac{\pi }{2}} \left(\log \left(\frac{x^3}{3}\right)-\log (\cos (x))\right) \, dx+\int_0^{\frac{\pi }{2}} \log \left(-\frac{3 (x \cos (x)-\sin (x))}{x^3}\right) \, dx$$

The first integral does not make any problem $$\int_0^{\frac{\pi }{2}} \left(\log \left(\frac{x^3}{3}\right)-\log (\cos (x))\right) \, dx=-\frac{\pi}{2} (3+\log (12)-3 \log (\pi ))$$

The second integrand can write $$\log \left(-\frac{3 (x \cos (x)-\sin (x))}{x^3}\right)=-\sum_{n=1}^\infty \frac {c_n}{5^n\,d_n} x^{2n}$$ where the first $c_n$'s are $$\{1,1,1,37,59,2753,1654,\cdots\}$$ and the first $d_n$'s are $$\{2,28,189,38808,315315,71513442,202621419,\cdots\}$$ and the convergence is quite fast. $$\int_0^{\frac{\pi}{2}} \log(1 - x \cot (x)) \, dx= -\frac{\pi}{2} (3+\log (12)-3 \log (\pi ))-$$ $$\frac{\pi ^3}{240}\Bigg[1+\frac{3 \pi ^2}{1400}+\frac{\pi ^4}{88200}+\frac{37 \pi ^6}{465696000}+\frac{59 \pi ^8}{92492400000}+\cdots \Bigg]$$ Using the above terms leads to an absolute error equal to $7.39 \times 10^{-8}$.

Using the $[8,4]$ Padé approximant and partial fraction decomposition leads to an absolute error equal to $5.72 \times 10^{-11}$.

Update

Using the same approach as @River Li $$I = \int_0^{\frac \pi 2} \log(1 - x\cot (x))\,dx = - \frac{\pi^3}{24} + \frac{\pi}{2}\log( 2) - \int_0^{\pi/2} \frac{x^3}{\tan (x) - x} \,dx$$ we can easily build the $[2p,4]$ Padé approximant of the left integrand which write $$\frac{x^3}{\tan (x) - x} =\frac {3+\sum_{k=1}^p a_k\,x^{2k} } {1+b_1 x^2+b_2 x^4 }$$ the integration of which leading to a polynomial of degree $(2p-1)$ plus two hyperbolic arctangents.

As a function of $p$ the result of this integration is given below $$\left( \begin{array}{cc} 2 & \color{red}{3.150202}313227377435283622 \\ 3 & \color{red}{3.15020211}4234142271205176 \\ 4 & \color{red}{3.1502021130}45512153905225 \\ 5 & \color{red}{3.15020211302}9044077891702 \\ 6 & \color{red}{3.15020211302878}5049324311 \\ 7 & \color{red}{3.150202113028780}655331848 \\ 8 & \color{red}{3.15020211302878057}7184507 \\ 9 & \color{red}{3.1502021130287805757}51197 \\ 10 & \color{red}{3.15020211302878057572}4358 \\ 11 & \color{red}{3.1502021130287805757238}48 \\ 12 & \color{red}{3.150202113028780575723839} \end{array} \right)$$

Solution 3:

I prefer to add another set of comments.

Suppose that we use $$\int_0^{\frac{\pi}{2}} \log(1 - x \cot (x)) \, dx = -\sum_{n = 1}^\infty \frac{1}{n} \int_0^{\frac{\pi}{2}} (x \cot (x))^n \, dx = -\sum_{n = 1}^\infty \frac{a_n}{n}$$ where $$a_n = \int_0^{\frac{\pi}{2}} (x \cot (x))^n \, dx$$ It seems possible to compute the $a_n$'s for any value of $n$. I have not been able to find, even emprically, any relation between them.

Now, let us consider $$b_k=\sum_{n = 1}^k \frac{a_n}{n}$$ The problem is that the convergence is extremely slow $$\left( \begin{array}{ccc} k & b_k & {b_k}/{b_{k-1}} \\ 1 & 1.088793044 & \\ 2 & 1.531621992 & 1.406715445 \\ 3 & 1.787024517 & 1.166752976 \\ 4 & 1.958303531 & 1.095845923 \\ 5 & 2.083382818 & 1.063871246 \\ 6 & 2.179888546 & 1.046321649 \\ 7 & 2.257271880 & 1.035498757 \\ 8 & 2.321115965 & 1.028283738 \\ 9 & 2.374959149 & 1.023197111 \\ 10 & 2.421167052 & 1.019456294 \\ 20 & 2.680973995 & 1.006279984 \\ 30 & 2.800600958 & 1.003289782 \\ 40 & 2.873001074 & 1.002089208 \\ 50 & 2.922816842 & 1.001472276 \\ 60 & 2.959780104 & 1.001107498 \\ 70 & 2.988610619 & 1.000871248 \\ 80 & 3.011910979 & 1.000708125 \\ 90 & 3.031249532 & 1.000590014 \\ 100 & 3.047635130 & 1.000501298 \end{array} \right)$$

Solution 4:

Approximating the integral using rational approximants

Using integration by parts, we easily get $$I = \int_0^{\pi/2} \ln(1 - x\cot x) \mathrm{d} x = - \frac{\pi^3}{24} + \frac{\pi}{2}\ln 2 - \int_0^{\pi/2} \frac{x^3}{\tan x - x} \mathrm{d} x.$$ $I \approx -3.353337262889472...$

We focus on $$I_1 = \int_0^{\pi/2} \frac{x^3}{\tan x - x} \mathrm{d} x.$$ We may approximate $I_1$ by rational approximants to $\tan x$ at $0$.

  1. Pade $(5, 4)$ approximant $\tan x \approx \frac{x(x^4 - 105x^2 + 945)}{15x^4 - 420x^2 + 945} \triangleq g(x)$

We can bound the error by $$0 \le \frac{x^3}{g(x) - x} - \frac{x^3}{\tan x - x} \le g(\pi/2) \approx 0.000045.$$ We have $$I_1 \approx \int_0^{\pi/2} \frac{x^3}{g(x) - x} \mathrm{d} x = - \frac{5}{112}\pi^3 + \frac{165}{56}\pi - \frac{243}{56}\sqrt{10} \operatorname{arctanh} \frac{\pi\sqrt{10}}{30}.$$ Then we have $I \approx -3.353344689$ with relative error $< 0.000003$.

Solution 5:

This is a long comment on an intriguing approximation to the integral most easily accessible by CAS calculation.

Taking the integral partition

$$I=-\int_0^{\frac{\pi }{2}} \log (\cos (x)) \, dx-\int_0^{\frac{\pi }{2}} \frac{x^2 \sin (x)}{\sin (x)-x \cos (x)} \, dx$$

we work with the second integral.

First note that $\frac{d }{dx}(\sin (x)-x \cos (x))=x \sin (x)$. Using the substitution $y=(\sin (x)-x \cos (x))$ we are left to compute the inverse trigonometric function $x= arc[\sin x-x\cos x](y)$, since $dy=x \sin x \,dx$ and $y=(\sin (x)-x \cos (x))$ is a one-to-one function between $0$ and $\pi/2$.

(I write $x= arc[\sin x-x\cos x](y)$ for want of better terminology).

Therefore

$$I=-\int_0^1 \frac{arc[\sin x-x\cos x](y)}{y} \,dy$$

Using CAS to determine $arc[\sin x-x\cos x](y)$ in series form, we have

$$arc[\sin x-x\cos x](y)=\sqrt[3]{3} \sqrt[3]{y}+\frac{y}{10}+\frac{41 y^{5/3}}{1400 \sqrt[3]{3}}+\frac{97 y^{7/3}}{8400\ 3^{2/3}}+\frac{15063 y^3}{8624000}+\frac{6199421 y^{11/3}}{7207200000 \sqrt[3]{3}}+\frac{1894073471 y^{13/3}}{4237833600000\ 3^{2/3}}+\frac{1532283399 y^5}{19059040000000}+\frac{11288018107137217 y^{17/3}}{252957982717440000000 \sqrt[3]{3}}+\frac{1496852049518257 y^{19/3}}{59133034920960000000\ 3^{2/3}}+\frac{31831777776715674057 y^7}{6536309355896320000000000}+...$$

with the general term of the term by term integral being

$$-a_n\int_0^1 \frac{y^{(2n-1)/3}}{y} \,dy=-\frac{3\, a_n}{2n-1}$$

and with the general form of the resulting approximate sum being

$$I\approx a+3^{-1/3}b+3^{-2/3}c$$

where $a,b,c$ are rational, with $a\approx-0.10059903$, $b\approx-3.0016854$ and $c\approx-0.0059380965$

Obviously in the summation limit as $n \to \infty$ $a,b$ and $c$ may no longer be rational.