# A closed form for: $\int_{0}^{\infty} \frac{1}{(x-\log x)^2}dx$

Is it possible to find a closed-form expression for this integral?

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^2}dx$$

Generalization of the Integral:

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^{p}}dx$$

where, $$\log x$$ is a natural logarithm, $$p\in\mathbb{Z^{+}}_{≥2}$$

The indefinite integral can not be expressed by elementary mathematical functions according to Wolfram Alpha.

I can add a visual plot.

So, I dont know, is it possible to find a closed-form or not. But, I have a numerical solution:

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^2}dx≈2.51792$$

• Very much doubt a closed form solution exists – user679268 Jun 29 at 10:26
• This could become Learner's constant ! Back to serious, I checked with inverse symbolic calculators : no result. Cheers :-) – Claude Leibovici Jun 29 at 12:42
• @Learner. These are really nice words and I thank you. For me, mathemetics mean fun and beauty and I like to share with other people. – Claude Leibovici Jun 29 at 13:15
• @JamesArathoon You ask as motivation. But I was just curious about the problem myself. I found this integral graphically very exotic. Thank you very much also for your answer. – Learner Jul 25 at 11:57
• @ClaudeLeibovici Maybe it's not possible to do more than you do. Thank you very much for your work. Cheers. :) – Learner Jul 26 at 8:15

Surprise !

Considering $$I=\int_{0}^{\infty} \frac{dx}{(x-\log x)^2}$$ and exploring simple linear combinations of a few basic constants, I found (be sure it took time !) $$\color{blue}{I\sim\frac{189}{4}(C+2\pi)+61 \pi \log (3)-\frac{1}{4} \left(57+101 \pi ^2+523 \pi \log (2)\right)}$$ which differs in absolute value by $$10^{-18}$$.

Update

Funny is $$J=\int_{1}^{\infty} \frac{dx}{(x-\log x)^2}\sim \frac{717 \pi ^2-489 \pi-296 }{405 \pi ^2-420 \pi+112}$$which differs in absolute value by $$3 \times 10^{-19}$$. $$K=\int_{0}^{1} \frac{dx}{(x-\log x)^2}\sim \frac{157 e^2+693 e-1394}{489 e^2-62e-859}$$which differs in absolute value by $$10^{-20}$$.

So, another formula $$\color{blue}{I=J+K \sim \frac{157 e^2+693 e-1394}{489 e^2-62e-859}+\frac{717 \pi ^2-489 \pi-296 }{405 \pi ^2-420 \pi+112}}$$ which differs in absolute value by $$3 \times 10^{-19}$$.

• Does it definitely differ? – marty cohen Jul 20 at 17:21
• @martycohen: Yes unfortunately - I find a result in agreement with Claude; numerically the difference is approximately $1.329\times10^{-18}$ – James Arathoon Jul 20 at 19:23
• @JamesArathoon. Just out of curiosity (since I am not a Mathemetica user while you obviusly are) : could you provide me the Mathemetica syntax for finding it ? I can use Mathemetica when going at university. For that, I have bee using a piece of junk we coded thirty years ago in my group. It took hours for me ! Thanks. – Claude Leibovici Jul 21 at 2:22
• Sorry errors when I cut and pasted expression, repeat version: I have no idea how you obtained the expression, but I took it and compared it with the integral in Mathematica thus N[(189/4) (Catalan+2*Pi)+61*Pi* Log[3]-(1/4) (57+101(Pi)^2+523*Pi Log[2]),25]-NIntegrate[1/(z-Log[z])^2,{z,0,Infinity},WorkingPrecision->25] – James Arathoon Jul 21 at 14:48
• @Learner. I thank you very much for that but I mainly thank you for the problem itself. When I see the number and the quality of so many answers to your question, it makes me (feeling) younger. There are really very good things here. MAy I confess that I am still working the problem ? Cheers :-) – Claude Leibovici Jul 25 at 8:02

Interesting is $$\int_1^{\infty} \frac{dx}{(x-\log x)^2}=\sum _{n=1}^{\infty }\frac {n!} {n^n}$$ which does converge very fast.

Consider the partial sums $$S_p=\sum _{n=1}^{p }\frac {n!} {n^n}$$ For $$50$$ significant figures, some numbers $$\left( \begin{array}{cc} p & S_p \\ 10 & \color{red} {1.879}6270159950810984897034709192993117315185196423 \\ 20 & \color{red} {1.8798538}481559257260270045400130469482147900930324 \\ 30 & \color{red} {1.87985386217}44894409103304424245491837451422243904 \\ 40 & \color{red} {1.879853862175258}4934447274819840727420511215490319 \\ 50 & \color{red} {1.87985386217525853348}42821765377141403748180799027 \\ 60 & \color{red} {1.879853862175258533486306}0446953416699479277057812 \\ 70 & \color{red} {1.879853862175258533486306145}0660477978008661226702 \\ 80 & \color{red} {1.8798538621752585334863061450709}598007686986116986 \\ 90 & \color{red} {1.8798538621752585334863061450709600388}084239015953 \\ 100 & \color{red} {1.87985386217525853348630614507096003881987}28530863 \\ \cdots & \cdots \\ \infty &\color{red} {1.8798538621752585334863061450709600388198734004893} \end{array} \right)$$

Edit

After comments, it seems that I found another one which is amazing $$\int_{1}^{\infty} \frac{dx}{(x-\log x)^3}=\frac 12\left(\sum _{n=1}^{\infty }\frac {n!} {n^{n-1}}-1\right)$$

Update

After @JJacquelin's answer, considering (for $$p> 1 \:,\: p \text{ integer.}$$) $$I_p=\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\frac{1}{(p-1)!}\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}$$ write $$\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}=\sum_{n=p-1}^k \frac{n!}{n^{n-p+2}}+\sum_{n=k+1}^\infty \frac{n!}{n^{n-p+2}}$$ and, for the second sum, use the simplest form of Stirling approximation to get $$\sum_{n=k+1}^\infty \frac{n!}{n^{n-p+2}} \sim \sqrt{2 \pi }\, e^{-(k+1)}\, \Phi \left(\frac{1}{e},\frac{3-2p}{2},k+1\right)$$ where appears the Hurwitz-Lerch transcendent function.

This provide quite good estimates of the result. Below are given the values for a few $$p$$'s using $$k=p+10$$. $$\left( \begin{array}{ccc} p & \text{approximation} & \text{"exact"} \\ 2 & 1.879853659 & 1.879853862 \\ 3 & 1.201509078 & 1.201509604 \\ 4 & 0.935374084 & 0.935375123 \\ 5 & 0.786369570 & 0.786371320 \\ 6 & 0.688798359 & 0.688800999 \\ 7 & 0.618921197 & 0.618924881 \\ 8 & 0.565877612 & 0.565882462 \\ 9 & 0.523929461 & 0.523935568 \\ 10 & 0.489732430 & 0.489739855 \end{array} \right)$$

• What a beautiful result when integrated over the interval $[1,\infty)$. – omegadot Jun 29 at 13:30
• @Learner. Be sure I tried but ... failed ! – Claude Leibovici Jun 29 at 13:57
• Teacher, can we generalize this integral $I_n(x)=\int_{0}^{\infty} \frac{1}{(x-\log x)^n}dx$, where $n≥2$ – Learner Jun 30 at 11:10
• @Learner. I am not a teacher. Have a look at my edit : I found Learner's constant of the second kind. Cheers. – Claude Leibovici Jun 30 at 11:31
• @Learner. I was just kiding, be sure ! But I am not (otherwise it would have been a pleasure to have you as a student). Thnaks for the problem. Cheers :-) – Claude Leibovici Jun 30 at 11:48

A more general relationship :

$$\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\sum_{k=0}^\infty \frac{(p+k-1)!}{(p-1)!\:(k+p-1)^{k+1}}\qquad p> 1 \:,\: p \text{ integer.}$$

This could be extended to real $$p>1$$ thanks to the function $$\Gamma$$.

Or, on an equivalent form : $$\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\frac{1}{(p-1)!}\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}\qquad p> 1 \:,\: p \text{ integer.}$$

From this it is easy to find the already known cases $$p=2$$ and $$p=3$$.

Then other cases, for example : $$\int_1^\infty \frac{dx}{(x-\ln(x))^4}=\frac{1}{6}\sum_{n=3}^\infty \frac{n!}{n^{n-2}}$$

I let you the pleasure to prove the above formulas.

This is not too difficult in expending $$\frac{1}{(1-t)^p}$$ to series of powers of $$t$$ with $$t=\frac{\ln(x)}{x}$$ and knowing that $$\int_1^\infty\frac{(\ln(x))^k}{x^{p+k}}dx=\frac{k!}{(k+p-1)^{k+1}}$$.

• +Very good. But our integral require integrate $[0,\infty]$. – Learner Jun 30 at 15:43
• Yes I know. Note that the aim of my answer was only to generalize the result from Claude Leibovici. His result was accepted even though it is for $[1,\infty]$ which is already very well. – JJacquelin Jun 30 at 15:53
• This is a nice answer ! Thanks for posting it & cheers :-) – Claude Leibovici Jun 30 at 15:59
• An interesting point about this answer is the zeroes of $f(p)=\int_1^\infty \frac{dx}{(x-\ln(x))^p}$. There's one positive zero around $0.537$ and it seems as though there's infinite negatively ones with fairly even gaps of about $2$: $-1.513, -3.501, -5.5, -7.5, -9.5, -11.5,\ldots$. – Jam Jul 3 at 17:51
• Sorry, but the OP wants to know $\int_0^\infty$ , not $\int_1^\infty$ . – user90369 Jul 17 at 10:39

Long comment:

Following the original comment by @automaticallyGenerated it is astounding that $$I=\int_0^{\infty } \frac{1}{(x-\log (x))^p} \, dx= \frac{ 1}{\Gamma(p)} {\int_0^{\infty } \frac{\Gamma(x+1)}{x^{x-p+2}} \, dx}$$ seems to hold true for all real $$p>1$$. Since two entirely different functions are being integrated, it seems likely that the equality only holds when these bounds are used.

The second integral appears little help in understanding the first integral (the OP's integal). It doesn't appear to be amenable to substitution and all I found a way of expressing the second integral in terms of the incomplete Gamma function and generalized Laguerre polynomials $$L_n^{(a)}(x)$$ which doesn't seem to lead anywhere. (see https://en.wikipedia.org/wiki/Gamma_function )

$$\frac{ 1}{\Gamma(p)} {\int_0^{\infty } \frac{\Gamma(x+1)}{x^{x-p+2}} \, dx}=\frac{1}{\Gamma (p)}\int_0^{\infty } \frac{e^{-x} \Gamma (x+1) }{ \Gamma (x-p+2,x)} \sum _{n=0}^{\infty } \frac{ L_n^{(x-p+2)}(x) }{n+1}\, dx$$

In regard to the first integral above (the OP's integral). As has been shown this integral appears to split naturally into two halves $$I_1$$ and $$I_2$$. This is clearly shown by graphing the function $$\frac{e^{1/y}}{\left(y \,e^{1/y} -1\right)^2}$$, derived from the original function simply by substitutions.

In the case of the new function $$I_1=\int_0^{\infty} \frac{e^{1/y}}{\left(y e^{1/y}-1\right)^2} \, dy\approx1.8798538622$$ $$I_2=\int_{-\infty}^0 \frac{e^{1/y}}{\left(y e^{1/y}-1\right)^2} \, dy\approx0.6380638008$$

as expected.

Most of the observations made so far have been directed to the first integral and its generalization to values of $$p$$ different to 2. I just note that $$p$$ can take any real value greater than $$1$$. Therefore the most general result for $$I_1$$ is

$$I_1=\int_1^{\infty } \frac{1}{(x-\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{\Gamma (n+p-1)}{(n+p-2)^n}$$

I shall make one further comment on the second integral.

It can be transformed as follows:

$$I_2=\int_0^{1 } \frac{1}{(x-\log (x))^p} \, dx=\int_{0}^{1 } \frac{1}{(1-x-\log (1-x))^p} \, dx$$

and rearranged $$I_2=\int_{0}^{1 } \frac{1}{(1-x)^2\left(1-\frac{\log (1-x)}{1-x}\right)^p} \, dx$$

The function $$\left(1-\frac{\log (1-x)}{1-x}\right)$$ has a reasonably simple infinite series expansion that is $$\left(1-\frac{\log (1-x)}{1-x}\right)=1+\sum_{k=0}^{\infty} \frac{\left| S_{k+1}^{(2)}\right| }{k!}x^k \approx 1+x+\frac{3 x^2}{2}+\frac{11 x^3}{6}+\frac{25 x^4}{12}+\frac{137 x^5}{60}+...$$

where $$S_{n}^{(m)}$$ are Sterling Numbers of the First Kind.

The infinite series expansion for the function $$\frac{1}{(1-x-\log (1-x))^p}$$ is not nearly quite so simple.

Update 1

I've become fascinated by the integral in question. In regard to roughly the function studied by @YuriyS I've spotted something else interesting, i.e.

$$I=\int_{-\infty}^\infty \frac{e^{-y} dy}{(e^{-y}+y)^2}$$

It is a slightly asymmetric function graphed here

Numerically the $$x$$ value at which the curve peaks is $$x\approx-0.4428544010$$ which appears to the same as the decimal expansion of $$x$$ satisfying $$x+2=exp(-x)$$ (see https://oeis.org/A202322). I found the two numbers are the same to greater than 60 decimal places.

Update 2

I've managed to find a method of approximating $$I_2$$ with a series involving positive integer Logs, but amazingly not all integers, so far just the primes...

$$I_2\approx1+\left(\frac{-179592269512107561470980928 \log (2)-5712818723588970397783260 \log (3)+22992687372688767118775650 \log (5)-28209036610545300456578590 \log (7)+13 (677084947758213086002625 \log (11)+1829504980586239604457134 \log (13)+4782965 (286391006085468616 \log (17)+87040663716649545 \log (19))+3622722200873719994750 \log (23))}{4375992416738342400000}\right)$$

Hope recedes even further that the $$I_2$$ part of the integral has a closed form. Run out of time now, so will provide a further update later if I can make any sense of this.

Update 3

I should clarify that the surprise here is not log's of integers can be split into log's of their component primes, it is that highest log prime is related to the originating number of terms in the approximation (in the above case 25) and all the log primes below the highest are also present in the approximation.

This above observed property is connected to integrals of the form

$$a_n\int_0^1 x^n\,\text{li}(1-x) \, dx\tag{1}$$

where $$\text{li}(x)$$ is the logarithmic integral and $$n$$ is roughly the number of terms in the approximation.

The "order n" integral terms (1) arise from series approximations to the following integral for $$I_2$$ $$I_2=1+\int_0^1 \frac{ \left(2 \left(\frac{1}{\log (1-x)}-\frac{1}{\log ^2(1-x)}\right)\right)} {\left( \frac{1-x}{\log (1-x)}-1\right)^3} \, \text{li}(1-x) \, dx$$

This link to this problem to the integral of logarithmic integral over the interval $$[0,1]$$ was found using Mathematica and is at this time remains conjectural.

Update 4

It is interesting to note the integral $$I_1$$

$$I_1=\int_1^{\infty } \frac{1}{(x-\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{\Gamma (n+p-1)}{(n+p-2)^n}$$

appears to be one of a pair

$$\int_1^{\infty } \frac{1}{(x+\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{(-1)^{n-1}\Gamma (n+p-1)}{(n+p-2)^n}$$

Not a full answer, but I hope to add more once I get to Mathematica in a few hours.

Using an obvious substitution $$x=e^y$$, we can transform the integral to:

$$I=\int_{-\infty}^\infty \frac{e^y dy}{(e^y-y)^2}=\int_0^\infty \frac{e^y dy}{(e^y-y)^2}+\int_0^\infty \frac{e^{-y} dy}{(e^{-y}+y)^2}$$

Some simple algebra gives us:

$$I=2 \int_0^\infty \frac{(1+y^2) \cosh y~ dy}{(1-y^2+2 y \sinh y)^2}=\int_{-\infty}^\infty \frac{(1+y^2) \cosh y~ dy}{(1-y^2+2 y \sinh y)^2}$$

Consider a complex function:

$$f(z)=\frac{(1+z^2) \cosh z~ dz}{(1-z^2+2 z \sinh z)^2}$$

The function decays for $$z$$ approaching complex infinity. The denominator seems to have only $$4$$ complex roots:

$$z_{1,2}= \pm 0.3181315052047644297916272315 + 1.337235701430689443574992888 i$$

$$z_{3,4}= \pm 0.3181315052047644297916272315 - 1.337235701430689443574992888 i$$

So logically, if we choose a half-circle contour in either the upper or the lower half-plane, the integral can be found as the sum of two second order residues.

For the upper half-plane:

$$I=2 \pi i (r_1+r_2)$$

Where:

$$r_{1,2} = \lim_{z \to z_{1,2}} \frac{d}{dz} \left((z-z_{1,2})^2 f(z) \right)$$

I'll need Mathematica to numerically compute the residues and then check if this works.

Update:

I computed the residues at the poles in Mathematica, both by definition, using Limit and numerically using NResidue, from the Numerical Calculus Package.

The results agree and we have:

$$r_{1,2}= \pm 0.0157117544425405384700677892 \ldots -0.2026036954553989163697798003\ldots i$$

Which gives us:

$$2 \pi i (r_1+r_2)=4 \pi \cdot 0.2026036954553989163697798003\ldots= \\ =2.54599312493130005807440209 \ldots$$

While the integral is numerically:

$$I=2.5179176630221370042\ldots$$

Which doesn't agree in the third digit already.

I don't know what went wrong here, but I'll try to find out. To be fair, I checked a few similar functions with the same denominator, and the residue computations all agree with the integral only in the first $$2-3$$ digits and then disagree. So either the method requires much more precision or I'm missing something.

Update 2

The real and imaginary parts of $$z_{1,2,3,4}$$ have the same absolute values as in the number:

$$x_0=e^{-W(-1)}$$

Which is a solution for $$x=\log x$$ which makes perfect sense when we consider the original integral.

I have used this exact value in Mathematica and found the residues exactly (the expressions are not pretty, but I found them).

However, I still get the same incorrect value $$2.54599312493130005807440209 \ldots$$ for the integral.

See That Guy's answer which explains my mistake and provides the explicit residue series.

• But, I am looking for a closed form. – Learner Jul 17 at 10:22
• @Learner, there's most likely no closed form. If this method works out, then the integral will be expressed as an elementary function of the roots of $1-z^2+2 z \sinh z$. From numerical point of view, root finding is much easier than numerical integration, and allows practically unlimited precision. – Yuriy S Jul 17 at 10:26
• Okay. Can we prove that there is no closed form? – Learner Jul 17 at 10:30
• @Learner, for definite integrals there's no general method to prove that no closed form exists (though definitions of "closed form" can vary, depending on which special functions and constants are considered acceptable in the final answer) – Yuriy S Jul 17 at 10:35

Premise

This is another non-answer, I find myself in agreement with what is written by Claude Leibovici.

Numerical experiment

Writing in Wolfram Mathematica:

int1 = NIntegrate[1/(x - Log[x])^2, {x, 0, ∞}, WorkingPrecision -> 100]

int2 = (WolframAlpha[ToString[int1], {{"PossibleClosedForm", 12},

Abs[(int1 - int2)/(int1 + int2)] // PercentForm


we get:

2.517917663022138153647538001932185256762577834761797364725564194327058822139169115575023164393392313

1859912398/738670857

0.00000000000000000195642085753452406702666054606377263411634622493540485935679948679462536380299024%

that is, by means of known numerical techniques it is possible to obtain both decimal and rational results with amazing approximations, ie with a percentage error close to zero!

To Yuriy S: the method is good, you just forgot to consider all branches of Lambert W, the solution to $$e^x -x =0$$ is $$x_n= - W_{n}(-1)$$ for $$n \in \mathbb{Z}$$ so the integral is $$2\pi i \sum_{n=0}^{\infty} \text{Res}\left( \frac{e^x}{\left( e^x -x\right )^2}, -W_n(-1)\right) = 2\pi i \sum_{n=0}^{\infty} -\frac{W_n(-1)}{\left( 1+ W_n(-1)\right )^3}$$

Mathematica code:

Abs[Sum[NResidue[E^x/(E^x - x)^2, {x, -ProductLog[n, -1]},WorkingPrecision -> 50], {n, 0, 10000}]*2*Pi]


Real part of the sum converges VERY slowly to 0.

Sorry can't comment

• Thank you, I forgot about branches. Should have known since we started with the logarithm – Yuriy S Jul 24 at 10:51
• The imaginary part of your series converges not that bad, for $50$ terms we have $4$ correct digits. Re[Sum[2 Pi I ProductLog[n, -1]/(1+ProductLog[n, -1])^3, {n, 0, 50}]] gives $2.51796$ – Yuriy S Jul 26 at 8:37
• It seems it has a logarithmic convergence rate – That Guy Jul 26 at 15:39