# Derivative of $n!$ (factorial)? [duplicate]

I have a theory that uses the gamma function:

$$\Gamma(n)=\int_0^\infty x^{n-1}e^{-x} \space dx$$

Then I was inclined to think that perhaps the derivative is:

$$x^{n-1}e^{-x}$$

But I'm not sure we can just drop the integral along with the bounds to get the derivative. Then I thought about taking the limit:

$$\lim_{x\to\infty}x^{n-1}e^{-x}$$

But now we can't specify at what $x$ value we want to get the rate of change of. At this point I feel like I can't get any further on my own and would appreciate some insight.

EDIT: Looking for derivative in terms of $n$ actually.

• You should take the derivative with respect to $n$ and not $x$, however you won't be able to solve it. – kingW3 Jan 20 '18 at 0:50
• are you sure you don't mean the derivative in $n$? – lulu Jan 20 '18 at 0:50
• In statistical physics, Stirling's approximation is often used $x! \approx \sqrt{2\pi x} \left( \frac{x}{e}\right)^x$ to approximate the factorial as being continuous. – user275377 Jan 20 '18 at 0:53
• My recommendation: wait until you have taken calculus before attempting to compute derivatives. – GEdgar Jan 20 '18 at 1:04
• If you have $\displaystyle f(n) = \int_\cdots^n g(x)\,dx,$ then you can "drop the integral" as follows $f'(n) = g(n).$ But you don't have anything like that here. If you were to "drop the integral," you would get something depending not only on $n$ but also on something called $x.$ What would this thing called $x$ be? By contrast, $\displaystyle \int_0^\infty x^{n-1} e^{-x}\,dx$ does not depend on anything called $x. \qquad$ – Michael Hardy Jan 20 '18 at 2:31

## 1 Answer

Here is how to calculate it: you have to move the derivative into the integral: \begin{align} \frac{d}{dn}\Gamma(n) &=\frac{d}{dn}\int_0^\infty x^{n-1}e^{-x}\,dx\\ &=\int_0^\infty \frac{d}{dn}x^{n-1}e^{-x}\,dx\\ &=\int_0^\infty e^{-x}\frac{d}{dn}e^{(n-1)\ln(x)}\,dx\\ &=\int_0^\infty e^{-x}\cdot e^{(n-1)\ln(x)}\ln(x)\,dx\\ &=\int_0^\infty x^{n-1}e^{-x}\ln(x)\,dx\\ \end{align} and so we have $$\Gamma'(n)=\int_0^\infty x^{n-1}e^{-x}\ln(x)\,dx$$

• Thank you very much! This was a very clear and concise explanation. Huge thumbs up. – Badr B Jan 20 '18 at 1:04
• Shouldn't the derivative become a partial when it enters the integral? – Biggs Jan 20 '18 at 6:17