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:
This function can be broken into a composite function $f \circ g$ by observing that:
Therefore we can reinterpret the original function as:
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 = f \circ g$ as $F(x) = f(g(x))$ and $F^\prime$ is given by:
In Leibniz notation, assuming $y = f(u)$ and $u = g(x)$ have derivatives, the chain rule can be expressed as:
With the chain rule, we can now find the derivative of the function $f(x) = \sin{4x}$.
We can check our answer using SymPy
from sympy import symbols, diff, sin, cos, sqrt, simplify, init_printing
init_printing()
x = symbols('x')
diff(sin(4 * x))
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) = (1 - x^2)^{10}$
diff((1 - x ** 2) ** 10)
Example 2: Find the derivative of $f(x) = e^{\sqrt{x}}$
Import the constant e
from the mpmath
library for SymPy to calculate the derivative.
from mpmath import e
diff(e ** sqrt(x))
Example 3: Find the derivative of $f(x) = \sqrt[4]{1 + 2x + x^3}$
diff((1 + 2 * x + x ** 3) ** (1/4))
Example 4: Find the derivative of $f(x) = \frac{1}{(t^4 + 1)^3}$
diff(1 / (x ** 4 + 1) ** 3)
Example 5: Find the derivative of $f(x) = \cos{(a^3 + x^3)}$
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.
diff(cos(a ** 3 + x ** 3), x)