Question

Solution

Notice that \(10000!\) can be rewritten as

$$ 1\times 2\times 3\times 4\times\dots\times 10000=e^{\ln 1+\ln 2+\ln 3+\ln 4+\dots+\ln 10000}\\ $$

However it is difficult to evaluate the exact sum of the logarithms, but we can use an integral to approximate the sum, this is because the integral is close to the sum of individual strips (if each strip has width 1).

$$\ln 1+\ln 2+\ln 3+\ln 4+\dots+\ln 10000\approx\int^{10000}_{1}\ln xdx$$

With this, our approximation for \(10000!\) is \(3.1\times 10^{35657}\), whereas the true value is \(2.8\times 10^{35679}\).

Not bad, but it can be better

Consider when using the same method for approximating \(2!\)

$$ \begin{align*} 2!&\approx e^{\int^2_1\ln xdx}\\ &\approx(1.0\times1.1\times\dots\times 2.0)^\frac{1}{10} \end{align*} $$

\(2!\) is two numbers multipied together, but in our approximation, we are multiplying from \(1.0\) to \(2.0\), there is only 1 number worth of multiplication between the bounds. We can get a better approximation with a continuity correction, by extending both bounds by \(0.5\).

$$ \begin{align*} 2!&\approx e^{\int^{2.5}_{0.5}\ln xdx}\\ 10000!&\approx e^{\int^{10000.5}_{0.5}\ln xdx} \end{align*} $$

Given \(\int\ln xdx=x\ln x-x\)

$$ \begin{align*} \int^{10000.5}_{0.5}{\ln xdx}&=(10000.5\ln 10000.5-10000.5)-(0.5\ln 0.5-0.5)\\ &=10000.5\ln 10000.5-0.5\ln 0.5-10000 \end{align*} $$

So \(10000!\) approximates to

$$e^{10000.5\ln 10000.5-0.5\ln 0.5-10000}$$

We can verify our approximation differ from the true value only by 7%, a better approximation can be obtained using more complex approximations.