N-th Derivative of Special Function

MIT has a cute little problem in their calculus problem set, which you can see here. I like this problem because it takes something complicated and shows that it actually reduces down to something very simple.

To start this problem off let’s suppose we have a function that we can write as the product of two other functions, $y = u(x)v(x)$. There are many such functions. For example, $y(x) = x^2sin(x)$.

To find the derivative we would need to use the power rule. To get warmed up let’s take two derivatives of $y = u(x)v(x)$.

$y' = u'v + uv'$ (that’s just the product rule definition).

Applying the rule again we get four terms, two from the first product and two from the second:

$y'' = u''v +u'v' + u'v' + uv''$

We can combine terms to get:

$y'' = u''v + 2u'v' + uv''$

This process can continue and indeed the problem set gives us Libniz’s formula for the n-th derivative, which is:

$y^{(n)} = u^{(n)}v + \binom{n}{1}u^{(n-1)}v^{(1)} + \binom{n}{2}u^{(n-2)}v^{(2)} + \cdots + uv^{(n)}$

This formula may look daunting at first, but it’s really pretty simple. Note that we are not raising our functions to powers, $u^{(n-1)}$ means the $(n - 1)$-st derivative. Let’s apply Libniz’s formula to the second derivative of $y(x)$ above.

$y^{(2)} = u^{(2)}v + \binom{2}{1}u^{(2-1)}v^{(1)} + uv^{(2)}$

$y^{(2)} = u^{(2)}v + \frac{2!}{1!(2-1)!}u^{(2-1)}v^{(1)} + uv^{(2)}$

$y^{(2)} = u^{(2)}v + 2u^{(1)}v^{(1)} + uv^{(2)}$

This is exactly what we got above, the only difference is the notation.

The problem now asks us to calculate $y^{(p+q)}$ if $y = x^p(x+a)^q$.

Before we begin let’s make a few observations that will help us along the way. First, in this example  our $u(x)$ is $x^p$ and $v(x)$ is $(x+a)^q$.

Next, let me remind you about two well known facts of $x^p$. As an example, I’ll take $p$ to be $3$. Then we just have the following, where I will adopt the same notation used in Libniz’s formula.

$y = x^3$

$y ^{(1)}= 3 \cdot x^2$

$y ^{(2)}= 3 \cdot 2 \cdot x^1$

$y ^{(3)}= 3 \cdot 2 \cdot 1$

$y ^{(4)}= 0$

So what have we learned? Well, first we know that all derivatives higher than order $p$ are 0. In our example, $p$ was 3, and by the fourth derivative we got 0. Of course the derivative of 0 is 0, so from here on out (for all derivatives of order greater than 3), we’re going to get 0.

The second thing to notice is that the p-th derivative is actually $p!$. Again, in this case $p$ was 3 and for $y ^{(3)}$ our answer was $3 \cdot 2 \cdot 1$, otherwise known as $3!$.

These two rules also hold for $(x+a)^q$. True, we have to use the chain rule, but of course the derivative of $x+a$ is just 1.

Given what we’ve learned let’s move forward writing out the first few terms of Leibniz’s formula with our given $y(x)$.

$y^{(p+q)} =x^{p^{(p+q)}}(x+a)^q + \binom{p+q}{1}x^{p^{(p+q-1)}}(x+a)^{q^{(1)}} + \binom{p+q}{2}x^{p^{(p+q-2)}}(x+a)^{q^{(2)}} + \cdots$

So far all of these terms are 0 since the derivatives of $x^p$ are of higher order than $p$. We can ask when they will stop being 0. This occurs on the $(q+1)$-st term when the derivative is $p + q - q$, which is just $p$. So we know that’s the first non-zero term. Let’s start with that term and write out the next few terms.

$y^{(p+q)} =\binom{p+q}{q}x^{p^{(p+q-q)}}(x+a)^{q^{(q)}} + \binom{p+q}{q+1}x^{p^{(p+q-(q+1))}}(x+a)^{q^{(q+1)}} +\binom{p+q}{q+2}x^{p^{(p+q-(q+2))}}(x+a)^{q^{(q+2)}} + \cdots$

Notice what happens here. For derivatives of order higher than $q$ the $(x+a)^q$ term is 0. So we are left with only a single term! That term is:

$y^{(p+q)} =\binom{p+q}{q}x^{p^{(p+q-q)}}(x+a)^{q^{(q)}}$

But this can be simplified using our rules from above. We can replace $x^{p^{(p+q-q)}}$ with $p!$ since this is the p-th derivative of $x^p$ and $(x+a)^{q^{(q)}}$ with $q!$ since it’s the q-th derivative of $(x+a)^q$.

$y^{(p+q)} =\binom{p+q}{q}p!q!$

And now we can expand the binomial term. Recall that $\binom{n}{k} = \frac{n!}{k!(n-k)!}$.

$y^{(p+q)} = \frac{(p+q)!}{q!(p+q-q)!}p!q!$

$y^{(p+q)} = \frac{(p+q)!}{q!p!}p!q!$

$y^{(p+q)} =(p+q)!$

See what I mean! The derivatives of the product of two fairly general functions just turns into a few multiplications.