Artificial Intelligence 🤖
Differentiation
Leibniz's formula

Leibniz's formula

Before we discuss Leibniz's formula, let us go through an example where we compute derivatives of order higher than 1. Consider the function f(x)=lnxf(x)=\ln x. The first four derivatives are given by

f(1)=1x,f(2)=1x2,f(3)=2x3,f(4)=6x4.f^{(1)}=\frac{1}{x}, \quad f^{(2)}=-\frac{1}{x^{2}}, \quad f^{(3)}=\frac{2}{x^{3}}, \quad f^{(4)}=-\frac{6}{x^{4}} .

From the first few derivatives we can observe that the nth n^{\text {th }} derivative is given by,

f(n)=(1)n1(n1)!xnf^{(n)}=(-1)^{n-1} \frac{(n-1) !}{x^{n}}

Next, we introduce the Leibniz derivative rule which allows us to express the nth n^{\text {th }} derivative of a product (i.e. it is a generalisation of the product rule to higher derivatives). Consider two functions of x,u(x)x, u(x) and v(x)v(x); the derivative of their product:

ddx[uv]=uv+uv\frac{d}{d x}[u v]=u^{\prime} v+u v^{\prime}

Differentiating again with respect to xx gives

d2dx2[uv]=uv+2uv+uv\frac{d^{2}}{d x^{2}}[u v]=u^{\prime \prime} v+2 u^{\prime} v^{\prime}+u v^{\prime \prime}

and a third time,

d3dx3[uv]=uv+3uv+3uv+uv\frac{d^{3}}{d x^{3}}[u v]=u^{\prime \prime \prime} v+3 u^{\prime \prime} v^{\prime}+3 u^{\prime} v^{\prime \prime}+u v^{\prime \prime \prime}

It may be clear at this point that the numerical coefficients are the same as the ones in the binomial theorem:

(a+b)n=m=0nn!m!(nm)!anmbm.(a+b)^{n}=\sum_{m=0}^{n} \frac{n !}{m !(n-m) !} a^{n-m} b^{m} .

Now, for n=2n=2,

(a+b)2=a2b0+2ab+a0b2(a+b)^{2}=a^{2} b^{0}+2 a b+a^{0} b^{2}

note that we included a(0)a^{(0)} and b(0)b^{(0)} so that we can make a direct comparison to f(2)f^{(2)}. Recall that the zeroth derivative of a function is simply the function itself e.g. so u(0)=u(x)u^{(0)}=u(x) and v(0)=v(x)v^{(0)}=v(x). Similarly, for n=3n=3 and m=0,,3m=0, \cdots, 3, we obtain the coefficients 1, 3, 3, 1 as they appear in f(3)f^{(3)}. The Leibniz rule (Note that this is different to the Leibniz integral rule which is used for differentiation under the integral sign) is given by the following formula:

f(n)[u(x)v(x)]=m=0n(nm)u(nm)(x)v(m)(x),f^{(n)}[u(x) v(x)]=\sum_{m=0}^{n}\left(\begin{array}{c} n \\ m \end{array}\right) u^{(n-m)}(x) v^{(m)}(x),

where the binomial coefficients are given by

(nm)=n!m!(nm)!\left(\begin{array}{l} n \\ m \end{array}\right)=\frac{n !}{m !(n-m) !}

The formula is particularly useful when either vv (or uu ) are polynomials so that the derivatives v(m)v^{(m)} are zero apart from the first few terms. For example, if we wanted to differentiate nn times the function f(x)=x2e2xf(x)=x^{2} e^{2 x}, we express the function ff as the product of two functions, u(x)=e2xu(x)=e^{2 x} and v(x)=x2v(x)=x^{2}. Then, since v=2x,v=2v^{\prime}=2 x, v^{\prime \prime}=2, and v=0v^{\prime \prime \prime}=0 for m=1,2m=1,2, and 3, respectively, v(m)=0v^{(m)}=0 for m3m \geq 3. Application of the rule gives,

f(n)(x)=(n0)u(n)x2+(n1)u(n1)2x+(n2)u(n2)2.f^{(n)}(x)=\left(\begin{array}{l} n \\ 0 \end{array}\right) u^{(n)} x^{2}+\left(\begin{array}{l} n \\ 1 \end{array}\right) u^{(n-1)} 2 x+\left(\begin{array}{l} n \\ 2 \end{array}\right) u^{(n-2) 2 .}

We note that u(m)=2me2xu^{(m)}=2^{m} e^{2 x} and so

f(n)(x)=2ne2x[x2+nx+n(n1)4];f^{(n)}(x)=2^{n} e^{2 x}\left[x^{2}+n x+\frac{n(n-1)}{4}\right] ;

using

(n0)=1,(n1)=n,(n2)=n(n1)2\left(\begin{array}{l} n \\ 0 \end{array}\right)=1, \quad\left(\begin{array}{l} n \\ 1 \end{array}\right)=n, \quad\left(\begin{array}{l} n \\ 2 \end{array}\right)=\frac{n(n-1)}{2}