Processing math: 100%

The Chain Rule of Differentiation

The chain rule is a powerful and useful derivation technique that allows the derivation of functions that would not be straightforward or possible with the only the previously discussed rules at our disposal. The rule takes advantage of the "compositeness" of a function. For example, consider the function:

f(x)=sin4x

This function can be broken into a composite function fg by observing that:

y=f(u)=sinu and u=g(x)=4x

Therefore we can reinterpret the original function as:

F(x)=f(g(x)), or F=fg

The chain rule gives us the ability the find the derivatives of f and g using the tools we previously discussed. We can state the chain rule more precisely as:

Assuming g is differentiable at x and the derivative of f(g(x)) exists, then we can state the composite function F=fg as F(x)=f(g(x)) and F is given by:

F(x)=f(g(x))g(x)

In Leibniz notation, assuming y=f(u) and u=g(x) have derivatives, the chain rule can be expressed as:

dydx=dydu dudx

With the chain rule, we can now find the derivative of the function f(x)=sin4x.

u=4x,y=sinu
dudx=4,dydu=cosu
dydx=4cos4x

We can check our answer using SymPy

In [12]:
from sympy import symbols, diff, sin, cos, sqrt, simplify, init_printing
In [4]:
init_printing()
x = symbols('x')
In [6]:
diff(sin(4 * x))
Out[6]:
4cos(4x)

Examples

These and the previous example are taken from James Stewart's Calculus Early Transcendentals (Section 3.4, pp. 203)

Example 1: Find the derivative of f(x)=(1x2)10

u=1x2,y=u10
dydu=10u9,dudx=2x
dydx=10(1x2)92x=20x(1x2)9
In [7]:
diff((1 - x ** 2) ** 10)
Out[7]:
20x(x2+1)9

Example 2: Find the derivative of f(x)=ex

y=eu,u=x
dydu=eu,dudx=12x12=12x
dydx=ex12x=ex2x

Import the constant e from the mpmath library for SymPy to calculate the derivative.

In [14]:
from mpmath import e
In [13]:
diff(e ** sqrt(x))
Out[13]:
0.5x2.71828182845905x

Example 3: Find the derivative of f(x)=41+2x+x3

u=1+2x+x3,y=u14
dudx=3x2+2,dydu=14u34=34u
dydx=3x+24(1+2x+x3)34
In [16]:
diff((1 + 2 * x + x ** 3) ** (1/4))
Out[16]:
0.75x2+0.5(x3+2x+1)0.75

Example 4: Find the derivative of f(x)=1(t4+1)3

u=t4+1,y=1u3=u3
dudt=4t3,dydu=u3=3u4=3u4
dydx=4t33(t4+1)4=12t3(t4+1)4
In [17]:
diff(1 / (x ** 4 + 1) ** 3)
Out[17]:
12x3(x4+1)4

Example 5: Find the derivative of f(x)=cos(a3+x3)

u=a3+x3,y=cosu
dudx=3x2,dydu=sinu
dydx=3x2sina3+x3
In [19]:
a = symbols('a') # define a variable that we'll treat as constant

Because there is more than variable, must specify which we're interested in for SymPy to compute the derivative.

In [22]:
diff(cos(a ** 3 + x ** 3), x)
Out[22]:
3x2sin(a3+x3)

References

Related Posts