# Calculating derivatives of products using Pascal’s Triangle

The method

Suppose you wish to calculate the n-th derivative of the product of two functions $f$ and $g$. There is a general rule, called Leibniz’s rule, which gives a slightly easier way of computing it, without the process of calculating every step. The rule states that

$\displaystyle (fg)^{(n)}=\sum_{k=0}^n\dbinom{n}{k}f^{(k)}g^{(n-k)}$.

So the n-th derivative is the sum of n+1 terms, with the coefficients given by the n-th line of Pascal’s triangle. This is very much like the binomial theorem, which states that, given two numbers $a$ and $b$,

$\displaystyle \left(a+b\right)^n=\sum_{k=0}^n\dbinom{n}{k}a^{k}b^{n-k}$.

An example

Suppose we wish to calculate $\left(e^x \sin x\right)^{(5)}$. We will still need to calculate the first 5 derivatives of both functions, but that is pretty straight forward. We also calculate the 5th line of Pascal’s triangle.

 $n$ $(e^x)^{(n)}$ $(\sin x)^{(n)}$ $1$ $e^x$ $\cos x$ $2$ $e^x$ $-\sin x$ $3$ $e^x$ $-\cos x$ $4$ $e^x$ $\sin x$ $5$ $e^x$ $\cos x$
 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

So, our derivative is simply multiplying the n-th coefficient with the n-th derivative of $e^x$ and the n-th derivate of $\sin x$, but counting this last one backwards, starting from the bottom of the table.

$(e^x\sin x)^{(5)}= \\ \\ =1e^x(\cos x)+5e^x(\sin x)+10e^x(-\cos x)+10e^x(-\sin x)+5e^x(\cos x)+1e^x(\sin x)= \\ =e^x(\cos x+5\sin x-10\cos x-10\sin x+5\cos x+\sin x)= \\ \\ =-4e^x(\sin x +\cos x)$.

Why does it work?

The idea behind both “rules” is that we apply an operation to a general term, which we shall call the term $T(n,m)$. The operation $F$ is such that:

$F(~T(n,m)~)=T(n+1,m)+T(n,m+1)$

In particular, we have:
1) In the binomial theorem,
$T(n,m)=a^nb^m$ and F is multiplying by $(a+b)$:
$F(~T(n,m)~)=a^nb^m(a+b)=a^{n+1}b^m+a^nb^{m+1}=T(n+1,m)+T(n,m+1)$

2) In Leibnitz’s rule,
$T(n,m)=f^{(n)}g^{(m)}$ and F is the derivative operator:
$F( T(n,m) )=\frac{d}{dx}(f^{(n)}g^{(m)})=f^{(n+1)}g^{(m)}+f^{(n)}g^{(m+1)}=\\ T(n+1,m)+T(n,m+1)$

Here, $+$ stands for standard addition. We must also state the initial condition,
$(a+b)^0=1\\ (fg)^{0}=fg$

So, we have the following theorem.
1) If $V$ is a vector space and $T(n,m)\in V$ for every non-negative m,n;
2) If there is an operation $F$ such that $F(~T(n,m)~)=T(n+1,m)+T(n,m+1)$,
then:
$\displaystyle F^n(T(0,0))=\sum_{k=0}^{n}\dbinom{n}{k}T(k,n-k)$.

This generalizes both rules.

The idea of the proof was found here: http://math.stackexchange.com/questions/135510/how-is-leibnizs-rule-for-the-derivative-of-a-product-related-to-the-binomial-fo .