54
$\begingroup$

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.

$\endgroup$
2
  • 1
    $\begingroup$ What do you mean by the 'derivative'? Since you're working with discrete things, do you want the forward difference or something like that? $\endgroup$ Feb 11, 2013 at 20:37
  • 3
    $\begingroup$ Writing an expression with a variable number of terms/factors and treating it as if it were fixed formulas is a very bad idea in doing differentation. You will find examples under the tag (fake-proofs) on this site. $\endgroup$ Aug 27, 2013 at 8:55

5 Answers 5

56
$\begingroup$

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.

$\endgroup$
5
  • 7
    $\begingroup$ It might be good to observe that ther are other differentiable (and even analytic) functions that restrict to the factorial functions on the natural numbers, and that they have different derivatives; the question, even with a liberal interpretation of what it is asking, really has no definite answer. $\endgroup$ Aug 27, 2013 at 8:50
  • 4
    $\begingroup$ @MarcvanLeeuwen: it might be useful to note that Gamma is the only log-convex function on the reals that matches up with $(n-1)!$ on the integers. $\endgroup$
    – robjohn
    Nov 7, 2015 at 2:08
  • 3
    $\begingroup$ How can we show that $\Gamma^\prime(n+1)=n!\left(-\gamma+\sum_{k=1}^n\frac{1}{k}\right)$? $\endgroup$
    – Squirtle
    Jun 1, 2019 at 0:42
  • $\begingroup$ @Squirtle Do you know about the digamma and polygamma functions? We have (by definition) $$\psi(s):=\frac{\mathrm{d}}{\mathrm{d}s}\mathrm{Log}\Gamma(s)=\frac{\Gamma'(s)}{\Gamma(s)}$$And so: $$\Gamma'(s)=\Gamma(s)\cdot\psi(s)$$However, it can be shown (check the Weierstrass and Euler gamma products, take their logarithms, and differentiate) that: $$\psi(s)=-\gamma+\sum_{n=0}^\infty\left[\frac{1}{n+1}-\frac{1}{n+s}\right]$$Which reduces to the harmonic numbers for integer $s$. $\endgroup$
    – FShrike
    Apr 10, 2022 at 13:29
  • $\begingroup$ Doing the multiplication $\psi(n+1)\Gamma(n+1)$ gives Icurays1's answer $\endgroup$
    – FShrike
    Apr 10, 2022 at 13:30
33
$\begingroup$

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$).

$\endgroup$
0
13
$\begingroup$

$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.

$\endgroup$
0
11
$\begingroup$

Start from

$$x!=x(x-1)!$$ $$x!'=x(x-1)!'+(x-1)!$$

So we are looking for a function that satisfies

$$f(x)=xf(x-1)+(x-1)!$$

Replacing we have

$$f(x)=x((x-1)f(x-2)+(x-2)!)+(x-1)!$$

Again

$$f(x)=x((x-1)((x-2)f(x-3)+(x-3)!)+(x-2)!)+(x-1)!$$

Notice that we have at this stage

$$f(x)=x(x-1)(x-2)f(x-3)+x(x-1)(x-3)!+x(x-2)!+(x-1)!$$

So we can extend

$$f(x)=x(x-1)(x-2)...(x-(k-1))f(x-k)+$$ $$x(x-1)...(x-(k-2))(x-k)!+...+x(x-1)(x-3)!+$$ $$x(x-2)!+(x-1)!$$

or

$$f(x)=x(x-1)(x-2)...(x-(k-1))f(x-k)+\sum_{m=x}^{x-(k-1)}\frac{x!}{m}$$

Taking $k=x$ and $x$ integer we have

$$f(x)=x!f(0)+\sum_{m=x}^{1}\frac{x!}{m}$$

or

$$f(x)=x!(f(0)+\sum_{m=1}^{x}\frac{1}{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(0)$ which is $0!'$, first derivative of factorial at $0$.

What is the value of $0!'$ ?

Well $f(0)$ is a constant so there is no harm of replacing it with $f(0)=-\gamma+c$. (We use $\gamma$ so we could argue about the asymptotic evaluation as it is obviously needed to reach $\ln(x)$)

$$f(x)=x!(-\gamma+c+\sum_{m=1}^{x}\frac{1}{m})$$

Asymptotically then

$$f(x) \sim x!(\ln(x)+c)$$

Now

$$\ln(x!)'=\frac{1}{x!}x!' \sim \frac{1}{x!}x!(\ln(x)+c)=\ln(x)+c$$

Yet in the simplest

$$\ln(x!)' \approx \frac{\ln(x!)-\ln((x-1)!)}{1}=\ln(x)$$

meaning there is no problem to take $c=0$, even though it can be any other value. (We are just trying to give some interpretation for having $c=0$. In the notes there are more of it.)

That makes:

$$x!'=x!(-\gamma+\sum_{m=1}^{x}\frac{1}{m})$$

or

$$n!'=n!(H_n-\gamma)$$

shortly written as

$$\ln(n!)'= H_n-\gamma$$

(Of course, this is just one of the possibilities that happens to match the standard Gamma function factorial extension as well. We explain further other implications of taking $c=0$ and how the solution might not correspond to the standard Gamma function at all.)

Notes

To conclude this all, if we require $x!=x(x-1)!$, then any other possible extension of factorial function has a form $x!=g(x)\Gamma(x+1)$ where $g(x+1)=g(x)$, meaning the additional multiplier is any periodic function with period $1$ .

This is reveling the format of all possible values for $c$ no matter what extension we have.

$$f(0)=-\gamma g(0)+ g'(0)$$

So if for a periodic function at integers $g(n)=1$ and $g'(n)=0$, that is our choice. The simplest possible, since we do want to have naturally $1!=1$, for example, leaving:

$$f(0)=-\gamma + g'(0)$$

which makes $c=g'(0)$.

There is nothing we could say about the derivative at integers $g'(n)$ without some additional requirement. We have chosen it to be $0$.

However, an additional argument is that asymptotically it is not possible to have any other constant value for $c$ as it is not difficult to find that $\ln(n!) = n\ln n - n +O(\ln(n))$ yet an integral of $\ln(n)+c$ would add one more linear term beyond $-n$.

This argumentation requires that an extension of factorial, as there is no other way of defining first derivative, conforms with its asymptotic properties even locally. Other versions of extended factorial might not follow this requirement.

This requirement is in line with so called logarithmically convex function that fulfills for any $x,y$

$$\ln f(x) \geq \ln f(y) + \frac{f'(y)}{f(y)}(x - y)$$

meaning

$$\ln((n+1)!) \geq \ln(n!) + \frac{n!'}{n!}((n+1) - 1)$$ $$\ln(n+1) \geq \ln(n)+c$$

and this asymptotically requires $c=0$. So we could say that $c$ is equal to $0$, if our choice of an extension for factorial is at least (asymptotically, i.e. for sufficiently large integer) logarithmically convex at integers, even though logarithmically convex is not usefully defined just for integers, since it is a global property.

However, $0!'=-\gamma$ does not necessarily define a classical Gamma function neither it is a prerequisite to have a solution. For integer factorial, any value of $0!'$ would do. We are just trying to connect dots a little bit more in depth.

Now that we are there, it is not difficult to establish for any extension of factorial an illustrative connection:

$$\ln(x!)'=H_{[x]}-\ln(\{x\}!)+0!'$$ where $[x]$ is integer and $\{x\}$ fractional part of $x=[x]+\{x\},0\leq\{x\}<1$.

(This is all far more interesting than it may seem at first. Choosing a periodic

$$g(x)=\frac{1}{\Gamma(\{x\}+1)}$$

we get this as a possible factorial extension

$$x!=\frac{\Gamma(x+1)}{\Gamma(\{x\}+1)}$$

and that is a “linear” version of $x!$ for $x \geq 0$. This is probably the most direct extension of integer factorial one could think of. It is a completely acceptable extension.)

$\endgroup$
2
  • $\begingroup$ Could you please explain the choice of taking $f'(0)=-\gamma + c$? $\endgroup$ May 10, 2019 at 13:57
  • 1
    $\begingroup$ @WilliamR.Ebenezer Notes added. $\gamma$ is just extracted in order to be able to argue about asymptotic evaluation as it gives with the remaining part nicely $\ln(x)$ $\endgroup$
    – alex.peter
    May 12, 2019 at 13:34
5
$\begingroup$

It's probably best to use an analytic continuation of the factorial function, rather than the factorial itself. Consider the gamma function:

$\Gamma(x) = \int_{0}^{\infty}t^{x-1}e^{-t}dt$

Obviously, $\Gamma(1) = 1$, and we also have:

$$\begin{align} \Gamma(x+1) &= \int_{0}^{\infty}t^{x} e^{-t}dt\\ &=[-t^{x}e^{-t}]_{0}^{\infty} + x\int^{\infty}_{0}t^{x-1}e^{-t}dt\\ &=x\Gamma(x). \end{align}$$

So, $\Gamma(x) = (x-1)!$. So, just freely take derivatives now.

$\endgroup$
2
  • 2
    $\begingroup$ There is no such thing as an analytic continuation of the factorial funcion on$~\Bbb N$. The function $x\mapsto\Gamma(x+1)$ is an analytic extension (or maybe interpolation or extrapolation is a better term), but it is not the only one that exists. Other extensions have different derivatives of course. $\endgroup$ Aug 27, 2013 at 8:46
  • 2
    $\begingroup$ Sure. Of course that is true. It's the natural one, but yes, you have an infinity of other choices, including simple trivial ones like $\Gamma(x +1 ) + A\sin(2\pi x)$ or whatever. $\endgroup$ May 12, 2017 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .