Rules of Differentiation

☰ Contents

Differentiating from first principles is slow. Each rule is that limit worked out once for one shape of expression. The skill is recognizing the shape: a power, a product, a quotient, or a function inside another function.

What does dy/dx actually mean?

dy/dx is the rate at which y changes as x changes at one instant: the gradient of the tangent at a point. To find it, take a chord's gradient and let the chord shrink. Take y = x²: the chord from x to x + h rises by (x + h)² − x², which is 2xh + h², and dividing by the run h leaves 2x + h. As h shrinks to 0 this settles on 2x, so at x = 3 the gradient is 6. The value is exact, not an estimate: every chord gradient is 2x + h, and 2x is the only number all of them approach. A cube needs more algebra but no new idea, since (x + h)³ − x³ divided by h is 3x² + 3xh + h², which settles on 3x². As a check, the chord from 3 to 5 has gradient (25 − 9) ÷ 2 = 8, which is 6 + 2, the gradient plus h.

12345510152025xyh = 2(4, 16)(2, 4)

the chord’s gradient exceeds f ′(2) by exactly h

Drag the upper point along the curve

hrise
The derivative is where that swinging settles: a limit, not an approximation. Full lesson: The Derivative As a Limit

Leibniz wrote it dy/dx and Lagrange wrote f'(x), read "f prime". On its own, d/dx is an instruction: differentiate whatever follows it.

From first principles, write the rise over a step h, divide by h, simplify, and only then let h go to 0.

f(x) and f(x + h)the rise across a step of width hf(x + h) − f(x)rise over run — the difference quotient
Every first-principles derivation starts here: the rise over a step h, divided by h. Full lesson: Differentiating From First Principles

See The derivative as a limit, Derivative notation and Differentiating from first principles.

Where does a derivative fail to exist?

A derivative fails to exist wherever the curve has no single tangent: at a corner, at a vertical tangent, or at a break. Take y = |x| at 0. A chord from 0 to h has gradient |h| ÷ h, which is 1 for every positive h and −1 for every negative h. The two sides approach different values, and a derivative is one limit, which exists only when both sides agree. A vertical tangent fails another way. For the cube root of x at 0, the chord to 8 has gradient 2 ÷ 8 = 1/4, the chord to 1 has gradient 1, and the chord to 1/8 has gradient 4, so the values grow without bound. At a jump the function is not even continuous, and the chord gradients blow up there too. Away from the corner, |x| is a straight line, and the chord from 2 to 3 has gradient 3 − 2 = 1, which is its derivative there.

xyleft: −1right: 1h = 1y = |x|y = x^(2/3)y = x²/2−2−112

the gradient is −1 from the left and +1 from the right for every h, so no single value fits: f′(0) does not exist

Shrink h on each curve and see whether the two gradients meet

xy
The two sides of this corner have gradients −1 and +1, so no single value fits. Full lesson: Where a Derivative Fails to Exist
xy
y = ∛x stands vertical at 0, and a vertical tangent has no gradient value. Full lesson: Where a Derivative Fails to Exist
xy
Across a jump, the chords grow steeper without limit as they shrink, so no derivative exists. Full lesson: Where a Derivative Fails to Exist

y = |x| has no derivative at 0. The gradient is −1 on the left and +1 on the right.

Differentiable is stronger than continuous: a function with a derivative at a point is continuous there. The reverse fails, as y = |x| at 0 shows. See Where a derivative fails to exist.

What is the power rule?

The power rule says xⁿ differentiates to nxⁿ⁻¹: bring the power down to multiply, then lower the power by one. For y = x⁴, dy/dx = 4x³, and at x = 2 the gradient is 4 × 2³ = 32. A number in front stays in front, so 5x³ becomes 15x², and a sum is differentiated term by term. The rule comes from first principles: expanding (x + h)ⁿ gives xⁿ + nxⁿ⁻¹h plus terms in h² and higher, so the chord gradient is nxⁿ⁻¹ plus terms that still carry h, and those vanish in the limit. The rule holds for every real power, so roots and reciprocals take one extra first step: rewrite them as powers. So 1/x² is x⁻², which becomes −2x⁻³. A constant has derivative 0, since 5 is 5x⁰. To check, the chord of x⁴ from 2 to 3 has gradient 81 − 16 = 65, well above 32 because the curve steepens.

x³ = 83x²Δx = 7.23xΔx² = 2.16Δx³ = 0.22Δx = 0.6

divided by Δx: 3x² + 3xΔx + Δx² = 15.96; the rods carry the 3xΔx and the corner the Δx², and both vanish with Δx

Shrink Δx to 0 and count what survives

3x23
and only now does the power drop by one
Now the power itself drops by one. Two moves, in that order: 3x squared. Full lesson: The Power Rule

x⁵ → 5x⁴. 1/x = x⁻¹ → −x⁻² = −1/x². √x = x^(1/2) → (1/2)x^(−1/2) = 1/(2√x).

Rewrite a reciprocal or a root as a power first, then run the same two moves.

the power comes down, then drops by one
written back with the root
Roots are powers in disguise: √x is x to the half, and the same two moves run. Full lesson: The Power Rule

A straight line y = mx + c has gradient m everywhere, so its derivative is m.

xy
A flat line has gradient 0, which is why the derivative of a constant is 0. Full lesson: Differentiating Linear Functions

So 4x³ − 7x + 2 differentiates to 12x² − 7, by the sum and constant multiple rules. See The power rule, Differentiating linear functions and The constant multiple and sum rules.

Now you

differentiate it

Differentiate 6x^2

differentiate it

Differentiate √x

When do you use the product rule?

Use the product rule when two functions of x are multiplied together. If y = uv, then dy/dx = u dv/dx + v du/dx: differentiate each factor in turn, leave the other alone, and add. For y = x² sin x, take u = x² and v = sin x, so dy/dx = x² cos x + 2x sin x. The rule works because small changes in the factors grow the rectangle uv by two strips, u times the change in v and v times the change in u, plus a corner that vanishes when divided by the step. Three factors give three terms, each with one factor differentiated. A fraction u/v calls for the quotient rule, whose numerator is a subtraction, so its order matters. Test it on y = x × x³: the rule gives x³ + 3x³, which is 4x³, the derivative of x⁴, and at x = 1 the two terms add as 1 + 3 = 4.

u × v = 12v·Δuu·ΔvΔu·Δv = 2.56u = 4v = 3corner share 18.6%

the two strips shrink in proportion to Δu and Δv, but the corner Δu·Δv shrinks faster, so it vanishes from the derivative; here it is 18.6%

Shrink both changes until the corner is under 5% of the growth

uvdu·vu·dvvanishesuv
Grow a u by v rectangle a little and it gains a strip along each side. Full lesson: The Product Rule

y = x² sin x → x² cos x + 2x sin x.

The derivative of a product is not the product of the derivatives. Check with x · x: 1 × 1 = 1, but x² differentiates to 2x.

For a fraction u/v, the quotient rule: dy/dx = (vu′ − uv')/v².

the order mattersswap the two terms and the sign of the answer flipssubtraction, not addition
Unlike the product rule, swapping the two terms changes the sign of the answer. Full lesson: The Quotient Rule

If the denominator is a single power, use the power rule instead: 3/x² = 3x⁻² → −6x⁻³. See The product rule and The quotient rule.

Now you

what does this come to?

d/dx of x·x³

what does this come to?

d/dx of x·x², using the product rule

When do you use the chain rule?

Use the chain rule whenever one function sits inside another: differentiate the outer function with the inside left alone, then multiply by the derivative of the inside. For y = (x² + 1)³, the outer function is a cube and the inside is x² + 1, so dy/dx = 3(x² + 1)² × 2x. At x = 1 the gradient is 6 × 2² = 24. In Leibniz notation, dy/dx = dy/du × du/dx with u the inside, and the rates multiply because a step in x is scaled once on the way to u and again on the way to y. Deeper nesting adds one factor per layer, so sin²(3x) differentiates to 2 sin(3x) × cos(3x) × 3. A linear inside contributes just its coefficient. To confirm the first result, expand the cube to x⁶ + 3x⁴ + 3x² + 1, differentiate to 6x⁵ + 12x³ + 6x, and put x = 1: 6 + 12 + 6 = 24.

x02.51.25× 2u163.5× 2u = 7y13612.25

a step in x is doubled on the way to u and multiplied by 2u on the way to y, so the rates multiply: dy/dx = 14

Make dy/dx equal 12

  1. Read the expression as "do this, then do that". (3x + 1)⁵ means add 1 to 3x, then raise the result to the fifth power.
  2. Differentiate the outer layer, keeping the inside as it stands: 5(3x + 1)⁴.
  3. Multiply by the derivative of the inside, which is 3: 15(3x + 1)⁴.
× 3
finally, times the derivative of the inside
Finally multiply by the inside’s own derivative, which is 3. That gives 15. Full lesson: The Chain Rule

sin(x²) → cos(x²) × 2x.

The final multiplication is the step most often left out.

u = 3x + 1, so
the gradient in u, times the rate at which u changes
The inside changes 3 times as fast as x, so a gradient in u is 3 times steeper in x. Full lesson: The Chain Rule

x² sin xsin(x²)(ln x) / xx⁵ − 3xpower ruleproduct rulequotient rulechain rulex² sin x

read the structure first: a product u·v, a quotient u/v, a composite f(g(x)), or a power xⁿ

Drag the expression into the rule that differentiates it

See The chain rule.

Now you

sin(3x)differentiate it

Differentiate sin(3x)

differentiate it

Differentiate (3x + 1)^3

How do you differentiate trigonometric functions?

Sine differentiates to cosine, and cosine to negative sine, provided the angle is in radians. So y = 3 sin x + 2 cos x has derivative 3 cos x − 2 sin x, and its gradient at x = 0 is 3 × 1 − 2 × 0 = 3. Four differentiations return to sine: sin, cos, −sin, −cos, sin. The rule rests on one limit, sin h / h approaching 1 as h shrinks, which holds only in radians. Expanding sin(x + h), subtracting sin x and dividing by h then leaves exactly cos x. In degrees that limit is π/180, and every derivative would carry the factor. A coefficient on the angle brings in the chain rule, so sin 5x differentiates to 5 cos 5x, not cos 5x. The graph agrees: sine peaks at π/2, where its tangent is flat and cosine is 0, and it climbs through the origin with gradient cos 0 = 1.

θ = 60°0.87sin θheight0.5cos θup speed

the height is sin θ and the upward part of the velocity (−sin θ, cos θ) is cos θ: d(sin θ)/dθ = cos θ

Rotate to θ = 0 and compare the height with the upward speed

xy
Where sine is steepest cosine peaks, and where sine peaks cosine crosses zero. Full lesson: Differentiating Trigonometric Functions
sin xcos x−sin x−cos x
Four differentiations bring you back to where you started: one closed cycle. Full lesson: Differentiating Trigonometric Functions

The proof uses the limit of sin x / x from limits and continuity.

tan x = sin x / cos x, so the quotient rule applies. The numerator is cos²x + sin²x, which is 1, and 1 / cos²x is sec²x.

sin² + cos² = 1
the reciprocal of cosine, squared
The numerator is 1 by Pythagoras, and 1 over cos²x has a name: sec²x. Full lesson: Differentiating tan x and the Reciprocal Ratios

The same route gives sec x → sec x tan x, cosec x → −cosec x cot x and cot x → −cosec²x. See Differentiating trigonometric functions and Differentiating tan x and the reciprocal ratios.

Now you

xy

Differentiate −sin x

xy

Differentiate sin x

What is e, and why does it matter?

e is the number, about 2.718, for which y = eˣ has a gradient equal to its height at every point, so eˣ differentiates to itself. Every exponential bˣ has a gradient proportional to its height; the constant is below 1 for 2ˣ and above 1 for 3ˣ, and e is the base between them where it is exactly 1. This matters because growth at a rate proportional to size, as in populations and cooling, is written with eˣ and no stray constant, and its inverse, ln x, has the simple derivative 1/x. Any other base is e in disguise, since bˣ = e^(x ln b), so the chain rule gives the derivative bˣ ln b. A coefficient in the power multiplies through: e^(3x) differentiates to 3e^(3x). The tangent shows it: because gradient equals height, every tangent meets the x-axis one unit to the left of its point, so the tangent at x = 1 crosses at 1 − 1 = 0.

xy1ln b = 1.1b = 3y = 3ˣ−1121234

ln b > 1: the tangent rises more than the height 1, so bˣ grows faster than its own size — lower b

Adjust b until the tangent at (0, 1) has gradient 1

xy
Somewhere near 2.718 the two match exactly. That number is called e. Full lesson: The Number E

For ln x, write eʸ = x and differentiate both sides: eʸ dy/dx = 1, so dy/dx = 1/eʸ = 1/x.

y = ln x, so
differentiate both sides; chain rule on the left
and e^y is x again
Undo the log: e to the y is x, so differentiating both sides gives 1 over x. Full lesson: Differentiating Exponentials and Logarithms

The logarithm to any base a is ln x / ln a, so logₐ x differentiates to 1/(x ln a).

e^(x ln a) written back as aˣ
Write it back with base a: the derivative of aˣ is aˣ times ln a. Full lesson: Differentiating aˣ and logₐ x

See The number e, Differentiating exponentials and logarithms and Differentiating aˣ and logₐ x.

What if the equation is not solved for y?

Differentiate every term as it stands, with respect to x, then solve for dy/dx; this is implicit differentiation. A term in y differentiates as usual and gains a factor of dy/dx, by the chain rule, because y depends on x. For the circle x² + y² = 25, this gives 2x + 2y dy/dx = 0, so dy/dx = −x/y, and at (3, 4) the gradient is −3/4. The geometry agrees: the radius to (3, 4) has gradient 4/3, the tangent is perpendicular to it, and (4/3) × (−3/4) = −1. A term holding both letters needs the product rule. For xy = 12, differentiating gives y + x dy/dx = 0, so dy/dx = −y/x, which is −4/3 at (3, 4). Rearranging first is never required, and a curve such as y⁵ + y = x cannot be rearranged at all. Both curves pass through (3, 4), since 9 + 16 = 25 and 3 × 4 = 12.

(3.8, 3.2)x = 3.83y = 3.21dy/dx = −1.19−5−555

x and y share a sign, so −x/y < 0: the tangent falls, perpendicular to the radius of gradient y/x

Find the points where the tangent has gradient +1

r
x² + y² = 25 is a circle, and no rearranging writes y as a single function of x. Full lesson: Implicit Differentiation

Collect the dy/dx terms on one side before solving.

y2
power rule on y — then the inside derivative arrives
Differentiate y-terms as usual, then multiply by dy/dx — that is the chain rule. Full lesson: Implicit Differentiation

x² + y² = 25 → 2x + 2y dy/dx = 0 → dy/dx = −x/y.

See Implicit differentiation.

Now you

differentiate both sides, then solve for

3x² + y² = 4. What is dy/dx?

differentiate both sides, then solve for

4x² + y² = 7. What is dy/dx?

How do you differentiate an inverse function?

An inverse function has the reciprocal gradient at the matching point: if f(a) = b, then (f⁻¹)'(b) = 1 / f'(a). Take f(x) = x³, with f(2) = 8. The gradient of x³ at 2 is 3 × 2² = 12, so the cube root has gradient 1/12 at 8. This works because the inverse is the reflection of the original in the line y = x, and that reflection swaps rise with run, turning every gradient upside down. The same step gives ln x from eˣ: eˣ has gradient e² at (2, e²), so ln x has gradient 1/e² at x = e², which is 1/x there. The rule breaks down where f'(a) = 0: x³ is flat at 0, so the cube root has a vertical tangent there. Differentiating the cube root directly as x^(1/3) gives (1/3)x^(−2/3), and at 8 that is (1/3) × (1/4) = 1/12.

y = xy = x³y = ∛xslope 0.17slope 5.88

the inverse is the reflection in y = x, so its tangent is the reflected tangent and the slopes are reciprocals: f′(a) × (f⁻¹)′(f(a)) = 1

Drag the point and try to make the product of the two slopes anything but 1

rise / runreflecting swaps the rise with the runrun / rise
The reflection swaps the rise with the run, so every gradient becomes its reciprocal. Full lesson: The Derivative of an Inverse Function

For sin⁻¹ x, undo the inverse first: sin y = x. Differentiate both sides: cos y dy/dx = 1, so dy/dx = 1 / cos y, and Pythagoras replaces cos y with √(1 − x²).

sin y = xfrom sin²y + cos²y = 1
sin y is x
The answer should be in terms of x: Pythagoras replaces cos y with √(1 − x²). Full lesson: Differentiating sin⁻¹ x and tan⁻¹ x

The same moves on tan y = x give 1/(1 + x²). Both derivatives are algebraic, so an integral of that shape has an inverse-trigonometric answer.

Differentiate again and you get the second derivative, f''(x) or d²y/dx²: the rate at which the gradient changes. For y = x², the gradient 2x differentiates to 2.

2x1
2apply the power rule again, to 2x
Differentiating again gives 2: the gradient grows at a steady rate. Full lesson: Higher Derivatives

A positive second derivative means the curve bends upward, like a bowl, which is the test for maxima and minima in the applications of differentiation. See The derivative of an inverse function, Differentiating sin⁻¹ x and tan⁻¹ x and Higher derivatives.

What are the hyperbolic functions?

The hyperbolic functions are built from exponentials: cosh x = (eˣ + e⁻ˣ)/2, sinh x = (eˣ − e⁻ˣ)/2, and tanh x = sinh x / cosh x. Since e⁰ is 1, cosh 0 = 1 and sinh 0 = 0. Differentiating straight from eˣ, sinh x gives cosh x, and cosh x gives sinh x, with no minus sign, unlike cosine. The name comes from cosh²x − sinh²x = 1: the point (cosh t, sinh t) lies on the hyperbola x² − y² = 1, as (cos t, sin t) lies on the circle x² + y² = 1. Most identities copy the trigonometric ones, but by Osborn's rule the sign changes wherever a product of two sines appears, so cos 2x = 1 − 2 sin²x becomes cosh 2x = 1 + 2 sinh²x. Try x = ln 2: then eˣ = 2 and e⁻ˣ = 1/2, so cosh x = 5/4 and sinh x = 3/4, and 25/16 − 9/16 = 1.

x² + y² = 1area = t/2 = 0.75x² − y² = 1area = t/2 = 0.75(cosh t, sinh t) = (2.35, 2.13)t = 1.5

the hyperbolic sector and the circular sector both have area t/2, so t is an angle for the hyperbola: (cosh t, sinh t) is to x² − y² = 1 what (cos t, sin t) is to x² + y² = 1

Sweep t until both sectors have area ½

and
the half that is unchanged by −x
the half that changes sign
Average eˣ with e⁻ˣ and you get cosh; take half their difference and you get sinh. Full lesson: sinh, cosh and tanh

A chain hanging under its own weight follows a cosh curve, called a catenary.

To prove cosh²x − sinh²x = 1, square the two definitions: the squares of eˣ and e⁻ˣ cancel in the subtraction, and the middle terms, 1/2 and −1/2, leave 1.

xy
One sign changes, and (cosh t, sinh t) lies on a hyperbola. That is where the name comes from. Full lesson: The Identity cosh²x − sinh²x = 1

tanh x differentiates to 1 / cosh²x, which is sech²x.

of
no minus sign, unlike cosine
so
Differentiate cosh the same way. Unlike cosine, no minus sign appears at all. Full lesson: Differentiating sinh x and cosh x

The inverses are logarithms. Write x = sinh y, multiply every term by eʸ to get a quadratic in eʸ, solve it, reject the negative root, and take logarithms: arsinh x = ln(x + √(x² + 1)). arcosh keeps only x ≥ 0, because cosh takes each value above 1 twice. See sinh, cosh and tanh, The identity cosh²x − sinh²x = 1, Differentiating sinh x and cosh x, Inverse hyperbolic functions and Inverse hyperbolics as logarithms.

The mistakes worth naming

x² = 4u′v′·Δxx·Δxx·Δxx = 2(uv)′ = 2x = 4u′v′ = 1missing: 2x − 1 = 3

the true increase is two strips of length x, so (uv)′ = 2x = 4; the fallacy u′v′ = 1 accounts for one unit of it and misses 2x − 1 = 3

Take x to 4 and compare the true increase with u′v′

The limit behind these rules is in limits and continuity, using a derivative is the applications of differentiation, and running each rule backward is techniques of integration. Related guides: Partial Differentiation.

Your turn

Three to try — tap what you get.

d/dx of x³

d/dx of sin x

The derivative of a constant is

Questions and answers

What does dy/dx actually mean?
It is the rate at which y changes as x changes, at one particular instant. It began life as a ratio of two tiny differences and became the limit of that ratio as the differences shrink toward zero, so the answer is exact rather than approximate. On a graph it is the gradient of the tangent at a point; in physics, if y is distance and x is time, it is speed.
When do you use the chain rule?
Whenever one function sits inside another. If you can describe the expression as do this, then do that — square it, then take the sine — the chain rule applies. Differentiate the outer function leaving the inside alone, then multiply by the derivative of the inside. Anything with a bracket raised to a power, or a function of anything more complicated than plain x, needs it.
What is the product rule?
For two functions multiplied together, the derivative is the first times the derivative of the second, plus the second times the derivative of the first. It exists because derivatives do not distribute over multiplication: the derivative of a product is not the product of the derivatives, and a single numerical check on x times x confirms it.
Why is the derivative of e to the x equal to itself?
Because that is what defines the number e. Every exponential curve has a derivative proportional to itself, and the constant of proportionality depends on the base. e is the unique base for which that constant is exactly 1, so e to the x is the one exponential function that is its own rate of change. This is why it appears in every growth and decay model.
What is implicit differentiation?
It is differentiating an equation that has not been rearranged to make y the subject. Differentiate every term with respect to x, applying the chain rule whenever a term contains y so that each one contributes a factor of dy/dx, then collect those terms and solve for dy/dx. It is the only way to get the gradient of a curve like a circle, which is not a function of x at all.
What are sinh and cosh?
They are the hyperbolic sine and cosine, defined from exponentials: cosh x is half of e to the x plus e to the minus x, and sinh x is half of the difference. They mirror the trigonometric functions almost exactly, with cosh squared minus sinh squared equal to 1 instead of a sum. A hanging chain follows a cosh curve, which is where the name catenary comes from.
Mr. Chalk