---
title: Differentiation Rules and the Chain Rule
module: Derivatives
moduleNumber: 2
lessonNumber: 2
order: 202
summary: >
  Computing every derivative from the limit definition is tedious. A short list
  of rules — power, constant multiple, sum, product, quotient — differentiates
  any polynomial or rational function by inspection. The trigonometric
  derivatives follow from one limit, and the chain rule extends everything to
  composite functions by multiplying rates along the composition.
topics: [Derivatives]
sources:
  - book: Stewart
    ref: "Ch. 2 — Derivatives; §2.3 Differentiation Formulas, §2.4 Derivatives of Trigonometric Functions, §2.5 The Chain Rule"
draft: false
---

The [limit definition](/calculus/derivatives/the-derivative-and-rates-of-change)
of the derivative is correct but slow: each new function needs its own
difference-quotient computation. A handful of rules, each proved once from the
definition, replace that work. The power, constant-multiple, sum, product, and
quotient rules together differentiate any polynomial or rational function by
inspection; the chain rule extends them to composite functions.

## The building-block rules

Start with the two simplest functions. A constant function $f(x) = c$ has a
horizontal graph, so its slope is $0$ everywhere; the identity $f(x) = x$ has
slope $1$.

$$
\frac{\d}{\d x}(c) = 0,
\qquad
\frac{\d}{\d x}(x) = 1.
$$

Both fall straight out of the definition. The general pattern for powers is the
one rule worth memorizing.

> **Theorem (Power Rule).** For any real number $n$,
> $$
> \frac{\d}{\d x}(x^n) = n x^{n-1}.
> $$

For a positive integer $n$, the factorization
$x^n - a^n = (x - a)(x^{n-1} + x^{n-2}a + \cdots + a^{n-1})$ gives

$$
f'(a) = \lim_{x \to a}\frac{x^n - a^n}{x - a}
      = \lim_{x \to a}\bigl(x^{n-1} + x^{n-2}a + \cdots + a^{n-1}\bigr)
      = n a^{n-1},
$$

because the limit has $n$ equal terms. The quotient rule below extends this to
negative integers, and a proof for all real exponents waits until the
[logarithmic derivative](/calculus/exponential-logarithmic-and-inverse-functions/inverse-functions-logarithms-and-exponentials)
supplies logarithmic differentiation. The rule holds throughout.

**Example.** The Power Rule reads off directly.

- $f(x) = x^6 \Rightarrow f'(x) = 6x^5$.
- $y = x^{1000} \Rightarrow y' = 1000 x^{999}$.
- $y = 1/x = x^{-1} \Rightarrow y' = -x^{-2} = -1/x^2$.
- $y = \sqrt[3]{x^{-2}} = x^{-2/3} \Rightarrow y' = -\tfrac{2}{3} x^{-5/3}$.

### Combining derivatives

New functions built from old ones by scaling, adding, or subtracting have
derivatives built the same way.

> **Theorem (Linearity).** If $f$ and $g$ are differentiable and $c$ is
> constant, then
> $$
> (cf)' = c f', \qquad (f + g)' = f' + g', \qquad (f - g)' = f' - g'.
> $$

Each follows from the matching limit law: a constant pulls out of a limit, and
the limit of a sum is the sum of the limits. Together with the Power Rule they
differentiate any polynomial term by term.

**Example.** For $y = x^8 + 12x^5 - 4x^4 + 10x^3 - 6x + 5$,

$$
\frac{\d y}{\d x} = 8x^7 + 60x^4 - 16x^3 + 30x^2 - 6.
$$

**Example.** Horizontal tangents of $y = x^4 - 6x^2 + 4$ occur where the
derivative vanishes:

$$
\frac{\d y}{\d x} = 4x^3 - 12x = 4x(x^2 - 3) = 0
\;\Longrightarrow\;
x = 0,\ \pm\sqrt{3},
$$

giving the points $(0,4)$, $(\sqrt3, -5)$, and $(-\sqrt3, -5)$.

## The Product and Quotient Rules

The derivative of a product is **not** the product of the derivatives. Taking
$f(x) = x$ and $g(x) = x^2$ gives $f'g' = 1 \cdot 2x = 2x$, whereas
$(fg)' = (x^3)' = 3x^2$. The correct formula was found by Leibniz.

> **Theorem (Product Rule).** If $f$ and $g$ are differentiable, then
> $$
> (fg)' = f g' + g f'.
> $$

The formula has an area reading. Take $f$ and $g$ as the side lengths
of a rectangle of area $fg$. Increasing $x$ grows the sides by differentials
$\d f$ and $\d g$, which adds two strips, $f\,\d g$ along the top and $g\,\d f$ along the
side, plus a corner $\d f\,\d g$. The corner is second-order and drops out in the
limit, leaving $\d(fg) = f\,\d g + g\,\d f$.

$$
% caption: Product rule as area. Growing f by df and g by dg adds two strips
% f dg and g df; the tiny corner df dg is second order and vanishes in the limit.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, thick] (0,0) rectangle (3,2);
\node at (1.5,1.0) {$fg$};
\fill[acc!16] (0,2) rectangle (3,2.9);
\draw[acc, thick] (0,2) rectangle (3,2.9);
\node at (1.5,2.45) {$f\,dg$};
\fill[acc!16] (3,0) rectangle (4.0,2);
\draw[acc, thick] (3,0) rectangle (4.0,2);
\node at (3.5,1.0) {$g\,df$};
\fill[black] (3,2) rectangle (4.0,2.9);
\draw[black, thick] (3,2) rectangle (4.0,2.9);
\node[font=\scriptsize] at (3.5,2.45) {$df\,dg$};
\draw[<->, black] (0,-0.4) -- (3,-0.4) node[midway,below]{$f$};
\draw[<->, black] (3,-0.4) -- (4.0,-0.4);
\node[font=\scriptsize, black, anchor=north] at (3.5,-0.48) {$df$};
\draw[<->, black] (-0.4,0) -- (-0.4,2) node[midway,left]{$g$};
\draw[<->, black] (-0.4,2) -- (-0.4,2.9);
\node[font=\scriptsize, black, anchor=east] at (-0.48,2.45) {$dg$};
\end{tikzpicture}
$$

The rigorous proof subtracts and adds $f(x+h)\,g(x)$ inside the difference
quotient to separate the two functions:

$$
\frac{f(x+h)g(x+h) - f(x)g(x)}{h}
 = f(x+h)\,\frac{g(x+h) - g(x)}{h} + g(x)\,\frac{f(x+h) - f(x)}{h}.
$$

Since $f$ is continuous at $x$, $\lim_{h\to0} f(x+h) = f(x)$, and the limit is
$f g' + g f'$.

**Example.** If $h(x) = x\,g(x)$ with $g(3) = 5$ and $g'(3) = 2$, then
$h'(x) = x g'(x) + g(x)$, so $h'(3) = 3(2) + 5 = 11$.

A quotient is handled by a companion rule.

> **Theorem (Quotient Rule).** If $f$ and $g$ are differentiable and $g \ne 0$,
> then
> $$
> \left(\frac{f}{g}\right)' = \frac{g f' - f g'}{g^2}.
> $$

The order matters: denominator times derivative of numerator, **minus**
numerator times derivative of denominator, all over the denominator squared.
Applied to $1/x^n$ it extends the Power Rule to negative integers:

$$
\frac{\d}{\d x}(x^{-n})
 = \frac{x^n \cdot 0 - 1 \cdot n x^{n-1}}{(x^n)^2}
 = -n x^{-n-1}.
$$

**Example.** For $y = \dfrac{x^2 + x - 2}{x^3 + 6}$,

$$
y' = \frac{(x^3 + 6)(2x + 1) - (x^2 + x - 2)(3x^2)}{(x^3 + 6)^2}
   = \frac{-x^4 - 2x^3 + 6x^2 + 12x + 6}{(x^3 + 6)^2}.
$$

The Quotient Rule is not always the fastest route. To differentiate
$F(x) = (3x^2 + 2\sqrt{x})/x$, divide first: $F(x) = 3x + 2x^{-1/2}$, then apply
the Power Rule.

The rules proved so far are collected below.

| Rule | Formula |
| --- | --- |
| Constant | $\dfrac{\d}{\d x}(c) = 0$ |
| Power | $\dfrac{\d}{\d x}(x^n) = n x^{n-1}$ |
| Constant multiple | $(cf)' = c f'$ |
| Sum / difference | $(f \pm g)' = f' \pm g'$ |
| Product | $(fg)' = f g' + g f'$ |
| Quotient | $\left(\dfrac{f}{g}\right)' = \dfrac{g f' - f g'}{g^2}$ |

Any polynomial is differentiable on all of $\mathbb{R}$, and any rational
function is differentiable on its domain.

## Derivatives of the trigonometric functions

Throughout, $\sin x$ means the sine of the angle whose **radian** measure is $x$;
the formulas below hold only in radians. Sketching the slope of $\sin x$
suggests that its derivative is $\cos x$, and the definition confirms it. Using
the addition formula $\sin(x + h) = \sin x \cos h + \cos x \sin h$,

$$
\frac{\d}{\d x}\sin x
 = \lim_{h \to 0}\left[\sin x\left(\frac{\cos h - 1}{h}\right)
     + \cos x\left(\frac{\sin h}{h}\right)\right].
$$

The evaluation reduces to two limits. One is proved by a squeeze between a
sector and its bounding triangles; the other follows from it.

> **Theorem (Fundamental trigonometric limits).**
> $$
> \lim_{\theta \to 0}\frac{\sin\theta}{\theta} = 1,
> \qquad
> \lim_{\theta \to 0}\frac{\cos\theta - 1}{\theta} = 0.
> $$

The first limit is proved by a squeeze on the unit circle. Take
$0 < \theta < \tfrac{\pi}{2}$ and place the angle at the centre $O$ of a circle
of radius $1$, with $A$ on the initial side and $B$ on the terminal side. Drop
$BC$ perpendicular to $OA$, and let the tangent at $A$ meet the line $OB$
produced at $E$. The triangle $OAB$, the circular sector $OAB$, and the triangle
$OAE$ nest, so their areas increase in that order:

$$
\underbrace{\tfrac{1}{2}\sin\theta}_{\triangle OAB}
 \;\le\; \underbrace{\tfrac{1}{2}\theta}_{\text{sector }OAB}
 \;\le\; \underbrace{\tfrac{1}{2}\tan\theta}_{\triangle OAE}.
$$

Dividing through by $\tfrac{1}{2}\sin\theta > 0$ and taking reciprocals reverses
the inequalities,

$$
\cos\theta \;\le\; \frac{\sin\theta}{\theta} \;\le\; 1.
$$

As $\theta \to 0^+$ the outer bound $\cos\theta \to 1$, so the squeeze forces
$(\sin\theta)/\theta \to 1$; because the ratio is an even function, the
two-sided limit is $1$ as well. The second limit follows by multiplying through
by the conjugate $\cos\theta + 1$:

$$
\frac{\cos\theta - 1}{\theta}
 = \frac{\cos^2\theta - 1}{\theta(\cos\theta + 1)}
 = -\frac{\sin\theta}{\theta}\cdot\frac{\sin\theta}{\cos\theta + 1}
 \longrightarrow -(1)\cdot\frac{0}{2} = 0.
$$

$$
% caption: Unit-circle squeeze for sin theta over theta. Triangle OAB, sector
% OAB, and triangle OAE nest, giving cos(theta) <= sin(theta)/theta <= 1.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.0]
\definecolor{acc}{HTML}{4A6FA5}
\coordinate (O) at (0,0);
\coordinate (A) at (2.6,0);
\coordinate (B) at (1.932,1.740);
\coordinate (C) at (1.932,0);
\coordinate (E) at (2.6,2.34);
\fill[acc!12] (O) -- (A) arc (0:42:2.6) -- cycle;
\draw[black, thick] (O) -- (E) -- (A);
\draw[black, thick] (O) -- (B);
\draw[acc, very thick] (A) arc (0:42:2.6);
\draw[black] (B) -- (C);
\draw[black] (1.932,0.2) -- (1.732,0.2) -- (1.732,0);
\fill[black] (O) circle (1.3pt) node[anchor=north east]{$O$};
\fill[black] (A) circle (1.3pt) node[anchor=north]{$A$};
\fill[black] (B) circle (1.3pt) node[anchor=south east]{$B$};
\fill[black] (C) circle (1.3pt) node[anchor=north]{$C$};
\fill[black] (E) circle (1.3pt) node[anchor=west]{$E$};
\node[black] at (0.45,1.0) {$1$};
\end{tikzpicture}
$$

Substituting these (with $\lim_{h\to0}\sin x = \sin x$ and
$\lim_{h\to0}\cos x = \cos x$) leaves

$$
\frac{\d}{\d x}\sin x = (\sin x)(0) + (\cos x)(1) = \cos x.
$$

The same method gives $\dfrac{\d}{\d x}\cos x = -\sin x$. Geometrically, the slope
of the sine wave at each point equals the height of the cosine wave: the same
curve shifted left by a quarter period.

$$
% caption: The derivative of sine is cosine. At every x the slope of sin x
% equals the height of cos x, the same wave shifted left by a quarter period.
\begin{tikzpicture}[>=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (-0.2,0) -- (6.9,0) node[right]{$x$};
\draw[black,->] (0,-1.45) -- (0,1.55);
\draw[black, very thick, domain=0:6.4, samples=130, variable=\x] plot ({\x},{sin(\x r)});
\draw[acc, thick, dashed, domain=0:6.4, samples=130, variable=\x] plot ({\x},{cos(\x r)});
\node[black, anchor=south] at (1.05,1.05) {$\sin x$};
\node[acc, anchor=south] at (4.15,1.05) {$\cos x$};
\end{tikzpicture}
$$

The tangent, cotangent, secant, and cosecant derivatives follow from the
Quotient Rule. For example,

$$
\frac{\d}{\d x}\tan x
 = \frac{\d}{\d x}\!\left(\frac{\sin x}{\cos x}\right)
 = \frac{\cos x \cos x - \sin x(-\sin x)}{\cos^2 x}
 = \frac{1}{\cos^2 x} = \sec^2 x.
$$

> **Worked example.** Differentiate $f(x) = \dfrac{\sec x}{1 + \tan x}$ and find
> where its graph has a horizontal tangent. The Quotient Rule gives
> $$
> f'(x)
>  = \frac{(1 + \tan x)\sec x \tan x - \sec x \sec^2 x}{(1 + \tan x)^2}
>  = \frac{\sec x\,(\tan x + \tan^2 x - \sec^2 x)}{(1 + \tan x)^2}.
> $$
> The identity $\tan^2 x + 1 = \sec^2 x$ collapses the bracket to $\tan x - 1$,
> so
> $$
> f'(x) = \frac{\sec x\,(\tan x - 1)}{(1 + \tan x)^2}.
> $$
> Because $\sec x$ is never zero, $f'(x) = 0$ exactly when $\tan x = 1$, that is
> at $x = \tfrac{\pi}{4} + n\pi$ for integer $n$.

The full table, valid only in radians, is worth memorizing; the minus signs
attach to the three cofunctions.

| $y$ | $y'$ | | $y$ | $y'$ |
| --- | --- | --- | --- | --- |
| $\sin x$ | $\cos x$ | | $\csc x$ | $-\csc x \cot x$ |
| $\cos x$ | $-\sin x$ | | $\sec x$ | $\sec x \tan x$ |
| $\tan x$ | $\sec^2 x$ | | $\cot x$ | $-\csc^2 x$ |

**Example.** For $y = x^2 \sin x$, the Product Rule gives
$y' = x^2 \cos x + 2x \sin x$.

The fundamental limit also resolves related trigonometric limits. To evaluate
$\lim_{x\to0}\tfrac{\sin 7x}{4x}$, arrange the argument to match:

$$
\lim_{x \to 0}\frac{\sin 7x}{4x}
 = \frac{7}{4}\lim_{x \to 0}\frac{\sin 7x}{7x}
 = \frac{7}{4}\cdot 1 = \frac{7}{4}.
$$

## The Chain Rule

The rules so far do not touch a function like $F(x) = \sqrt{x^2 + 1}$, which is a
**composite**: with $u = g(x) = x^2 + 1$ and $y = f(u) = \sqrt{u}$, it is
$F = f \circ g$. The chain rule differentiates the composition by multiplying the
two rates of change.

> **Theorem (Chain Rule).** If $g$ is differentiable at $x$ and $f$ is
> differentiable at $g(x)$, then $F = f \circ g$ is differentiable at $x$ and
> $$
> F'(x) = f'\bigl(g(x)\bigr)\,g'(x).
> $$
> In Leibniz notation, with $y = f(u)$ and $u = g(x)$,
> $$
> \frac{\d y}{\d x} = \frac{\d y}{\d u}\cdot\frac{\d u}{\d x}.
> $$

The Leibniz form is a mnemonic for rates: if $u$ changes twice as fast as $x$
and $y$ changes three times as fast as $u$, then $y$ changes six times as fast
as $x$. Multiplying $\d u$ formally cancels, though $\d u$ is not yet a genuine
quantity to divide by; a careful proof handles the case where the inner
increment $\Delta u$ can be zero.

$$
% caption: The chain rule multiplies rates along the composition. x drives u at
% rate g'(x), u drives y at rate f'(u), so y responds to x at their product.
\begin{tikzpicture}[>=stealth, font=\footnotesize,
  box/.style={draw, minimum width=15mm, minimum height=10mm, align=center}]
\definecolor{acc}{HTML}{4A6FA5}
\node (x) at (0,0) {$x$};
\node[box] (g) at (2,0) {$u=g(x)$};
\node (u) at (4.3,0) {$u$};
\node[box] (f) at (6.6,0) {$y=f(u)$};
\node (y) at (8.9,0) {$y$};
\draw[->, thick] (x) -- (g);
\draw[->, thick] (g) -- (u);
\draw[->, thick] (u) -- (f);
\draw[->, thick] (f) -- (y);
\node[black, anchor=north, font=\scriptsize] at (1.0,-0.45) {rate $g'(x)$};
\node[black, anchor=north, font=\scriptsize] at (5.45,-0.45) {rate $f'(u)$};
\node[anchor=north] at (4.45,-1.45) {$\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot\dfrac{du}{dx}$};
\end{tikzpicture}
$$

The procedure is: differentiate the outer function at the inner function, then
multiply by the derivative of the inner function.

> **Worked example.** For $F(x) = \sqrt{x^2 + 1}$, set the outer function
> $f(u) = \sqrt{u}$ and the inner function $u = x^2 + 1$. The outer derivative is
> $f'(u) = \tfrac{1}{2}u^{-1/2}$ and the inner derivative is $u' = 2x$, so
> $$
> F'(x) = f'(u)\,u' = \frac{1}{2\sqrt{u}}\cdot 2x = \frac{x}{\sqrt{x^2 + 1}}.
> $$

**Example.** Composing the sine derivative with the chain rule,
$\dfrac{\d}{\d x}\sin(x^2) = \cos(x^2)\cdot 2x = 2x\cos(x^2)$, while
$\dfrac{\d}{\d x}\sin^2 x = 2\sin x \cdot \cos x = \sin 2x$: the first squares
inside the sine, the second squares outside it.

### The Power Rule combined with the Chain Rule

The most common composite is a function raised to a power. With $u = g(x)$,

$$
\frac{\d}{\d x}\bigl[g(x)\bigr]^n = n\bigl[g(x)\bigr]^{n-1}\,g'(x).
$$

**Example.** $\dfrac{\d}{\d x}(x^3 - 1)^{100} = 100(x^3 - 1)^{99}\cdot 3x^2
= 300 x^2 (x^3 - 1)^{99}$.

Longer compositions chain more links. For $y = f(u)$, $u = g(x)$, $x = h(t)$,

$$
\frac{\d y}{\d t} = \frac{\d y}{\d u}\cdot\frac{\d u}{\d x}\cdot\frac{\d x}{\d t}.
$$

> **Worked example.** Differentiate $f(x) = \sin(\cos(\tan x))$, a
> three-layer composite. Peel from the outside in: the sine differentiates to a
> cosine evaluated at $\cos(\tan x)$, times the derivative of $\cos(\tan x)$,
> which is $-\sin(\tan x)$ times the derivative of $\tan x$:
> $$
> f'(x) = \cos\bigl(\cos(\tan x)\bigr)\cdot\bigl(-\sin(\tan x)\bigr)\cdot\sec^2 x.
> $$
> Each factor is the derivative of one link, evaluated at the link below it.

The Power Rule is a statement about how steepness scales with the exponent:
higher powers sit flatter near the origin and climb faster past $x = 1$, exactly
as their derivatives $n x^{n-1}$ predict.

$$
% caption: Power functions x^n. Higher powers start flatter near 0 and steepen
% faster past x = 1, matching their derivatives n x^(n-1) from the Power Rule.
\begin{tikzpicture}[>=stealth, font=\footnotesize, scale=1.9]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,->] (0,0) -- (1.35,0) node[right]{$x$};
\draw[black,->] (0,0) -- (0,1.65) node[above]{$y$};
\draw[black, thick, domain=0:1.15, samples=60, variable=\x] plot ({\x},{\x});
\draw[black, thick, domain=0:1.15, samples=60, variable=\x] plot ({\x},{\x*\x});
\draw[acc, thick, domain=0:1.15, samples=60, variable=\x] plot ({\x},{\x*\x*\x});
\node[black, anchor=west, font=\scriptsize] at (1.16,1.15) {$x$};
\node[black, anchor=west, font=\scriptsize] at (1.16,1.30) {$x^2$};
\node[acc, anchor=south east, font=\scriptsize] at (1.0,1.52) {$x^3$};
\end{tikzpicture}
$$

