In this post I’ll describe a simple algorithm to compute the kth derivatives of the Gamma function.

I’ll start by showing a simple recursion relation for these derivatives, and then gives its derivation. The kth derivative of Gamma(x) can be computed as follows:

The recursive formula for the D_{k} functions has an easy inductive proof:

Computing the next value D_{k} requires knowledge of D_{k-1} but also derivative D’_{k-1}. If we start expanding terms, we see the following:

Continuing the process above it is not hard to see that we can continue expanding until we are left only with terms of _{1}^{(*)}(x);_{1}(x)_{1}(x)

What we want, to do these computations systematically, is a formula for computing the nth derivative of a term _{k}(x)

Generalizing from the above, we see that the formula for the nth derivative is:

We are now in a position to fill in the triangular table of values, culminating in the value of _{k}(x):

As previously mentioned, the basis row of values _{1}^{(*)}(x)_{1}^{(n)}(x) = polygamma^{(n)}(x)