# Numerical approximation of an integral

I read a problem to determine the integral $\int_1^{100}x^xdx$ with error at most 5% from the book "Which way did the bicycle go". I was a bit disappointed to read the solution which used computer or calculator. I was wondering whether there is a solution to the problem which does not use computers or calculators. In particular, is there way to prove that the solution given in the book has a mistake because it claims that $$\frac{99^{99}-1}{1+\ln 99}+\frac{100^{100}-99^{99}}{1+\ln 100}\leq \int_1^{100}x^xdx$$ gives a bound $1.78408\cdot 10^{199}\leq \int_1^{100}x^xdx$ but I think the LHS should be $1.78407\cdot 10^{199}\leq \int_1^{100}x^xdx$? I checked this by Sage and Wolfram Alpha but I was unable to do it by pen and paper.

• My integration routine gives $1.78464\times 10^{199}$ for the right hand side. – Fabian Feb 27 '11 at 9:39

$x^x$ grows really fast. Notice $$n^n>\frac{1}{n}\sum_{i=1}^{n-1} i^i.$$
In short $100^{100}$ is a lot bigger then $99^{99}$, so $$\frac{99^{99}-1}{1+\ln99}+\frac{100^{100}-99^{99}}{1+ln100}\sim \frac{100^{100}}{1+\ln100}=10^{99}\frac{10}{1+\ln100}$$

By calculator $$\frac{10}{1+\ln100}=1.78407,$$ (notice the same as above) but we can get bascially that by hand. First show $4<\ln100<5$. Then $$1.6=\frac{10}{6}\leq \frac{10}{1+\ln100}\leq \frac{10}{5}=2.$$

But lets do better. Use the fact that $$\sum_{i=1}^n\frac{1}{i}=\ln n +\gamma +E$$ where $|E|\leq \frac{1}{2n}$, and $n\geq 4$.

Then $$\ln(100)=1+\frac{1}{2}+\frac{1}{3}+\cdots +\frac{1}{100}-0.577+E$$ and diligently adding this together (under 5 minutes) gives $\ln(100)\sim 4.6$. From here we get the coefficient $\frac{25}{14}$ with an error bounded by $\frac{2}{100}$ or 2%. (We gained error because I cut off 4.61 to 4.6)

• $100^{100}$ is just over 270 (or just under $100e$) times $99^{99}$. Does that count as "a lot" here? – Henry Feb 27 '11 at 2:00
• @Henry: absolutely. The "exact" value of the LHS is $1.784078998771057... 10^{199}$. – Eelvex Feb 27 '11 at 2:03
• @Henry: I said what I meant by a lot. The sum only depends on the last piece to get an error under $\frac{1}{n}$. In other words, only the last interval in the integral matters when we want an error of 5%. So we can get rid of 99% of the length of the interval of integration and have an error of less than 1%. That is a lot in my mind. – Eric Naslund Feb 27 '11 at 2:04

Because your integrand grows so fast the whole integral is dominates for $x\approx 100$. We can write $x^x = \exp[ x \ln(x)]$ and then expanding $x \ln(x) = 100 \ln(100) + [1+ \ln(100)] (x- 100) + \cdots$ around $x = 100$ (note that it is important to expand inside the exponent). The integral can therefore be estimated as $$\int_1^{100} dx \, x^x \approx 100^{100} \int_{-\infty}^{100} dx\, e^{[1+ \ln(100)] (x- 100) } = \frac{100^{100}}{1 + \ln (100)}.$$ Numerics shows that this result is off by $3\times 10^{-4}$.