Alan Smith

2021-12-20

What is $\frac{\partial }{\partial {x}_{i}}\left({x}_{i}!\right)$ where ${x}_{i}$ is a discrete variable?
Do you consider $\left({x}_{i}!\right)=\left({x}_{i}\right)\left({x}_{i}-1\right)\cdots 1$ and do product rule on each term, or something else?

Mary Herrera

Expert

Step 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 $\mathrm{\Gamma }$ function, for which you can take derivatives and evaluate the derivative at integer values.
In particular, since $n\ne \mathrm{\Gamma }\left(n+1\right)$, there is a nice formula for ${\mathrm{\Gamma }}^{\prime }$ at integer values:
${\mathrm{\Gamma }}^{\prime }\left(n+1\right)=n!\left(-\gamma +\sum _{k=1}^{n}\frac{1}{k}\right)$
where $\gamma$ is the Euler-Mascheroni constant.
Step 2
As has been mentioned, the Gamma function $\mathrm{\Gamma }\left(x\right)$ is the way to go.
Integration by parts yields
$\mathrm{\Gamma }\left(x\right)={\int }_{0}^{\mathrm{\infty }}{e}^{-t}{t}^{x-1}dt$
$=\left(x-1\right){\int }_{0}^{\mathrm{\infty }}{e}^{-t}{t}^{x-2}dt$
$=\left(x-1\right)\mathrm{\Gamma }\left(x-1\right)$
Taking the derivative of the logarithm of $\mathrm{\Gamma }\left(x\right)$ gives
$\frac{{\mathrm{\Gamma }}^{\prime }\left(x\right)}{\mathrm{\Gamma }\left(x\right)}=\frac{1}{x-1}+\frac{{\mathrm{\Gamma }}^{\prime }\left(x-1\right)}{\mathrm{\Gamma }\left(x-1\right)}$
Because $\mathrm{\Gamma }\left(x\right)$ is log-connvex and
$\underset{x⇒\mathrm{\infty }}{lim}\frac{{\mathrm{\Gamma }}^{\prime }\left(x\right)}{\mathrm{\Gamma }\left(x\right)}-\mathrm{log}\left(x\right)=0$
we get that
$\frac{{\mathrm{\Gamma }}^{\prime }\left(x\right)}{\mathrm{\Gamma }\left(x\right)}=-\gamma +\sum _{k=1}^{\mathrm{\infty }}\left(\frac{1}{k}-\frac{1}{k+x-1}\right)$
For integer , so the derivative is
$\mathrm{\Gamma }\left(n+1\right)=\mathrm{\Gamma }\left(n+1\right)\left(-\gamma +\sum _{k=1}^{\mathrm{\infty }}\frac{n}{k\left(k+n\right)}\right)$
$=n!\left(-\gamma +{H}_{n}\right)$
where ${H}_{n}$ is the ${n}^{th}$ Harmonic Number (with the convention that ${H}_{0}=0$)

Debbie Moore

Expert

Step 1
Start from
$x\ne x\left(x-1\right)!$
$x{!}^{\prime }=x\left(x-1\right){!}^{\prime }+\left(x-1\right)!$
So we are looking for a function that satisfies
$f\left(x\right)=xf\left(x-1\right)+\left(x-1\right)!$
Replacing we have
$f\left(x\right)=x\left(\left(x-1\right)f\left(x-2\right)+\left(x-2\right)!\right)+\left(x-1\right)!$
Again
$f\left(x\right)=x\left(\left(x-1\right)\left(\left(x-2\right)f\left(x-3\right)+\left(x-3\right)!\right)+\left(x-2\right)!\right)+\left(x-1\right)!$
Notice that we have at this stage
$f\left(x\right)=x\left(x-1\right)\left(x-2\right)f\left(x-3\right)+x\left(x-1\right)\left(x-3\right)!+x\left(x-2\right)!+\left(x-1\right)!$
So we can extend
$f\left(x\right)=x\left(x-1\right)\left(x-2\right)\cdots \left(x-\left(k-1\right)\right)f\left(x-k\right)+$
$x\left(x-1\right)\cdots \left(x-\left(k-2\right)\right)\left(x-k\right)!+\cdots +x\left(x-1\right)\left(x-3\right)!+$
$x\left(x-2\right)!+\left(x-1\right)!$
or
$f\left(x\right)=x\left(x-1\right)\left(x-2\right)\cdots \left(x-\left(k-1\right)\right)f\left(x-k\right)+\sum _{m=x}^{x-\left(k-1\right)}\frac{x!}{m}$
Step 2
Taking $k=x$ and x integer we have
$f\left(x\right)=x!f\left(0\right)+\sum _{m=x}^{1}\frac{x!}{m}$
Notice that this must be completely valid no matter what extension of factorial we take. And we could essentially stop here.
Still, since we can, it all now comes to defining $f\left(0\right)$ which is $0{!}^{\prime }$, first derivative of factorial at 0.
What is the value of $0!\prime$?
Well $f\left(0\right)$ is a constant so there is no harm of replacing it with $f\left(0\right)=-\gamma +c$ (We use $\gamma$ so we could argue about the asymptotic evaluation as it is obviosly needed to reach $\mathrm{ln}\left(x\right)$)

nick1337

Expert

Step 1
It's probably best to use an analytic continuation of the factorial function, rather than the factorial itself. Consider the gamma function:
$\mathrm{\Gamma }\left(x\right)={\int }_{0}^{\mathrm{\infty }}{t}^{x-1}{e}^{-t}dt$
Obviously, $\mathrm{\Gamma }\left(1\right)=1$, and we also have:
$\mathrm{\Gamma }\left(x+1\right)={\int }_{0}^{\mathrm{\infty }}{t}^{x}{e}^{-t}dt$
$=\left[-{t}^{x}{e}^{-t}{\right]}_{0}^{\mathrm{\infty }}+x{\int }_{0}^{\mathrm{\infty }}{t}^{x-1}{e}^{-t}dt$
So, $\mathrm{\Gamma }\left(x\right)=\left(x-1\right)!$. So, just freely take derivatives now.

Do you have a similar question?