Derivative of a factorial

What is ${\partial\over \partial x_i}(x_i !)$ where $x_i$ is a discrete variable?

Do you consider $(x_i!)=(x_i)(x_i-1)...1$ and do product rule on each term, or something else? Thanks.


Solution 1:

The derivative of a function of a discrete variable doesn't really make sense in the typical calculus setting. However, there is a continuous variant of the factorial function called the Gamma function, for which you can take derivatives and evaluate the derivative at integer values.

In particular, since $n!=\Gamma(n+1)$, there is a nice formula for $\Gamma^\prime$ at integer values: $$ \Gamma^\prime(n+1)=n!\left(-\gamma+\sum_{k=1}^n\frac{1}{k}\right) $$ where $\gamma$ is the Euler-Mascheroni constant.

Solution 2:

As has been mentioned, the Gamma function $\Gamma(x)$ is the way to go.

Integration by parts yields $$ \begin{align} \Gamma(x) &=\int_0^\infty e^{-t}t^{x-1}\,\mathrm{d}t\\ &=(x-1)\int_0^\infty e^{-t}t^{x-2}\,\mathrm{d}t\\ &=(x-1)\Gamma(x-1) \end{align} $$ Taking the derivative of the logarithm of $\Gamma(x)$ gives $$ \frac{\Gamma'(x)}{\Gamma(x)}=\frac1{x-1}+\frac{\Gamma'(x-1)}{\Gamma(x-1)} $$ Because $\Gamma(x)$ is log-connvex and $$ \lim_{x\to\infty}\frac{\Gamma'(x)}{\Gamma(x)}-\log(x)=0 $$ we get that $$ \frac{\Gamma'(x)}{\Gamma(x)}=-\gamma+\sum_{k=1}^\infty\left(\frac1k-\frac1{k+x-1}\right) $$ For integer $n$, $n!=\Gamma(n+1)$, so the derivative is $$ \begin{align} \Gamma'(n+1) &=\Gamma(n+1)\left(-\gamma+\sum_{k=1}^\infty\frac{n}{k(k+n)}\right)\\ &=n!(-\gamma+H_n) \end{align} $$ where $H_n$ is the $n^\text{th}$ Harmonic Number (with the convention that $H_0=0$).

Solution 3:

$x!$ is usually defined only for nonnegative integer $x$. However, there is an extension to non-integers, given by the Gamma function: $x! = \Gamma(x+1)$, and the derivative of this is $\Psi(x+1) \Gamma(x+1)$ where $\Psi$ is the Digamma function. The values of this derivative at $x=0,1,\ldots,10$ are $-\gamma,1-\gamma,3-2\,\gamma,11-6\,\gamma,50-24\,\gamma,274-120\, \gamma,1764-720\,\gamma,13068-5040\,\gamma,109584-40320\,\gamma, 1026576-362880\,\gamma,10628640-3628800\,\gamma$ where $\gamma$ is Euler's constant.