Compute $(\ln(n!))^2$

83 Views Asked by At

In a discrete mathematics past paper, I must solve the following problem:

We know (from the Stirling approximation) that $$\ln(n!)=n\ln(n)-n+\frac{1}{2}\ln(n)+\frac{\ln(2\pi)}{2}+\frac{1}{12n}-\frac{1}{360n^3}+\frac{1}{1260n^5}+O\left(\frac{1}{n^7}\right).$$ Use this information to compute $(ln(n!))^2$ with error $O(ln(n)).$

So, far my working is as follows. $$\begin{align} \ln(n!) & =n\ln(n)-n+\frac{1}{2}\ln(n)+\frac{\ln(2\pi)}{2}+\frac{1}{12n}-\frac{1}{360n^3}+\frac{1}{1260n^5}+O\left(\frac{1}{n^7}\right) \\ & = n\ln(n)-n+O(\ln(n)) \implies \\ (\ln(n!))^2 & = (n\ln(n))^2-n^2\ln(n)+n\ln(n)\cdot O(\ln(n))-n^2\ln(n)+n^2-n\cdot O(\ln(n))+O(\ln(n))\cdot n\ln(n)-O(\ln(n))\cdot n+O(\ln(n))\cdot O(\ln(n)) \\ & = (n\ln(n))^2+n^2+(O(\ln(n)))^2+2[n\ln(n)\cdot O(\ln(n))-n\cdot O(\ln(n))+n^2\ln(n)]\space\space (*) \end{align}$$

I think that, in order to solve the problem, I need to determine which terms $t$ of (*) satisfy $t\in O(\ln(n))$.
However, it seems as though none of them do. Perhaps I have not correctly manipulated the big-O notation.

Could I please have some guidance, in order to make progress with this problem?

1

There are 1 best solutions below

3
On BEST ANSWER

Hint: Start with

$$\ln(n!)=n\ln(n)-n+\frac{1}{2}\ln(n)+\frac{\ln(2\pi)}{2}+O\left(\frac{1}{n}\right)$$

To see where you want the O-term, you should not that in this case, $O\left(\frac{1}{n}\right) \cdot n \ln(n)$ gives $O(\ln n)$.