Worked example · Mathematics
The gradient of a curve, and the tangent that measures it
A straight line has one gradient and you can measure it with a ruler. A curve is steeper in some places than others, so "the gradient" is not a number until you say where. This page finds the gradient of y = x² at x = 3 four separate ways — by chords, by algebra, by tangent and by the rule you may already know — and then reads the gradient of a real speed curve, where it turns out to be the acceleration.
Rise over run, while the line is straight
Gradient is how much the line climbs for each step to the right. Take y = 2x + 1 and any two points on it — say (1, 3) and (4, 9):
Any other pair of points on that line gives 2 as well, and that is the whole reason the answer is simple: a straight line has the same steepness everywhere, so which two points you pick cannot matter.
Now try the same thing on y = x² between (1, 1) and (4, 16): (16 − 1) ÷ (4 − 1) = 5. Between (2, 4) and (4, 16) it is 6. Between (3, 9) and (4, 16) it is 7. Three answers, all correct, none of them "the gradient" — because a curve does not have one.
Chords, shrinking towards a single point
Ask a narrower question: what is the gradient at x = 3? Take a chord from x = 3 to a point a little further along, at 3 + h, and work out its gradient. Then make h smaller and watch:
Put h in a variable and the whole experiment becomes one line you can replay — which is exactly what a variable is for:
- 1
- VAR
- STO
- A
The calculator now holds
- A
- 1
- the chord width — the number about to shrink
- (
- (
- 3
- +
- VAR
- A
- )
- x²
- −
- 9
- )
- ÷
- VAR
- A
- =
Store a smaller A, press ▲ to bring the expression back, and press =. A new value and two keys is a whole row of this table:
| A (chord width) | Chord gradient | As Ans shows it |
|---|---|---|
| 1 | 7 | 7 |
| 0.5 | 6.5 | 13/2 |
| 0.1 | 6.1 | 61/10 |
| 0.01 | 6.01 | 601/100 |
| 0.001 | 6.001 | 6001/1000 |
The answers are walking towards 6 and the pattern is exact: each chord is 6 + A. That is not a coincidence, and the algebra shows why in two lines — ((3+h)² − 9)/h = (6h + h²)/h = 6 + h — so as the chord shrinks to nothing the gradient is exactly 6.
The answer arrives as a fraction, and that is the point. There is no decimal point anywhere in ((3+A)²−9)÷A — the 0.001 went into A — so Ans has not been asked for a decimal and does not give one: it returns 6001/1000, exactly. Press Frac⇄Dec for 6.001. A calculator working in binary floating point would offer 6.009999999999849 for the A = 0.01 row, which is the same answer wearing a disguise that hides the pattern this whole step depends on. There is more on that on the exact values page.
Take the chord from both sides and something surprising happens
Every chord above ran from x = 3 forwards to 3 + A, so every one of them overshoots: 7, 6.5, 6.1, 6.01. Straddle the point instead — from 3 − A to 3 + A — and the same experiment behaves completely differently:
Not 6.001, and not 6.0000001. Exactly 6, from a chord as wide as you like: A = 1 means a chord from x = 2 to x = 4, and it still reads 6. The algebra says why in one line — (3+h)² − (3−h)² = 12h, so dividing by 2h leaves 6 with nothing to shrink. The two overshoots cancel because the curve bends the same amount either side.
That is the centred difference, and it is what a numerical derivative actually uses. On a parabola it is exact; on any other curve it is not, but its error shrinks with the square of the chord width where the one-sided version shrinks in step with it. It is the same keystrokes and a better answer, which is a rare thing.
The tangent, drawn and measured
The line those chords are closing in on has a name: the tangent, the straight line that touches the curve at that one point and matches its direction. Ans Graph draws it and states its gradient:
f₁(x) = x^2
Four routes to the same answer: five chords narrowing, one algebraic cancellation, one tangent read off a plot, and the rule you may already know — that the gradient of x² is 2x, which at x = 3 is 6. When four methods that share no working agree, the answer is not in doubt.
Drag the tangent along the curve and the number changes as you go: 2 at x = 1, 4 at x = 2, 6 at x = 3. That moving reading is 2x, drawn rather than derived, and it is the whole idea of a derivative before any notation is involved.
On a speed–time graph, the gradient is the acceleration
Gradients are worth measuring because they mean something. Take the car from the speed–time example, whose speed follows v = 45(1 − e−t/8). That page used the area under the curve, which was the distance travelled. Its gradient is the other reading: how hard the car is accelerating at that moment.
f₁(x) = 45(1-e^(-x/8))
| t / s | Speed / m s⁻¹ | Gradient = acceleration / m s⁻² |
|---|---|---|
| 0 | 0.00 | 5.625 |
| 2 | 9.95 | 4.381 |
| 5 | 20.91 | 3.011 |
| 10 | 32.11 | 1.612 |
The speed–time page said in words that "the acceleration falls away as you speed up". This is that sentence as a measurement: 5.625 m s⁻² off the line, down to 1.61 ten seconds later. The car is still gaining speed the whole time — the gradient never reaches zero — but it is gaining it more and more slowly.
A tangent that tells you the time constant. Follow that first tangent — the one at t = 0, gradient 5.625 — as a straight line, and it reaches the top speed of 45 m/s at exactly t = 8 s, which is τ. That is true of every curve of this shape, and it is how τ is read off a measured trace in a laboratory: draw the initial tangent and see where it crosses the final value.
Four routes to one gradient
| Method | Answer |
|---|---|
| Chord with h = 0.001 | 6001/1000, which is 6.001 |
| Centred chord, any h at all | 6, exactly |
| Algebra: (6h + h²)/h = 6 + h, as h → 0 | 6, exactly |
| Tangent on the graph | 6 |
| The rule: gradient of x² is 2x | 6 |
What to watch
- A chord is never the tangent. It approaches it as h shrinks, and the table shows the approach — but every row is an approximation, and only the algebra reaches the limit.
- A one-sided chord approaches from one side and a centred one straddles the point. On y = x² the centred chord is exact at any width; that is a property of the parabola, not a general rule, so do not expect it on a curve that bends unevenly.
- The app's tangent is a numerical derivative with a stated uncertainty, not a symbolic one. Where a rule exists — 2x here — the rule is the thing to quote.
- Not every curve has a tangent everywhere. A sharp corner has no single direction at the corner, so no gradient there, however small you make h.
- Making h very small is not free: past a point, subtracting two nearly equal numbers loses precision faster than the shrinking chord gains it.
Next: area under a speed–time graph — the same curve read the other way, where the area is distance rather than the gradient being acceleration.
- Free
- No ads
- No tracking
- No account
- Every sum shown in full
Worked on Ans — a scientific calculator you can own and Ans Graph, whose tangent tool reads the gradient anywhere you put it.