Linear Approximation and Newton’s Method

Tangent lines as the best local guess, Newton’s method racing to a root and painting fractals, and l’Hôpital’s rule seen up close

Linear Approximation and Newton’s Method

Zoom in far enough on a smooth curve and it becomes indistinguishable from its tangent line. That makes the tangent the best straight-line stand-in for a function near a point, and the stand-in is good for far more than estimating square roots by hand: it finds roots of equations at astonishing speed, and it explains why 0/0 limits come out the way they do.

The Tangent Line as an Approximation

Drag the pink point to choose a and the white point to step away by Δx. The rose bar is the error. Try the three estimates, then shrink Δx and watch the error fall along a line of slope 2 on the log-log plot.

Estimate with a tangent line:
2.024846
true f(4.1)
2.025
tangent-line estimate L(x)
−1.54×10⁻⁴
error E = f − L
−0.01543
E/Δx², heading for f″(a)/2 = −0.01563
√4.1 ≈ √4 + (1/(2√4))·0.1 = 2.025. The true value is 2.02484567, so the tangent line is off by 1.54×10⁻⁴.

Drag the pink point to move a, and the white point to change Δx. The log-log curve is computed for Δx with the same sign as yours; for steps below about 10⁻⁷ rounding error in floating point would take over, so the plot stops at 10⁻⁴.

Go deeper:Linearization and Its Error

The linearization of f at a is the tangent line, used as a function:

L(x) = f(a) + f′(a)(x − a), f(a + Δx) ≈ f(a) + f′(a)·Δx.

For √x at a = 4 it gives √4.1 ≈ 2 + 0.1/4 = 2.025, against the true 2.02485…; for sin x at 0 it gives the small-angle rule sin x ≈ x; for (1 + x)ⁿ at 0 it gives 1 + nx, so 1.01¹⁰ ≈ 1.1 against the true 1.10462…

How good is it? If f″ is continuous, the error E(Δx) = f(a + Δx) − L(a + Δx) satisfies E ≈ ½ f″(a)·Δx², and more precisely E = ½ f″(ξ)·Δx² for some ξ between a and a + Δx (Taylor’s theorem with the Lagrange remainder). Halving the step quarters the error; on a log-log plot, log|E| ≈ 2 log|Δx| + constant is a line of slope 2. The error is not just small: it is small compared with Δx itself, E/Δx → 0, and that property characterises the tangent line among all lines through (a, f(a)).

Adding the curvature term gives the quadratic approximation Q(x) = L(x) + ½ f″(a)(x − a)², whose error is of order Δx³. Carry on adding terms and you arrive at Taylor polynomials and Taylor series, which have a lesson of their own. Where f″(a) = 0, as for sin x at 0, the tangent line is already a second-order approximation and its error is cubic.

Newton’s Method

Drag x₀ and watch each tangent line slide down to the axis to make the next guess. Watch the correct digits double, then try the presets that cycle and diverge. Switch to the complex plane to see where every starting point ends up.

kxₖf(xₖ)correct digits
03.0000000000000007.00e+00.0
11.8333333333333331.36e+00.5
21.4621212121212121.38e−11.5
31.4149984298948032.22e−33.3
41.4142137800471986.16e−76.8
51.4142135623731124.75e−1413.9
61.414213562373095−4.44e-1616 (all)
Converged to 1.41421356237309 in 6 steps. Look at the digits column: once the guess is close, each step roughly doubles the number of correct digits. That is quadratic convergence.

Drag across the plot to move x₀. f′(x) = 2x, found symbolically. Digits are counted against the final iterate, so they top out at about 16, the precision of a double.

Go deeper:Following Tangent Lines to a Root

To solve f(x) = 0, replace f by its linearization at the current guess and solve that instead. The tangent at xₖ meets the axis at

xₖ₊₁ = xₖ − f(xₖ) / f′(xₖ).

Near a simple root r (f(r) = 0, f′(r) ≠ 0) the error eₖ = xₖ − r obeys eₖ₊₁ ≈ [f″(r) / 2f′(r)]·eₖ²: quadratic convergence. An error of 10⁻³ becomes about 10⁻⁶, then 10⁻¹², so the number of correct digits roughly doubles at every step. For f(x) = x² − 2 the iteration is xₖ₊₁ = (xₖ + 2/xₖ)/2, the ancient Babylonian square-root rule; from 1 it gives 3/2, 17/12, 577/408, … and 577/408 is already correct to six digits.

The method only promises success from a good enough start. On x³ − 2x + 2, the tangent at 0 points to 1 and the tangent at 1 points back to 0 forever. On arctan x, starting beyond |x₀| ≈ 1.3917 sends the iterates outward with alternating signs; inside it, they fall into the root at 0. A horizontal tangent stops the method outright.

In the complex plane the same formula applies to polynomials such as z³ − 1, with three roots. Arthur Cayley posed the question in 1879 of which starting points lead to which root; the answer, seen clearly only with computers a century later, is a fractal: at every point of the boundary between two basins, all of the basins meet. Newton described his method in the 1660s for polynomials, Joseph Raphson published a simpler version in 1690, and Thomas Simpson gave it the general calculus form used today in 1740.

L’Hôpital’s Rule Up Close

Both f and g vanish at a, so f/g is 0/0 there. Slide the zoom up and watch both curves straighten into lines whose ratio of heights is the ratio of their slopes. On the right, the curve (g, f) leaves the origin with exactly that slope.

0.751781
x = a + (window)/2
0.9084306
f(x)/g(x)
0.7304738
f′(x)/g′(x)
1
the limit
f/g = (sin(x)) / (x) → 0 / 0round 1: f′/g′ = (cos(x)) / (1) → 1 / 1Zoomed in, both curves are straight lines through (0, 0), and their heights at any x have ratio f′(a)/g′(a) = 1.

The rule differentiates f and g separately (not the quotient f/g). The vertical scale grows with the zoom like (window)^k, where k is the number of rounds needed, so the shapes stay visible. Type your own f and g; the point a comes from the last preset you chose.

Go deeper:Why the Rule Works

L’Hôpital’s rule. If f(a) = g(a) = 0, f and g are differentiable near a, g′ ≠ 0 near a, and f′(x)/g′(x) → L as x → a, then f(x)/g(x) → L as well. The same holds for ∞/∞ forms.

The picture explains it. Near a, each function is almost its tangent line: f(x) ≈ f′(a)(x − a) and g(x) ≈ g′(a)(x − a). The factors (x − a) cancel in the ratio, leaving f′(a)/g′(a). So

lim sin x / x = cos 0 / 1 = 1, lim (eˣ − 1)/x = 1, lim ln x / (x − 1) = 1, lim (x³ − 8)/(x − 2) = 12.

When f′(a) = g′(a) = 0 too, both curves are flat at a and look like parabolas ½f″(a)(x − a)² and ½g″(a)(x − a)²; the rule is applied again, so lim (1 − cos x)/x² = lim sin x / 2x = lim cos x / 2 = ½. The careful proof uses Cauchy’s mean value theorem: (f(x) − f(a))/(g(x) − g(a)) = f′(c)/g′(c) for some c between a and x, which is the slope statement about the parametric curve (g, f) on the right.

Two warnings: check that the form really is 0/0 or ∞/∞ first, and differentiate the top and bottom separately, not as a quotient. The rule appeared in 1696 in Guillaume de l’Hôpital’s Analyse des Infiniment Petits, the first calculus textbook, but it was discovered by Johann Bernoulli, who had agreed in 1694 to send l’Hôpital his mathematical discoveries in exchange for a regular payment.

Key Takeaways

  • The tangent line L(x) = f(a) + f′(a)(x − a) is the best linear approximation near a, with error about ½f″(a)Δx².
  • Newton’s method, xₖ₊₁ = xₖ − f(xₖ)/f′(xₖ), roughly doubles the correct digits at each step near a simple root.
  • From a poor start Newton’s method can cycle or diverge, and in the complex plane its basins form a fractal.
  • L’Hôpital’s rule: near a 0/0 point both functions are nearly straight lines, so their ratio tends to f′(a)/g′(a).

Spot a mistake or have an idea?

Search