How to find all the intersection points of the two functions $\log(x!)$ and $x$?

521 Views Asked by At

I am trying to find where $\log(x!)$ and $x$ intersect, and am unable to do so rigorously.

I eventually have $2^x = x!$, but I am unsure how to proceed from here.

Any input as to how to go about solving this would be great.

1

There are 1 best solutions below

1
On

If you look for a continuous function $$f(x)=\log(x!)-x$$ and search for the $x$ such that $f(x)=0$, I do not think that there is any analytical solution (beside the trivial solution $x=0$).

If you plot the function, you should notice that there is a root close to $x=5$ and numerical method should be used, such as Newton. Starting from a "reasonable" guess $x_0$, it will be updated according to $$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$ The problem is that the derivative is quite complex since $$f'(x)=\psi ^{(0)}(x+1)-1$$ where appears the digamma function.

Nevertheless, if you start at $x_0=5$, Newton iterates will be $5.30095$, $5.29033$, $5.29032$ which is the solution for six significant figures.

If you look for a "good" approximate solution, you could replace $x!$ by Stirling, Gosper or Burnisde approximation of the factorial. This means, that, using Gosper for example, you should solve $$g(x)=\log\Big[{\sqrt{\pi(2x+\frac{1}{3})}\Big(\frac{x}{e}\Big)^x}\Big]-x=0$$ that is to say $$g(x)=\log(\sqrt{\pi})+\frac{1}{2}\log(2x+\frac{1}{3})+x \log(x)-2x=0$$ $$g'(x)=\frac{1}{2 x+\frac{1}{3}}+\log (x)-1$$ This transform makes the problem much simpler. Starting at $x_0=5$, Newton iterates will then be $5.30127$, $5.29063$, $5.29061$ which is not too bad.