AP Calculus AB and BC

Chain Rule Cheat Sheet: Outside-Inside Patterns

The chain rule says the derivative of f(g(x)) is f'(g(x)) times g'(x): differentiate the outside function with the inside left unchanged, then multiply by the derivative of the inside. Every basic derivative has a chain version, such as the derivative of sin(u) being cos(u) times u'.

The rule in both notations

ddx[f(g(x))]=f′(g(x))⋅g′(x)dydx=dydu⋅dudx\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x) \qquad \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}
  1. Find the outside function: the last operation you would perform when evaluating at a number.
  2. Differentiate the outside function and leave the inside exactly as it is.
  3. Multiply by the derivative of the inside. If the inside is itself a composition, repeat.

The full explanation of how to spot a composition is in the chain rule guide, and the chain rule trainer gives practice on naming the layers. This sheet lists the patterns. In every table, uu is a function of xx and u′u' is its derivative.

Outside-inside pattern for each function family

Outside functionDerivativeExample
unu^nnun−1⋅u′n u^{n-1} \cdot u'(x2+1)5→10x(x2+1)4(x^2 + 1)^5 \to 10x(x^2 + 1)^4
u\sqrt{u}u′2u\frac{u'}{2\sqrt{u}}3x+1→323x+1\sqrt{3x + 1} \to \frac{3}{2\sqrt{3x + 1}}
1u\frac{1}{u}−u′u2-\frac{u'}{u^2}1x2+4→−2x(x2+4)2\frac{1}{x^2 + 4} \to -\frac{2x}{(x^2 + 4)^2}
eue^ueu⋅u′e^u \cdot u'e−x2→−2xe−x2e^{-x^2} \to -2x e^{-x^2}
aua^uauln⁡a⋅u′a^u \ln a \cdot u'23x→3ln⁡2⋅23x2^{3x} \to 3\ln 2 \cdot 2^{3x}
ln⁡u\ln uu′u\frac{u'}{u}ln⁡(x2+1)→2xx2+1\ln(x^2 + 1) \to \frac{2x}{x^2 + 1}
log⁡au\log_a uu′uln⁡a\frac{u'}{u \ln a}log⁡2(5x)→1xln⁡2\log_2(5x) \to \frac{1}{x \ln 2}
sin⁡u\sin ucos⁡u⋅u′\cos u \cdot u'sin⁡(5x)→5cos⁡(5x)\sin(5x) \to 5\cos(5x)
cos⁡u\cos u−sin⁡u⋅u′-\sin u \cdot u'cos⁡(x3)→−3x2sin⁡(x3)\cos(x^3) \to -3x^2\sin(x^3)
tan⁡u\tan usec⁡2u⋅u′\sec^2 u \cdot u'tan⁡(2x)→2sec⁡2(2x)\tan(2x) \to 2\sec^2(2x)
cot⁡u\cot u−csc⁡2u⋅u′-\csc^2 u \cdot u'cot⁡(3x)→−3csc⁡2(3x)\cot(3x) \to -3\csc^2(3x)
sec⁡u\sec usec⁡utan⁡u⋅u′\sec u \tan u \cdot u'sec⁡(4x)→4sec⁡(4x)tan⁡(4x)\sec(4x) \to 4\sec(4x)\tan(4x)
csc⁡u\csc u−csc⁡ucot⁡u⋅u′-\csc u \cot u \cdot u'csc⁡(x2)→−2xcsc⁡(x2)cot⁡(x2)\csc(x^2) \to -2x\csc(x^2)\cot(x^2)
arcsin⁡u\arcsin uu′1−u2\frac{u'}{\sqrt{1 - u^2}}arcsin⁡(2x)→21−4x2\arcsin(2x) \to \frac{2}{\sqrt{1 - 4x^2}}
arccos⁡u\arccos u−u′1−u2-\frac{u'}{\sqrt{1 - u^2}}arccos⁡(x2)→−2x1−x4\arccos(x^2) \to -\frac{2x}{\sqrt{1 - x^4}}
arctan⁡u\arctan uu′1+u2\frac{u'}{1 + u^2}arctan⁡(3x)→31+9x2\arctan(3x) \to \frac{3}{1 + 9x^2}

The unchained versions of these derivatives are in the derivative rules reference table.

More than one layer, and chains inside other rules

Each layer contributes one factor. Work from the outside in and do not change an inside while differentiating the layer around it.

FunctionStructure, outside inDerivative
esin⁡(2x)e^{\sin(2x)}exponential, sine, 2x2x2cos⁡(2x) esin⁡(2x)2\cos(2x)\,e^{\sin(2x)}
cos⁡3(4x)\cos^3(4x)cube, cosine, 4x4x−12cos⁡2(4x)sin⁡(4x)-12\cos^2(4x)\sin(4x)
ln⁡(cos⁡x)\ln(\cos x)natural log, cosine−sin⁡xcos⁡x=−tan⁡x\frac{-\sin x}{\cos x} = -\tan x
1+e2x\sqrt{1 + e^{2x}}square root, 1+e2x1 + e^{2x}, 2x2xe2x1+e2x\frac{e^{2x}}{\sqrt{1 + e^{2x}}}
xe−2xx e^{-2x}product, with a chain in the second factore−2x−2xe−2x=(1−2x)e−2xe^{-2x} - 2x e^{-2x} = (1 - 2x)e^{-2x}
(xx+1)3\left(\frac{x}{x + 1}\right)^3cube, with a quotient inside3(xx+1)2⋅1(x+1)2=3x2(x+1)43\left(\frac{x}{x + 1}\right)^2 \cdot \frac{1}{(x + 1)^2} = \frac{3x^2}{(x + 1)^4}

Notation check

cos⁡3(4x)\cos^3(4x) means [cos⁡(4x)]3[\cos(4x)]^3, so the outside function is the cube. cos⁡(4x3)\cos(4x^3) has cosine on the outside. Read the notation before choosing the outside function.

Implicit differentiation: the chain rule on y

When yy is a function of xx, every expression in yy is a composition with yy on the inside, so its derivative carries a factor of dydx\frac{dy}{dx}. In related rates the variable is tt and every quantity carries its own rate.

TermDerivative with respect to xxRule used
y2y^22y dydx2y\,\frac{dy}{dx}Chain
yny^nnyn−1 dydxn y^{n-1}\,\frac{dy}{dx}Chain
xyxyx dydx+yx\,\frac{dy}{dx} + yProduct, then chain
x2y3x^2 y^32xy3+3x2y2 dydx2x y^3 + 3x^2 y^2\,\frac{dy}{dx}Product, then chain
sin⁡y\sin ycos⁡y dydx\cos y\,\frac{dy}{dx}Chain
eye^yey dydxe^y\,\frac{dy}{dx}Chain
ln⁡y\ln y1y dydx\frac{1}{y}\,\frac{dy}{dx}Chain
exye^{xy}exy(x dydx+y)e^{xy}\left(x\,\frac{dy}{dx} + y\right)Chain, with a product inside
TermDerivative with respect to ttWhere it shows up
x2x^22x dxdt2x\,\frac{dx}{dt}Pythagorean related rates
r3r^33r2 drdt3r^2\,\frac{dr}{dt}Sphere volume
r2hr^2 h2rh drdt+r2 dhdt2rh\,\frac{dr}{dt} + r^2\,\frac{dh}{dt}Cylinder or cone volume with both changing
tan⁡θ\tan\thetasec⁡2θ dθdt\sec^2\theta\,\frac{d\theta}{dt}Angle of elevation

Full methods are in implicit differentiation and related rates.

Inverse functions and table problems

If g=f−1g = f^{-1}, then f(g(x))=xf(g(x)) = x. Differentiating both sides with the chain rule gives f′(g(x))⋅g′(x)=1f'(g(x)) \cdot g'(x) = 1, which is the inverse function formula (Topic 3.3), valid when f′(g(a))≠0f'(g(a)) \neq 0:

g′(a)=1f′(g(a))g'(a) = \frac{1}{f'(g(a))}
GivenAsked forCompute
h(x)=f(g(x))h(x) = f(g(x)) and a table of valuesh′(a)h'(a)f′(g(a))⋅g′(a)f'(g(a)) \cdot g'(a). Look up f′f' at g(a)g(a), not at aa.
h(x)=[g(x)]nh(x) = [g(x)]^nh′(a)h'(a)n[g(a)]n−1⋅g′(a)n[g(a)]^{n-1} \cdot g'(a)
h(x)=f(kx)h(x) = f(kx) for a constant kkh′(a)h'(a)k⋅f′(ka)k \cdot f'(ka)
g=f−1g = f^{-1} and f(b)=af(b) = ag′(a)g'(a)1f′(b)\frac{1}{f'(b)}

The inverse trig derivatives come from this same formula. See inverse function derivatives.

Common slips

  • Stopping after the outside derivative. The derivative of ln⁡(x2+1)\ln(x^2 + 1) is 2xx2+1\frac{2x}{x^2 + 1}, and 1x2+1\frac{1}{x^2 + 1} alone is missing the factor 2x2x.
  • Differentiating the inside in place. The derivative of (x2+1)5(x^2 + 1)^5 keeps x2+1x^2 + 1 inside the fourth power. It is not 5(2x)45(2x)^4.
  • Missing the chain rule on a constant multiple of xx. The derivative of e3xe^{3x} is 3e3x3e^{3x} and the derivative of sin⁡(5x)\sin(5x) is 5cos⁡(5x)5\cos(5x).
  • Evaluating at the wrong input in a table problem. In f′(g(a))⋅g′(a)f'(g(a)) \cdot g'(a), the outside derivative is evaluated at g(a)g(a).
  • Leaving off dydx\frac{dy}{dx} on a yy term in an implicit equation, or forgetting that xyxy needs the product rule.
  • Applying the chain rule where there is no composition. The derivative of xsin⁡xx \sin x needs the product rule only.

Worked examples

Worked example

Three layers

Differentiate f(x)=ln⁡(sin⁡(x2))f(x) = \ln(\sin(x^2)).

  1. Name the layers from the outside in: natural log, then sine, then x2x^2.
  2. Outside layer: the derivative of ln⁡u\ln u is 1u\frac{1}{u}, giving 1sin⁡(x2)\frac{1}{\sin(x^2)} with the inside unchanged.
  3. Middle layer: the derivative of sin⁡u\sin u is cos⁡u\cos u, giving cos⁡(x2)\cos(x^2).
  4. Inside layer: the derivative of x2x^2 is 2x2x.
  5. Multiply the three factors: f′(x)=1sin⁡(x2)⋅cos⁡(x2)⋅2x=2xcos⁡(x2)sin⁡(x2)f'(x) = \frac{1}{\sin(x^2)} \cdot \cos(x^2) \cdot 2x = \frac{2x\cos(x^2)}{\sin(x^2)}.

f′(x)=2xcot⁡(x2)f'(x) = 2x\cot(x^2)

Worked example

Implicit differentiation at a point

Find dydx\frac{dy}{dx} at the point (2,1)(2, 1) on the curve x2+xy+y3=7x^2 + xy + y^3 = 7.

  1. Confirm the point is on the curve: 4+2+1=74 + 2 + 1 = 7.
  2. Differentiate each term with respect to xx. The term xyxy needs the product rule and y3y^3 needs the chain rule: 2x+x dydx+y+3y2 dydx=02x + x\,\frac{dy}{dx} + y + 3y^2\,\frac{dy}{dx} = 0.
  3. Collect the dydx\frac{dy}{dx} terms: dydx(x+3y2)=−(2x+y)\frac{dy}{dx}\left(x + 3y^2\right) = -(2x + y), so dydx=−2x+yx+3y2\frac{dy}{dx} = -\frac{2x + y}{x + 3y^2}.
  4. Substitute x=2x = 2 and y=1y = 1: dydx=−4+12+3=−1\frac{dy}{dx} = -\frac{4 + 1}{2 + 3} = -1.

dydx=−1\frac{dy}{dx} = -1 at (2,1)(2, 1)

Worked example

Chain rule from a table of values

Suppose g(1)=3g(1) = 3, g′(1)=−2g'(1) = -2, and f′(3)=4f'(3) = 4. Let h(x)=f(g(x))h(x) = f(g(x)) and k(x)=[g(x)]2k(x) = [g(x)]^2. Find h′(1)h'(1) and k′(1)k'(1).

  1. For hh, the chain rule gives h′(1)=f′(g(1))⋅g′(1)h'(1) = f'(g(1)) \cdot g'(1).
  2. Since g(1)=3g(1) = 3, the outside derivative is f′(3)=4f'(3) = 4. So h′(1)=4⋅(−2)=−8h'(1) = 4 \cdot (-2) = -8.
  3. For kk, the outside function is squaring: k′(x)=2g(x)⋅g′(x)k'(x) = 2g(x) \cdot g'(x).
  4. Substitute: k′(1)=2⋅3⋅(−2)=−12k'(1) = 2 \cdot 3 \cdot (-2) = -12.

h′(1)=−8h'(1) = -8 and k′(1)=−12k'(1) = -12

Frequently asked questions

How do I know which function is the outside function?

Imagine evaluating the expression at a number and note the last operation you would perform. That operation is the outside function. For 1+e2x\sqrt{1 + e^{2x}} the last step is the square root, so the square root is outside and 1+e2x1 + e^{2x} is inside.

Why does y2y^2 differentiate to 2y dydx2y\,\frac{dy}{dx} in implicit differentiation?

Because yy stands for a function of xx, so y2y^2 is a composition with squaring on the outside and yy on the inside. The chain rule gives the outside derivative 2y2y times the inside derivative dydx\frac{dy}{dx}. A plain x2x^2 gives only 2x2x because the derivative of xx with respect to xx is 11.

Do I need the chain rule when the inside is just a constant times x?

Yes. The inside kxkx has derivative kk, and that factor must appear. The derivative of cos⁡(4x)\cos(4x) is −4sin⁡(4x)-4\sin(4x), and the derivative of e−xe^{-x} is −e−x-e^{-x}.