Chain rule

The chain rule is a fundamental concept in calculus that allows you to compute the derivative of a composite function. In other words, if you have a function that is formed by combining two or more functions, the chain rule helps you find the derivative of the resulting function with respect to its input variable(s).

Mathematically, the chain rule states that for two functions, f(x)f(x) and g(x)g(x), the derivative of their composition

h(x)=f(g(x))h(x) = f(g(x))

is

h(x)=f(g(x))g(x)h'(x) = f'(g(x)) * g'(x)

where h(x)h'(x) is the derivative of h(x)h(x) with respect to xx, f(g(x))f'(g(x)) is the derivative of ff with respect to g(x)g(x), and g(x)g'(x) is the derivative of gg with respect to xx.

Example

Find the derivative of the composite function h(x)=(2x2+3)5h(x) = (2x^2 + 3)^5 with respect to xx.

  1. Define functions f(x)f(x) and g(x)g(x)
f(x)=x5g(x)=2x2+3\begin{aligned} f(x) &= x^5 \\ g(x) &= 2x^2 + 3 \end{aligned}
  1. Compute the derivatives
f(x)=5x4g(x)=4x\begin{aligned} f'(x) &= 5x^4 \\ g'(x) &= 4x \end{aligned}
  1. Apply the chain rule
h(x)=f(g(x))g(x)=5(2x2+3)44x=20x(2x2+3)4\begin{aligned} h'(x) &= f'(g(x)) * g'(x) \\ &= 5(2x^2 + 3)^4 * 4x \\ &= 20x(2x^2 + 3)^4 \end{aligned}

It's possible to check this using the Sympy library in Python:

import sympy

x = sympy.symbols("x")

f_x = x**5
g_x = 2 * x**2 + 3

f_prime = sympy.diff(f_x, x)
g_prime = sympy.diff(g_x, x)

h_prime = f_prime.subs(x, g_x) * g_prime

sympy.simplify(h_prime)

Tags: Mathematics