How to take the derivative of $x!$ This is the problem I am trying to solve:
$$\lim_{x \to \infty} \frac{e^x x!}{x^x\sqrt{x}}.$$ 
I believe this is an indefinite form, thus use L'Hospitals's rule. 
But the problem I am having is how to find the derivative of $x!$ 
 A: Let $f(x) =  \frac{e^x x!}{x^x\sqrt{x}}$.
Then $\frac{f(x+1)}{f(x)} 
=  \frac{e^{x+1} (x+1)!}{(x+1)^{x+1}\sqrt{x+1}}/ \frac{e^x x!}{x^x\sqrt{x}}
=  \frac{e^{x+1} (x+1)!}{(x+1)^{x+1}\sqrt{x+1}} \frac{x^x\sqrt{x}}{e^x x!}
= \frac{e (x+1) x^x \sqrt{x}}{(x+1)^{x+1} \sqrt{x+1}}
= \frac{e x^x }{(x+1)^x \sqrt{1+1/x}}
= \frac{e }{(1+1/x)^x \sqrt{1+1/x}}
= \frac{e }{(1+1/x)^{x+1/2}}
$.
This and what follows is just replicating what Stirling
and those who preceded him did
to get "Stirling's formula".
At this point, we need to show that
$(1+1/x)^{x+1/2}$ is very close to $e$ for large $x$.
Tak the logs, so we are looking at
$(x+1/2) \ln(1+1/x)
= (x+1/2)(1/x - 1/(2x^2) + 1/(3x^3) + ...
= (1 - 1/(2x) + 1/(3x^2) + ...) + (1/(2x) - 1/(4x^2) + ...)
=1 + 1/(12x^2) + ...$.
Note that the $1/2$ in $x+1/2$ allows the
$1/x$ term to cancel. That is why
$(1+1/x)^{x+c}$ is closest to $e$ for $c = 1/2$. 
For any other real $c$,
$\lim \frac{e}{(1+1/x)^{x+c}} = 1$,
But the product of these terms
does not cenverge
unless $c = 1/2$.
Exponentiating this,
$(1+1/x)^{x+1/2} = e e^{1/(12x^2) + ...}
= e(1+1/(12x^2) + ...)
$
so
$\frac{e}{(1+1/x)^{x+1/2}}
= \frac{1}{1+1/(12x^2) + ...}
= 1-1/(12x^2) + ...
$.
In all this, the "..." represents terms of higher order in $x$.
We now know that the ratio of consecutive terms
is (1) less than one (though we would have to prove that
the higher order terms are smaller than the $1/(12x^2)$ term),
and (2) is close enough to one
that the product 
of $1-1/(12x^2)$ converges.
If we look at 
$\prod_{x=n}^m (1-1/(12x^2))$
and take the log, 
we find, by an analysis similar to that above,
the sum of the logs converges as $m \to \infty$, 
so the product converges.
Since the product $\frac{f(x+1)}{f(x)}$ converges,
$f(x)$ must tend to a limit.
To show this, let
$P_n = \prod_{x=n}^{\infty} \frac{f(x+1)}{f(x)}$.
Then $P_n = 1/f(n)$ and
$\lim_{n \to \infty} P_n$ exists.
This is not completely rigorous,
but it can be made so, and it was.
It does show why the limit exists.
Actually, Stirling's contribution
was to explicitly evaluate the limit - 
it had previously been shown
that the limit exists.
This rambling essay was done off the
top of my head at 11:30 at night.
I hope it helps.
A: Use the Stirling asymptotic formula,
$$x!\approx x^x e^{-x}\sqrt{2\pi x}$$
for $x\gg 1$.
