Showing that $\int_0^\infty x^{-x} \mathrm{d}x \leq 2$.

This integral is very closely related to the sophmores dream that states

$$\int_0^1 x^{-x}\mathrm{d}x = \sum_{n=1}^\infty n^{-n} = 1.27\ldots$$

For example here http://en.wikipedia.org/wiki/Sophomore%27s_dream

Now I want to bound the integral, and showing that is less that 2. For the interval $[0,1]$ a good bound is rewriting it to $\exp(x\log x)$ and using the expansion

$$1 - x \log(x) + \frac12 (-x \log(x))^2$$

but how does one handle $[1,\infty)$ ? In this answer here

How to evaluate $\int_0^\infty {1 \over x^x}dx$ in terms of summation of series?

gives bounds to the integral, but they are not tight enough.. So to taste my question again, how does one prove that

$$\int_0^\infty \frac{\mathrm{d}x}{x^x} \leq 2$$

-
Are you sure that it is less than or equal to 2 – Amr Nov 15 '12 at 20:37
According to Mathematica, the value of the integral is $1.99546\dots$ – Julián Aguirre Nov 15 '12 at 20:43
Hmm.This means that proving that 2 is an upper bound will probably be not easy – Amr Nov 15 '12 at 20:49
Thank you captain obvious, there is a reason why I asked for help... – N3buchadnezzar Nov 15 '12 at 20:54
A computation of this integral was carried out by G N Watson, Theorems stated by Ramanujan. VIII: Theorems on divergent series, J London Math Soc 4 (1929) 82-86. It has been carried out to over 100 decimals at oeis.org/A229191. – Gerry Myerson Feb 22 at 11:51

Since numerically the value is approximately $1.9954559575$, you need very tight bounds.
On $[0,1]$, we can use the "sophomore's dream" series:
$$\int_0^1 x^{-x}\ dx = \sum_{n=1}^\infty n^{-n} \le \sum_{n=1}^5 n^{-n} + \sum_{n=6}^\infty 6^{-n} = 1+ \frac{1}{4} + \frac{1}{27}+ \frac{1}{256}+ \frac{1}{3125}+\frac{1}{38880} < 1.29129$$
On $[1,\infty)$, the change of variables $u = 1/x$ gives us $$\int_1^\infty x^{-x}\ dx = \int_0^1 u^{1/u - 2}\ du$$ Note that since $\dfrac{d}{du} u^{1/u - 2} = u^{1/u - 4} (1 - 2 u - \ln(u))$, $u^{1/u - 2}$ is increasing on $[0,1/2]$. For $0 < u < 1/5$ we have $u^{1/u - 2} < (1/5)^{5-2} = 1/125$, so $$\int_0^{1/5} u^{1/u-2}\ du < \frac{1}{625} = .0016$$ On $[1/5, 1]$, we can write $$u^{1/u - 2} = \exp(\ln(u)(1/u - 2)) = \sum_{n=0}^\infty \frac{\ln(u)^n (1/u - 2)^n}{n!}$$ since $|\ln(u)(1/u - 2)| \le 3 \ln 5 \approx 4.828313736$ on this interval, the error in approximating $u^{1/u-2}$ by the first $N$ terms is at most $$\sum_{n=N+1}^\infty \frac{(3 \ln 5)^n}{n!} \le \frac{(3 \ln5)^{N+1}}{(N+1)!} \left(1 + \frac{3 \ln 5}{N+2} + \frac{(3 \ln 5)^2}{(N+2)^2} + \ldots\right) = \frac{(3 \ln5)^{N+1}}{(N+1)! (1 - 3 \ln(5)/(N+2))}$$ $N=17$ will do, with a bound of approximately $.0004259$. Thus $$\int_{1/5}^1 u^{1/u-2}\ du \le \frac{4}{5} (.0004259) + \sum_{n=0}^{17} \int_{1/5}^1 \frac{\ln(u)^n (1/u - 2)^n}{n!}\ du$$ Each term has a (rather complicated) closed form. The result is $\int_{1/5}^1 u^{1/u-2}\ du \le .70439$. Putting all these together, $$\int_0^\infty x^{-x}\ dx \le 1.29129 + .0016 + .70439 = 1.99728$$
Could you please give explicate the bound for $\displaystyle\sum_{n=0}^{17} \int_{1/5}^1 \frac{\ln(u)^n (1/u - 2)^n}{n!}\ du$? Is the bound on each summand coming from a numerical quadrature method? – Hans Jun 5 '15 at 18:06