From first principles
Track the residual left by an approximate Newton solve
A large nonlinear system may make an exact Newton correction too expensive. Suppose the computed step \(s_k\) solves its linearized equation only approximately. Define the linear defect \(d_k=J(x_k)s_k+F(x_k)\) and require its norm to be a fraction \(\eta_k\) of the starting imbalance,
If the Jacobian is \(L\)-Lipschitz along the trial segment, integrating its change along the step bounds the nonlinear remainder. Substituting the observed defect into the Taylor expansion gives
The first term is controllable by the inner solver; the second is inherent in using a local linear model. Solving the inner equation much more accurately than the nonlinear remainder demands can waste effort. Close to a regular root, progressively smaller forcing fractions permit faster outer convergence when derivative products and residual evaluations are also accurate enough.
Derivation and applications
Derive a subtraction-free directional derivative for analytic residuals
A matrix-free Newton iteration needs products \(J(x)v\). A complex perturbation can obtain such a product without subtracting two nearly equal real residuals. Assume each component of \(F\) is real for real arguments and has an analytic extension along \(x+zv\) near \(z=0\). The implementation must propagate complex arithmetic through the same analytic formulas. Expanding a scalar component in the direction \(v\) gives
Real coefficients make even powers real and odd powers imaginary. Extracting the imaginary part and dividing by \(h\) therefore produces a second-order directional approximation for sufficiently smooth analytic data,
The unperturbed real value never appears in a cancellation-prone subtraction. If a product approximation \(\widetilde Jv\) is used within an inexact Newton solve, the true linear defect still includes its directional error. For the proposed step \(s\),
A small reported inner residual can conceal inaccurate Jacobian actions. An operation that discards imaginary parts, takes an absolute value, or branches differently under complex inputs violates the argument. Extreme steps can also underflow or interact with inaccurate library computations, so agreement across several steps is a useful check.
Worked example
Check the truncation error on a cubic
For \(F(x)=x^3,\ x=2,\ v=1,\ h=0.1\), the true action is \(3x^2=12\). The imaginary part of \((2+0.1i)^3\) is \(1.2-0.001=1.199\), giving \(11.99\) after division. Halving \(h\) gives \(11.9975\), quartering the error exactly because all higher derivatives vanish.
Second application
Expose a nonanalytic implementation
Suppose a real residual is implemented as \(F(x)=|x|\). At \(x=2\), its real derivative is one. A direct complex call at \(2+ih\) returns the real modulus \(\sqrt{4+h^2}\); its imaginary quotient is zero for every \(h\). For a proposed correction \(s=-0.1\), the Jacobian action is thus wrong by \(0.1\), far above an inner defect budget of \(0.001\). Shrinking the complex perturbation cannot repair the implementation mismatch.
The linear defect survives into the next residual
For a differentiable system \(F(x)=0\), an exact Newton step cancels the first two terms in the Taylor expansion \(F(x+s)=F(x)+J(x)s+R(s)\). If the Jacobian is Lipschitz continuous with constant \(L\) on the segment, integrating its variation gives
For a computed step define the linear defect \(d=F(x)+J(x)s\). An inner iterative solver can stop once \(\|d\|\leq\eta_k\|F(x)\|\). Its dimensionless forcing factor \(\eta_k\) controls how much of the old residual may survive the linear solve.
Near a simple root assume \(\|J^{-1}\|\le M\) and full steps. Then \(\|s\|\le M(1+\eta_k)\|F(x)\|\), because \(Js=-F+d\). Substitution gives
A forcing factor bounded below one permits local linear convergence. A factor tending to zero gives superlinear convergence, and \(\eta_k=O(\|F(x)\|)\) restores a quadratic local bound when units and scaling have been fixed. Solving early linear systems to near machine precision may waste work because model curvature dominates the outer error.
Observe the uncancelled term
For \(f(x)=x^2-2\), start at \(x=1.5\), where \(f=0.25\) and \(J=3\). The exact step is \(-1/12\); its new residual equals \(s^2=1/144\). If the computed step is \(-0.075\), the defect is \(0.25-0.225=0.025\), a forcing factor of 0.1. The actual residual at 1.425 is \(0.030625=0.025+0.005625\). Most of this residual now comes from the inner solve. Halving the step simply for caution would increase the linear defect again; a line search and an inner tolerance address different questions.
Apply a Jacobian without storing it
A Krylov solver can request a directional action through \(Jv\approx [F(x+hv)-F(x)]/h\). With normalised \(v\), a smooth residual and absolute evaluation uncertainty \(\epsilon\), the error behaves like \(C_1 h+C_2\epsilon/h\). Minimising that model gives a scale proportional to \(\sqrt\epsilon\), with units and scales supplied by \(x\), \(v\) and \(F\). Automatic directional differentiation can avoid this differencing error when the residual implementation permits it.
An inner iteration using approximate products may report a small residual for its own approximate linear model. Verify a candidate full step by evaluating the actual nonlinear function, and compare the measured reduction with the forcing prediction. Once errors in evaluating \(F\) exceed the requested outer tolerance, neither decreasing the forcing factor nor making difference steps smaller can supply the claimed accuracy.
Produce a Jacobian action by forward differentiation
A matrix-free Newton solve asks for \(J(x)v\). Finite differences subtract two complete residual evaluations. Forward-mode automatic differentiation instead propagates a directional derivative alongside each intermediate value. Represent an intermediate by \(a+\dot a\varepsilon\), with \(\varepsilon^2=0\). Addition combines the two components separately. Multiplication gives \(ab+(a\dot b+\dot a b)\varepsilon\). A smooth scalar operation \(\phi\) gives \(\phi(a)+\phi'(a)\dot a\varepsilon\). Applying these rules to the operations of the original residual program is just repeated use of the chain rule.
Seed each independent input with its component of \(v\). The final values give \(F(x)\). The accompanying derivative components give \(J(x)v\) in the same sweep. There is no differencing increment to select. Errors in ordinary floating-point arithmetic and the accuracy of the underlying residual program still matter. A branch switch or an absolute value at zero can leave the mathematical derivative undefined. Differentiating the particular executed branch cannot supply the missing derivative. For a full dense Jacobian the method generally requires a separate direction for each independent column.
For example use the shared intermediate \(s=x+y\) in \(F=(s e^y-1,s^2+x-4)^T\). At \((2,0)\) propagate direction \((1,-2)\). The pairs for \(x,y\) are \((2,1)\) and \((0,-2)\). \(s\) becomes \((2,-1)\), and \(e^y\) becomes \((1,-2)\). The first output is therefore \((1,-5)\), the second \((2,-3)\). Thus \(F=(1,2)^T\) and the Krylov product is \((-5,-3)^T\). As a separate check the analytic Jacobian at this point has rows \((1,3)\) and \((5,4)\), whose dot products with the seed give the same two numbers.
Practise on sheet 5 · Differentiate a reciprocal with a shared input. Further reading · Massachusetts Institute of Technology · 18.S096 Matrix Calculus for Machine Learning and Beyond · Chapter 8, Forward and Reverse-Mode Automatic Differentiation, §8.1.3 Dual numbers.
Scale the forcing ratio for coupled balances
Consider two model balances expressed in newtons and millimetres. A raw Euclidean norm compares numerical values in these unrelated units. Changing the length unit alone can then make an inner solve appear more or less successful. Introduce a diagonal row scaling \(W\) based on meaningful force and length scales, and test \(\|W(F+Js)\|\le\eta\|WF\|\). With characteristic magnitudes 1000 N and 0.1 mm, physical defects of 1 N and 0.001 mm become dimensionless defects 0.001 and 0.01. The second equation is now the larger unmet balance, even though its dimensional number is smaller.
Budget a matrix-free central derivative separately
When the linearised equation is solved through matrix-vector actions, the inner solver works with estimates of \(Jv\). For a unit search direction \(v\), set \(\psi(t)=F(x+tv)\). The centred difference \([\psi(h)-\psi(-h)]/(2h)\) cancels even Taylor terms and has truncation error bounded by \(M h^2/6\) if the third directional derivative has norm at most \(M\) on the segment. If each residual evaluation carries absolute error bounded by \(\epsilon\), subtraction and division can contribute up to \(\epsilon/h\). This is a worst-case model; paired evaluations with strongly correlated errors can behave differently.
Minimising \(M h^2/6+\epsilon/h\) gives \(h=(3\epsilon/M)^{1/3}\) for positive \(M\). This balance is specific to the centred, second-order formula and requires evaluating the residual twice for each direction. A derivative already available by an analytic action or automatic differentiation has a different accuracy and cost model. Moreover \(M\) depends on both the operating state and the direction; a single unscaled absolute step is rarely well calibrated for a system mixing quantities with strongly different units.
Compare the derivative error with the requested inner accuracy
For \(f(x)=x^3-2\) at \(x=1\), the true derivative is three and the exact centred estimate at step \(h\) is \(3+h^2\), so \(M=6\). Let each function evaluation have absolute uncertainty at most \(2\times10^{-9}\). The worst-case derivative error is bounded by \(h^2+2\times10^{-9}/h\), minimised at \(h=0.001\). The truncation contribution is then \(10^{-6}\) and the evaluation contribution is \(2\times10^{-6}\), giving a combined bound of \(3\times10^{-6}\). Reducing the step to \(10^{-5}\) makes the evaluation contribution \(2\times10^{-4}\), about sixty-seven times the previously balanced total error.
The exact Newton correction at this state is \(s=1/3\). If the inner solver uses the approximate scalar derivative \(3+e\), it can solve its own equation exactly by taking \(s=1/(3+e)\). The true linear defect is then
For the balanced derivative bound this can be about \(10^{-6}\) in size. An inner residual display near machine zero therefore need not establish a true forcing ratio of \(10^{-8}\). The derivative action, rather than the Krylov stopping tolerance, has become the limiting approximation.
A practical way to expose this discrepancy is to repeat a few directional actions over a geometric sequence of \(h\) values, looking first for the expected quadratic truncation trend and then for deterioration. Such comparisons estimate sensitivity to evaluation and discretisation errors; they are not a rigorous lower bound on what all directions achieve. Recompute the actual nonlinear residual after an accepted step to discover whether the reduced model accuracy still suffices for useful outer progress.
If the finite-difference increment represents a physical parameter change that crosses a material switch, the required third derivative need not exist on the segment. A tidy numerical plateau across several step sizes can then obscure a change of branch. Verify that both directional evaluations use the same smooth model region before interpreting the calculated optimum increment.
Change parameters · Explore the worked calculation
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.