# Lecture 6: The Chain Rule

## Calculus I — Differential Calculus

---

## Learning Objectives

By the end of this lecture, students will be able to:

1. State and apply the chain rule for composite functions
2. Identify the "inner" and "outer" functions in a composition
3. Apply the chain rule in Leibniz notation
4. Combine the chain rule with the product, quotient, and power rules
5. Differentiate functions involving multiple nested compositions

---

## Lecture Content

### I. Motivation and Statement of the Chain Rule

Many functions encountered in practice are **compositions** of simpler functions. For example, h(x) = (3x^2 + 1)^5 is the composition of the outer function f(u) = u^5 with the inner function g(x) = 3x^2 + 1. The **chain rule** tells us how to differentiate such compositions.

The formal statement is as follows: if g is differentiable at x and f is differentiable at g(x), then the composite function h(x) = f(g(x)) is differentiable at x, and h'(x) = f'(g(x)) * g'(x). In words, this says "take the derivative of the outer function evaluated at the inner function, then multiply by the derivative of the inner function."

### II. The Chain Rule in Leibniz Notation

If y = f(u) and u = g(x), the chain rule takes the elegant form dy/dx = (dy/du) * (du/dx). This notation looks like "cancellation" of the du terms. While this is not rigorous in terms of fractions, it provides excellent intuition and serves as a reliable mnemonic. The chain rule extends naturally to longer chains of composition: if y = f(u), u = g(v), and v = h(x), then dy/dx = (dy/du)(du/dv)(dv/dx).

### III. Applying the Chain Rule — The General Power Rule

The **General Power Rule** is the chain rule applied to powers of functions: d/dx [g(x)]^n = n * [g(x)]^{n-1} * g'(x). This arises from composing f(u) = u^n with u = g(x).

Consider three examples. First, d/dx [(3x^2 + 1)^5]: the outer function is u^5 and the inner function is 3x^2 + 1. Applying the chain rule gives 5(3x^2 + 1)^4 * 6x = 30x(3x^2 + 1)^4. Second, d/dx [sqrt(x^2 + 4)] = d/dx [(x^2 + 4)^{1/2}] = (1/2)(x^2 + 4)^{-1/2} * 2x = x / sqrt(x^2 + 4). Third, d/dx [1/(2x - 5)^3] = d/dx [(2x - 5)^{-3}] = -3(2x - 5)^{-4} * 2 = -6/(2x - 5)^4.

<image>A diagram illustrating the chain rule as a "function machine." Input x enters a box labeled "g (inner function)" producing u = g(x), which then enters a box labeled "f (outer function)" producing y = f(u) = f(g(x)). Below, the derivative chain is shown: dy/dx = (dy/du) times (du/dx), with arrows connecting the corresponding rates. Each rate is labeled: du/dx = g'(x) and dy/du = f'(u) = f'(g(x)). Title: "The chain rule as a pipeline of rates."</image>

### IV. Combining the Chain Rule with Other Rules

In practice, the chain rule frequently appears alongside the product and quotient rules. When differentiating a product like f(x) * g(h(x)), apply the product rule first: the result is f'(x) * g(h(x)) + f(x) * g'(h(x)) * h'(x). Similarly, when the quotient rule produces terms involving composite functions, the chain rule must be applied to each one.

As an example, consider d/dx [x^2 * (3x + 1)^4]. The product rule gives 2x(3x + 1)^4 + x^2 * 4(3x + 1)^3 * 3 = 2x(3x + 1)^4 + 12x^2(3x + 1)^3. Factoring yields 2x(3x + 1)^3 [(3x + 1) + 6x] = 2x(3x + 1)^3(9x + 1).

### V. Multiple Applications of the Chain Rule

For deeply nested functions, the chain rule must be applied multiple times. Consider d/dx [sqrt(1 + (2x)^3)]. Setting u = 1 + (2x)^3, the function is u^{1/2}, so the derivative begins as (1/2)u^{-1/2} * d/dx[1 + (2x)^3]. To differentiate (2x)^3 = 8x^3, we get 24x^2 (or equivalently, apply the chain rule to get 3(2x)^2 * 2 = 24x^2). The final result is (1/2)(1 + 8x^3)^{-1/2} * 24x^2 = 12x^2 / sqrt(1 + 8x^3).

### VI. Common Mistakes with the Chain Rule

The most frequent error is **forgetting the inner derivative**. For instance, d/dx [(3x + 1)^5] is not simply 5(3x + 1)^4; it must be multiplied by 3, the derivative of the inner function. Another mistake is **applying the chain rule when it is unnecessary**: d/dx [x^5] = 5x^4 requires no chain rule because the inner function is just x, whose derivative is 1. Students should also be careful about **confusing the order** of operations: always differentiate the outer function first, then multiply by the derivative of the inner function. Finally, always **simplify the result** after applying the chain rule to catch errors and recognize patterns.

<image>A worked example shown step-by-step with color coding. The function y = (x^3 + 2x)^4 is differentiated. Step 1: Identify outer (u^4, colored blue) and inner (x^3 + 2x, colored red). Step 2: Apply chain rule — write 4(x^3 + 2x)^3 in blue, then multiply by (3x^2 + 2) in red. Step 3: Final answer y' = 4(3x^2 + 2)(x^3 + 2x)^3. A "common mistake" box below shows the incorrect answer y' = 4(x^3 + 2x)^3 with an X mark and the note "forgot the inner derivative."</image>

### VII. Why the Chain Rule Works — Intuition

The chain rule has a natural interpretation in terms of rates. If u changes at a rate du/dx with respect to x, and y changes at a rate dy/du with respect to u, then y changes at a rate (dy/du)(du/dx) with respect to x. An analogy makes this concrete: if a car is moving at 60 km/h and the odometer converts kilometers to miles at 0.62 mi/km, then the mileage changes at 60 * 0.62 = 37.2 mi/h. The chain rule is simply the multiplication of rates along a chain of dependencies.

The formal proof relies on the fact that differentiability implies local linearity. Near any point, a differentiable function behaves approximately like a linear function, and the composition of two approximately linear functions is again approximately linear, with slope equal to the product of the individual slopes.
