Fundamentals / Numerical mathematics / Nonlinear equations

Newton and secant updates

Derive derivative-based and derivative-free updates, measure their convergence near a simple zero and explain why a repeated zero changes the convergence order.

From first principles

Build one root correction from a local line

Suppose \(f\) is differentiable near a root and a trial point \(x_k\) has a nonzero derivative. Taylor expansion models the function a short displacement \(s\) away by \(f(x_k)+f'(x_k)s\). Requiring this local line to vanish gives Newton’s update,

\[s=-\frac{f(x_k)}{f'(x_k)},\]
\[x_{k+1}=x_k+s .\]

The true new residual is the nonlinear remainder. For twice continuously differentiable \(f\) and a segment where \(|f''|\le M\), Taylor’s theorem yields

\[|f(x_{k+1})|\le \tfrac12 M|s|^2 .\]

Converting residual to a location error also requires a lower bound on \(|f'|\) near the root. If derivatives are unavailable, estimate the local slope by \([f(x_k)-f(x_{k-1})]/[x_k-x_{k-1}]\) to obtain the secant method. Its denominator must be resolved numerically. Both methods need caution far from the root, where the line can extrapolate outside the region where it represents the function.

Derivation and applications

Recover the multiplicity of a root from derivative measurements

At a multiple zero, the ordinary Newton step no longer removes the leading location error. Suppose \(f(x)=(x-r)^m h(x)\), with integer \(m\ge1\), smooth \(h\) and \(h(r)\ne0\). Write \(e=x-r\). Differentiating the product and keeping the leading powers gives

\[f'=me^{m-1}h+e^mh',\]
\[\frac{f}{f'}=\frac{e}{m+e h'/h}=\frac{e}{m}+O(e^2).\]

It follows that ordinary Newton leaves the fraction \(1-1/m\) of the error to first order. For known \(m\), multiplying the Newton correction by \(m\) cancels the leading error. When multiplicity is unknown, consider the auxiliary function \(u=f/f'\), which has a simple zero after continuous extension to \(r\). Its derivative and Newton correction are

\[u'=1-\frac{ff''}{(f')^2},\]
\[x_{\rm new}=x-\frac{u}{u'}=x-\frac{ff'}{(f')^2-ff''}.\]

The leading powers in the twice differentiated product give a local diagnostic,

\[\frac{ff''}{(f')^2}\longrightarrow\frac{m-1}{m},\qquad \frac{1}{1-ff''/(f')^2}\longrightarrow m .\]

Far from the zero the inferred value need not be integral or even positive. Near a flat root both derivatives and the function value can become very small, so the ratio needs sufficiently accurate evaluations. The derivation gives a local method and does not establish that a distant initial guess will enter its convergence region.

Worked example

Recover a triple zero from one set of values

For \(f(x)=(x-2)^3\) at \(x=2.2\), \(f=0.008\), \(f'=0.12\), \(f''=1.2\). The diagnostic gives

\[1/[1-(0.008)(1.2)/0.12^2]=3.\]

The ordinary Newton step lands at \(2.13333\), while multiplying its correction by three gives 2 exactly because \(h\) is constant.

Second application

Check the effect of a changing smooth factor

For a different function \(f(x)=x^2(1+x)\) at \(x=0.1\), the three values are \(0.011,0.23,2.6\). The apparent multiplicity is

\[0.23^2/(0.23^2-0.011\times2.6)=2.18.\]

Newton on \(u\) gives

\[x_{\rm new}=0.1-(0.011)(0.23)/(0.0243)=-0.00412.\]

Crossing the zero is consistent with the curvature of \(u\); the absolute location error nevertheless drops by a factor exceeding 24.

OneSimulation laboratory

Locate the root of an implicit cooling step

Start from this chapter. Differentiate the fourth-power loss in the implicit temperature residual. Predict which change alters the physical root: changing the time step or changing the Newton update.

Compare recorded OneSimulation runs on this page. To test your own inputs, download the Python model and run the model in an activated OneSimulation environment.

The downloadable model takes one backward Euler step with \(C=2\) J/K, \(A=0.3\) m², emissivity 0.5 and a test radiation constant of 0.02 W/(m²·K⁴), giving \(\beta=0.0015\) K⁻³s⁻¹. Its output substitutes the returned temperature into the residual independently. Predict which edit changes the root. Download the Python experiment · OneSimulation implicit cooling comparison.

python nonlinear-equations.py
python nonlinear-equations.py --step 0.05
python nonlinear-equations.py --solver damped
End temperature and discrete residual from a single step.
Step, solverTemperature (K)|F| (K)
1 s, Newton1.97851479065.6 × 10⁻¹⁷
0.05 s, Newton1.99887769133.7 × 10⁻¹⁷
1 s, damped Newton1.97851479065.6 × 10⁻¹⁷
Damping the Newton iteration gives the same converged end temperature at a one-second step. Shortening the step changes the equation and gives a warmer endpoint.
Damping the Newton iteration gives the same converged end temperature at a one-second step. Shortening the step changes the equation and gives a warmer endpoint.

A different step changes both the equation and the observation time. A converged line-search Newton method on the original step recovers the same physical root. To measure time discretisation error, compare solutions on successively finer grids at a common final time.

Change parameters · Change the laboratory inputs

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Problem sheet 2 · Distinguish root accuracy from temperature sensitivity

Read the model setup and preparatory problems

Linearise the residual where you stand

Suppose a scalar balance \(F(x)=0\) is smooth, with a simple root \(r\), meaning \(F'(r)\ne0\). Replacing the unknown function by its tangent at a current estimate \(x_k\) gives

\[0\simeq F(x_k)+F'(x_k)(x_{k+1}-x_k).\]

Hence \(x_{k+1}=x_k-F(x_k)/F'(x_k)\). The quotient has units of the unknown variable. When it is used in a coupled thermal model, for instance, a mismatch in watts divided by a derivative in W/K produces a temperature correction.

Assume both the current iterate and the root lie where \(|F''|\leq M\) and \(|F'|\geq m>0\). Taylor expand \(F(r)\) about \(x_k\) and insert the Newton update to obtain

\[|x_{k+1}-r|\leq M|x_k-r|^2/(2m).\]

For sufficiently small initial error the next iterate stays in the same neighbourhood and its error is of quadratic order. This is a local conclusion. A nearly horizontal tangent far away can give a huge update even when the desired root is simple.

Calculate the improvement explicitly

For \(F(x)=x^2-2\), Newton’s update is \((x+2/x)/2\). From 1.5 it gives \(17/12=1.4166667\), then

\[577/408=1.4142157.\]

The absolute errors fall from approximately 0.08579 to 0.002453 and then to \(2.12\times10^{-6}\). An exact identity explains these figures:

\[x_{k+1}-\sqrt2=(x_k-\sqrt2)^2/(2x_k).\]

The positive sequence stays on the high side after the first update and approaches the physically selected positive root.

When analytic derivatives are expensive, replace \(F'(x_k)\) by the slope between \(x_k\) and \(x_{k-1}\). The resulting secant update uses two initial estimates and only one new residual evaluation per subsequent step. For the same quadratic, the divided difference is exactly \(x_k+x_{k-1}\); algebra gives

\[e_{k+1}=e_ke_{k-1}/(x_k+x_{k-1}),\]

where \(e_j=x_j-\sqrt2\). Near the root the denominator is nearly constant. If \(e_{k+1}\) scales as \(e_k^p\), consistency with the product relation gives

\[p^2=p+1.\]

The positive solution is about 1.618, superlinear but less than two.

Examine a root of higher multiplicity

For \(F(x)=(x-r)^m\), the tangent correction is only \((x-r)/m\). Newton therefore leaves \(e_{k+1}=(1-1/m)e_k\), a fixed linear reduction. With \(m=3\) and an initial error of 0.3, the first two errors are 0.2 and 0.13333. Meanwhile the residual is cubed, so even a small residual may mask appreciable positional error. Multiplying the Newton correction by \(m\) restores the exact root in one step for this pure power and restores quadratic convergence more generally when the multiplicity is known and the remaining factor is smooth and nonzero.

Numerically differentiating a residual introduces its own scale. For the forward difference \([F(x+s)-F(x)]/s\), Taylor truncation decreases as \(O(s)\), while rounding or evaluation noise in the numerator is divided by \(s\). Blindly shrinking \(s\) can therefore spoil the derivative. Recompute at a second scale, compare with an analytic derivative when available, and check the final state against the original balance. A derivative that is accurate near the starting point need not stay accurate along the entire sequence.

Background · How can the iterates suggest a multiplicity?

Suppose an isolated root has multiplicity \(m>1\), so \(f(x)=(x-r)^m g(x)\) with smooth \(g(r)\ne0\). Dividing the function by its derivative shows that the leading Newton correction is \((x-r)/m\). Sufficiently near the root, successive corrections therefore obey

\[\frac{|x_{k+1}-x_k|}{|x_k-x_{k-1}|}\longrightarrow 1-\frac1m.\]

A sustained ratio of about \(2/3\) suggests a triple root. A single such ratio is weak evidence: a line search that repeatedly accepts one third of a full step can produce linear convergence even near a simple root. Check the actual step acceptance and the residual model before multiplying all subsequent corrections by three. Ratios of corrections also become unreliable once their sizes approach floating-point resolution.

Set stopping tests that survive a change of units

Multiplying a residual by a nonzero constant \(c\) leaves a Newton correction unchanged because both the residual and its derivative acquire that factor. Secant updates have the same invariance. An absolute stopping threshold on the residual alone, however, changes its meaning by \(c\). For \(F=x^2-2\) the trial \(x=1.414\) has \(|F|\simeq0.000604\). Reporting the equivalent balance as \(1000F\) gives a mismatch about 0.604, with the identical prospective Newton step.

A useful report contains a scaled residual, the size of the accepted update in variable units and the conditions used to leave the iteration. Near a simple root a final undamped correction estimates the remaining positional error to first order. A small damped correction can equally be the consequence of a line search rejecting progress. Recheck the undamped balance or a bracket before treating a tiny change in the displayed state as convergence.

Prove a local quadratic bound with an explicit radius

Let \(r\) be a simple root of a twice differentiable scalar \(f\). On a surrounding interval suppose \(|f'|\ge m>0\) and \(|f''|\le M\). Taylor expansion about a trial point \(x\) gives \(0=f(r)=f(x)+f'(x)(r-x)+f''(\xi)(r-x)^2/2\) for an intermediate \(\xi\). Subtract the exact root from the Newton update \(x_+=x-f(x)/f'(x)\). The linear terms cancel and \(|x_+-r|\le [M/(2m)]|x-r|^2\). This supplies both the mechanism and a coefficient for the familiar quadratic statement.

The constants must continue to hold at every iterate. If the closed ball of radius \(R\) about the root lies in the stated interval and \(MR/(2m)<1\), any starting point in that ball maps strictly closer to the root and remains in the ball. Repeating the bound is then justified by induction. Without such an invariant region, a single Taylor estimate says nothing about what happens after a step leaves the region of controlled derivatives. A relative update tolerance cannot substitute for a verified lower derivative bound near a flat or multiple root.

Certify a square root and assess an inexact division

For \(f(x)=x^2-9\), use the interval \([2,4]\), root three, \(m=4\), \(M=2\). The resulting quadratic error coefficient is \(1/4\). From \(x_0=2.4\) the true initial error is 0.6 and the first error is bounded by 0.09. The actual Newton update is \((2.4+9/2.4)/2=3.075\), leaving error 0.075. The next bound using the actual first error is

\[0.075^2/4=0.00140625.\]

Independently the exact update error obeys \((x-3)^2/(2x)\), giving \(0.075^2/(2\cdot3.075)\approx0.0009146\). The guaranteed number is larger because it allows the smallest derivative on the whole interval.

Now suppose the computed Newton update has an additional absolute rounding uncertainty of \(10^{-4}\) each time. The same reasoning gives

\[|e_+|\le |e|^2/4+10^{-4}.\]

Once \(|e|\) falls below roughly 0.02, the allowed update uncertainty exceeds the quadratic contribution. Continuing iterations can still help, but the mathematical inequality no longer promises a doubling of correct digits. This transition is visible from the size of the actual input and evaluation errors and should not be fitted away as a mysterious change of convergence order.

A final distance certificate can avoid using the exact root in a real calculation. If a sign-changing bracket is known to contain the root and \(|f'|\ge4\) throughout it, then \(|x-r|\le|f(x)|/4\) for a point \(x\) inside the bracket. The local Newton proof and the residual-based certificate therefore serve complementary roles: one predicts improvement per iteration, while the other assesses the current uncertainty from computable information.

In the same square-root example a residual of 0.0008 with the iterate inside \([2,4]\) certifies error at most 0.0002, even without relying on observed convergence ratios. If one instead used the interval \([-4,4]\), the derivative lower bound would be zero and the same residual could not tell which of the two roots was nearby. Certifying a branch is part of certifying a distance.

Change parameters · Newton and secant updates

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Study the full derivation

Choosing a derivative step in a nonlinear solve · Nonlinear systems and iterative methods

A smaller finite-difference step eventually makes Newton iterations worse. Derive truncation and evaluation errors, compare a complex perturbation and a directional derivative, and test which numerical derivative is meaningful for the actual residual implementation.