Derivative & Tangent Explorer

Pick a curve and a point. The orange chord joins it to a second point h further on; shrink h and the chord's slope closes on the slope of the tangent, which is the derivative.

The derivative
The tangent at a
Derivatives on this page
Loading interactive simulation...

Lesson

The theory — Derivative & Tangent Explorer

The derivative of f at x is the slope of the curve there, defined as the limit of the slope of a chord: f′(x) = lim (f(x + h) − f(x))/h as h → 0, when that limit exists.

What each symbol means

h
the step from x to the chord's second point
f′(x)
the derivative: the slope of the tangent at x

Where the formula comes from

  1. A chord. Two points of the curve, at x and at x + h, fix a line, the chord drawn in orange. Its slope is the rise over the run.
  2. Shrink h. For f(x) = x² the chord's slope is 2x + h exactly, so as h goes to 0 it closes on 2x. The h cannot be set to 0, where the quotient is 0/0; the limit is what is left as it shrinks away.
  3. The tangent and the normal. The tangent at a passes through (a, f(a)) with slope f′(a). The normal is perpendicular to it there, so its slope is the negative reciprocal, −1/f′(a); where f′(a) = 0 the normal is the vertical line x = a.
  4. Where it fails. If the chords from the left and from the right close on different slopes, there is no derivative. At the corner of |x| at 0 they close on −1 and 1.

A flat spot is not always a peak or a valley 🖖

A zero derivative means the tangent is horizontal. It does not promise a maximum or a minimum. Press x³ inflection: the slope reads 0, yet the curve climbs on both sides and only pauses. That is an inflection point, and it is why finding where the derivative vanishes is only the first half of an optimisation problem. The second half is checking what the slope does on either side, because the derivative at one point cannot tell a summit from a landing on a staircase.

The curve with no tangent anywhere 🖖

The six built-in curves have a tangent at every point, but a continuous function need not have one anywhere. In 1872 Karl Weierstrass built a function that is continuous everywhere and has a slope nowhere: it is jagged at every scale, so no chord ever settles. It surprised mathematicians who had assumed, as Ampère had tried to prove in 1806, that a continuous curve has a tangent except at isolated points. The same roughness later turned up in nature: the path of a particle in Brownian motion has a tangent nowhere, and a coastline behaves much the same way over a wide range of scales.

DERIVATIVES — WHICH RULE APPLIES, AND WHAT THE SLOPE ACTUALLY TELLS YOU

Which Derivative Case Are You Looking At?

The derivative is one idea — the slope of the tangent, the limit of (f(x+h) − f(x))/h — but the way you compute it depends on what kind of function you were handed, and the way you read the answer depends on whether it came out positive, negative or zero. Three standard rules cover most functions you will meet; the fourth case is the one where a zero slope does not mean what people assume.

Power rule — a polynomial term d/dx xn = n·xn−1
Trigonometric — sine and cosine trade places d/dx sin x = cos x
Exponential — the function is its own derivative d/dx ex = ex
Zero slope that is not a maximum or a minimum f′ = 0, f″ = 0

01

Power rule — a polynomial term

What you know: The function is xⁿ, or a sum of such terms. Bring the exponent down in front and knock one off it.

Rule: d/dx xn = n·xn−1

Worked example: f(x) = x² at x = 1 → f′(x) = 2x → f′(1) = 2, so the tangent is y = 2x − 1

Open this case: x² at x=1
Power rule — a polynomial term. The tangent at x = 1 has slope 2 and touches the parabola at a single point. The function is xⁿ, or a sum of such terms. Bring the exponent down in front and knock one off it.
The tangent at x = 1 has slope 2 and touches the parabola at a single point.

02

Trigonometric — sine and cosine trade places

What you know: The function is sin x or cos x. Differentiating rotates you through the cycle: sin → cos → −sin → −cos → sin.

Rule: d/dx sin x = cos x

Worked example: f(x) = sin x at x = 0 → f′(x) = cos x → f′(0) = 1, so the tangent is y = x

Open this case: sin at x=0
Trigonometric — sine and cosine trade places. At the origin sin x has slope 1, so the tangent is the line y = x. The function is sin x or cos x. Differentiating rotates you through the cycle: sin → cos → −sin → −cos → sin.
At the origin sin x has slope 1, so the tangent is the line y = x.

03

Exponential — the function is its own derivative

What you know: The function is eˣ. Differentiating changes nothing at all: f′(x) = f(x) at every point.

Rule: d/dx ex = ex

Worked example: f(x) = eˣ at x = 0 → f′(x) = eˣ → f′(0) = 1, so the tangent is y = x + 1

Open this case: e^x at x=0
Exponential — the function is its own derivative. Height and slope are the same number at every point on the curve. The function is eˣ. Differentiating changes nothing at all: f′(x) = f(x) at every point.
Height and slope are the same number at every point on the curve.

04

Zero slope that is not a maximum or a minimum

What you know: f′ = 0 at the point, so it is stationary — but the sign of f′ is the same on both sides, so it is not a turning point.

Rule: f′ = 0, f″ = 0

Worked example: f(x) = x³ at x = 0 → f′(x) = 3x² → f′(0) = 0, yet f′ > 0 on both sides: the curve flattens and carries on rising

Open this case: x³ inflection
Zero slope that is not a maximum or a minimum. The tangent is horizontal at the origin, but the curve keeps climbing on both sides. f′ = 0 at the point, so it is stationary — but the sign of f′ is the same on both sides, so it is not a turning point.
The tangent is horizontal at the origin, but the curve keeps climbing on both sides.
References (1)
  • Insight block 3 — continuous everywhere, differentiable nowhere: K. Weierstrass, "Über continuirliche Functionen eines reellen Arguments, die für keinen Werth des letzteren einen bestimmten Differentialquotienten besitzen." Read to the Berlin Academy, 18 July 1872; printed in Mathematische Werke, vol. 2, 71–74.

Problems solved in full

  1. The slope and tangent of f(x) = x² at x = 1 5 steps

    f(x) = x², at x = 1. Get the slope there from the definition rather than from a rule, write down the tangent, and then say exactly how far that tangent has drifted from the curve one tenth of a unit further along.

    1. A single point has no slope — slope is a comparison, so it needs two points. Take the second one a distance h away and measure the average rise over that run. The whole of differential calculus is this quotient plus one limit.

    2. Expand the square. The constant terms cancel, which leaves an h in every surviving term, so the h downstairs divides out cleanly. Notice what the cancellation costs you: it is legal for every h except 0, and 0 is precisely the value you are heading for.

    3. That is why the limit is taken rather than substituted. 2 + h is a straight line in h, so the value it approaches is read off without any approximation at all, and the slope at x = 1 comes out at 2 without the rule 2x ever being written down.

    4. A tangent needs a point and a slope, and you now have both: the curve passes through (1, 1) with slope 2.

    5. Subtract the line from the curve. The difference is not small, not approximately anything — it factorises exactly, so the parabola sits (x − 1)² above its tangent at every x, and at a distance h the gap is h².

    Answer

    f′(1) = 2, tangent y = 2x − 1, and the gap between them is exactly h²: shorten the step by a factor of 10 and the tangent's error drops by a factor of 100, from 0.01 to 0.0001. That squaring is the entire justification for replacing a curve by a line near a point. The sign of the gap, though, is worth more than its size. (x − 1)² is never negative, so this parabola touches its tangents and never crosses one. Put f(x) = x³ at x = 0 beside it: the tangent is the x-axis, the gap is x³ itself, and x³ is negative on the left and positive on the right, so the line passes clean through the curve. Both functions have a horizontal tangent somewhere and only one of them has a turning point there — a vanishing derivative is not what makes a minimum, the sign of the gap is.

  2. 1/x from the definition 3 steps

    Find the derivative of f(x) = 1/x from the definition, and the tangent at x = 2.

    Open this problem in the tool

    Show solution
    1. Write the chord's slope and put the two fractions on top over one denominator:

    2. The h cancels, and what is left can be evaluated at h = 0:

    3. At x = 2 the curve is at ½ and falls by ¼ per unit:

    Answer

    f′(x) = −1/x² for x ≠ 0, and the tangent at x = 2 is y = −x/4 + 1.

  3. √x from the definition, with the tangent and the normal 3 steps

    Find the derivative of f(x) = √x from the definition, then the tangent and the normal at x = 4.

    Open this problem in the tool

    Show solution
    1. The chord's slope has a difference of square roots on top. Multiply top and bottom by their sum, and the roots leave the numerator:

    2. Now let h go to 0:

    3. The tangent passes through (4, 2) with slope ¼; the normal passes through the same point with slope −4, the negative reciprocal:

    Answer

    f′(x) = 1/(2√x) for x > 0. At x = 4 the tangent is y = x/4 + 1 and the normal is y = −4x + 18. At x = 0 the chords steepen without bound and there is no derivative; the page shows it if you move x there.

  4. Why the derivative of sin x is cos x 3 steps

    Show from the definition that the derivative of sin x is cos x, using the limits of the previous page, and give the slope at x = π/3.

    Open this problem in the tool

    Show solution
    1. Expand sin(x + h) with the addition formula and group the terms by sin x and cos x:

    2. As h → 0, sin h / h → 1, and (cos h − 1)/h → 0, because it is h times (cos h − 1)/h², which tends to −½:

    3. So the derivative is cos x, and at π/3 it is ½:

    Answer

    (sin x)′ = cos x, and the slope at π/3 is ½. The limit sin h / h → 1 needs h in radians. In degrees it tends to π/180 instead, and that factor carries through to the derivative.

  5. Where the tangent is horizontal 3 steps

    Find the points where f(x) = x³ − 3x² − 9x + 2 has a horizontal tangent.

    Open this problem in the tool

    Show solution
    1. Differentiate term by term with the power rule, and factorise:

    2. A horizontal tangent has slope 0:

    3. Find the heights there:

    Answer

    Horizontal tangents at (−1, 7) and (3, −25).

  6. A tangent parallel to a given line 2 steps

    Find the point on y = x² + 3x where the tangent is parallel to y = 7x − 2, and the tangent there.

    Open this problem in the tool

    Show solution
    1. Parallel lines have equal slopes, so set f′(x) = 7:

    2. Find the point and write the line:

    Answer

    At (2, 10), where the tangent is y = 7x − 4.

  7. A corner: continuous, with no derivative 3 steps

    Show that f(x) = |x| has no derivative at 0, though it is continuous there.

    Open this problem in the tool

    Show solution
    1. From 0, a chord to the right has slope h/h and a chord to the left −h/h:

    2. The one-sided limits are 1 and −1. They differ, so the limit that would define f′(0) does not exist:

    3. Continuity asks less. |x| goes to 0 = f(0) from both sides:

    Answer

    |x| is continuous at 0 and has no derivative there: the curve has a corner, and no single line is tangent to it. A differentiable function is continuous; this is the standard example that the converse fails.

  8. Average speed and speed at an instant 3 steps

    A stone falls s(t) = 4.9t² metres in t seconds. Find its average speed between t = 2 and t = 2.1, and its speed at t = 2.

    Open this problem in the tool

    Show solution
    1. The average speed over an interval is the chord's slope:

    2. The speed at an instant is the limit of that slope, the derivative:

    3. The difference between them is 4.9h, so it shrinks in proportion to the interval:

    Answer

    20.09 m/s on average over that tenth of a second, and 19.6 m/s at t = 2. On the page t is written x.

Learning path

Why everything looks straight up close

Further reading (1)