Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Based on the Wikipedia article on Stirling Approximation:

$n! = \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n e^{\lambda_n}$

where $\frac{1}{12n+1} < \lambda_n < \frac{1}{12n}$

How would this apply to a difference of logarithms.

For example, if I am estimating the error for $\ln(\lfloor\frac{n}{2}\rfloor!) - \ln(\lfloor\frac{n}{3}\rfloor!)$, would the error estimate then be:

$\ln(\sqrt{2 \pi \frac{n}{2}} \left(\frac{n}{2e}\right)^{\frac{n}{2}}) - \ln(\sqrt{2 \pi \frac{n}{3}} \left(\frac{n}{3e}\right)^{\frac{n}{3}}) + \ln(e^{\lambda_n})$

where $\frac{1}{12n+1} < \lambda_n < \frac{5}{12*(\frac{n}{6})}$

where the $5$ comes from $(\frac{n}{2} + \frac{n}{3})/\frac{n}{6}$


share|cite|improve this question
There are easier forms of Stirling's approximation for $\log n!$ (sometimes known as the "weak Stirling approximation"). If you can get your hands on effective versions of these bounds, you may have an easier time – A Walker Apr 10 '13 at 22:29
Thanks for the info. I read up more on Stirling's approximation and now I feel more comfortable with the above. The only issue I hit was dealing with floor functions. Stirling's approximation worked as expected only when I used $\lfloor\frac{x}{2}\rfloor$. I'll check up on the Weak Stirling approximation to see that helps as you suggest. – Larry Freeman Apr 11 '13 at 13:34
up vote 2 down vote accepted

Stirling's approximation reads $n!=u_n\mathrm e^{\lambda_n}$ with $u_n=\sqrt{2\pi n}(n/\mathrm e)^n$ and $12n\lt1/\lambda_n\lt12n+1$ hence, for every $k$ and $\ell$, $$ \log(k!)-\log(\ell!)=\log(u_k)-\log(u_\ell)+\lambda(k,\ell), $$ where $\lambda(k,\ell)=\lambda_k-\lambda_\ell$ is such that $$ \frac1{12k+1}-\frac1{12\ell}\lt\lambda(k,\ell)\lt\frac1{12k}-\frac1{12\ell+1}. $$ In particular, $$ |\lambda(k,\ell)|\lt\frac1{12\min\{k,\ell\}}. $$

share|cite|improve this answer
Thanks very much! That's exactly the answer I was looking for. – Larry Freeman Apr 13 '13 at 15:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.