Secant to tangent
Pick a curve and a point a on it. A second point sits at a + h. The line through the two points is a secant, and its slope is rise over run: (f(a + h) − f(a)) / h. Drag h toward zero. The second point slides into the first and the secant settles onto the tangent. The slope it settles on is the derivative f′(a).
Mission. Keep f(x) = x² and a = 1. Before you move the h slider, predict the secant slopes for h = 0.5 and h = 0.25. Then drag h and check the readout.
Answer
2.5 and 2.25. The secant slope is 2 + h, so the error (slope − 2) is exactly h, and halving h halves the error. (The slider is coarse, so you may land on h = 0.251 and read 2.251; same rule.) Extension: find an h that makes the error less than 0.01. Any h below 0.01 does it: the table row h = 0.001 gives 2.001. For x³ the error is 3h + h², so halving h does slightly better than halving the error.
What's going on
You cannot compute the slope of a curve at a single point directly, because a slope needs two points. Calculus gets round this by using two points and then asking what the slope approaches as the second point closes in. For f(x) = x² at a = 1, the secant slope is ((1 + h)² − 1) / h = (2h + h²) / h = 2 + h. As h shrinks, this is clearly heading for 2, and it never needs to arrive: the limit is 2, so f′(1) = 2.
Do the same algebra with a general a and you get 2a + h → 2a. That is the famous result: the derivative of x² is 2x. The table below the graph shows the numbers doing exactly this for whichever curve you pick. For x³ the slopes approach 3a². For sin x they approach cos a. For eˣ they approach eᵃ, the function's own value, which is what makes e special.
Notice h can be negative too: approach from the left and you should get the same answer. If a curve gave different answers from the two sides, it would have a corner there and no tangent. Pick |x| and set a = 0: the two sides disagree, so there is no tangent there.
Sheet: The slope of a curve.