TITLE: Inequality of numerical integration $\int _0^\infty x^{-x}\,dx$.
QUESTION [14 upvotes]: There was a friend asking me how to prove
$$\int_0^\infty x^{-x}\,dx<2$$
Mathematica showed that its approximate value is 1.99546, so I think it isn't easy to solve it, can you provide me some ideas about this question?

REPLY [8 votes]: You may write
$$
\begin{align}
\int_0^\infty x^{-x}\,dx& =\int_0^6 x^{-x}\,dx+\int_6^\infty x^{-x}\,dx\\\\
&<\int_0^6 x^{-x}\,dx+\int_6^\infty 6^{-x}\,dx\\\\
&=\int_0^6 x^{-x}\,dx+\frac{1}{466565\log6}\\\\
&=\int_0^6 x^{-x}\,dx+0.000011962...\\\\
&=1.99544...+0.000011962...\\\\
&<2.\\\\
\end{align}
$$
We are left to approximate $\displaystyle \int_0^6 x^{-x}\mathrm d x$ by a numerical integration rule. The point is that the second derivative of $f(x)=x^{-x}$ is not bounded on $(0,6]$, in fact not bounded near $0^+$. 
So let's write 
$$
\int_0^6 x^{-x} \mathrm d x =\int_0^1 x^{-x} \mathrm d x +\int_1^6 x^{-x} \mathrm d x. 
$$
Observe that 
$$
x^{-x}=e^{-x\ln x}=1-x\ln x+\frac{(x\ln x)^2}{2!}-\frac{(x\ln x)^3}{3!}+..., \quad 0<x\leq 1,
$$
and that
$$
\int_0^1 (x\ln x)^n\,dx = (-1)^n \int_0^\infty u^ne^{-nu}\,du  = (-1)^n \frac{n!}{(1+n)^{n+1}}, \, (u=-\ln x),
$$
leading to the series
$$
\int_0^1 x^{-x}\,dx =\sum_{k=1}^{\infty}\frac{1}{n^{n}}.
$$
Consequently
$$
\left|\int_0^1 x^{-x}\,dx -\sum_{k=1}^{7} \frac{1}{n^n} \right|=\left|\sum_{k=8}^{\infty} \frac{1}{n^n} \right| < \left| \frac{1}{8^8} \cdot\frac{1}{1-\frac{1}{8}}\right|<10^{-7}
$$
and we are done, since we may now use the trapezoidal rule to approximate  $\displaystyle \int_1^6 x^{-x}\,dx$ taking into account that $$|f''(x)|=\left|\frac{d^2}{dx^2}\left(x^{-x}\right)\right|=\left|\frac{1}{x}+(1+\ln x)^2 \right| x^{-x} <1, \quad 1<x\leq6.$$