Numerical AnalysisSolving Equations

Newton's Method for Systems

Solve J(x) Δ = −F(x) with the Jacobian matrix J, then update x to x + Δ.

Not started Jump to practice

To solve several equations in several unknowns, $\mathbf{F}(\mathbf{x}) = \mathbf{0}$, Newton's idea carries over: replace $\mathbf{F}$ by its linear approximation and solve that. The derivative becomes a matrix of Partial Derivatives, and dividing by it becomes solving a linear system, which you know from Inverses by Gauss–Jordan. Its convergence matches Newton's method in one variable.

For $\mathbf{F} = (F_1, \ldots, F_n)$, the Jacobian $J(\mathbf{x})$ is the $n \times n$ matrix with $$J_{ij} = \frac{\partial F_i}{\partial x_j}:$$ row $i$ holds the partial derivatives of $F_i$.

Key idea

Newton's method for systems: solve $$J(\mathbf{x}_k)\,\boldsymbol{\Delta} = -\mathbf{F}(\mathbf{x}_k),$$ then set $\mathbf{x}_{k+1} = \mathbf{x}_k + \boldsymbol{\Delta}$. Near a root where $J$ is invertible it converges quadratically.

Why it works

Linearize: $\mathbf{F}(\mathbf{x}_k + \boldsymbol{\Delta}) \approx \mathbf{F}(\mathbf{x}_k) + J(\mathbf{x}_k)\boldsymbol{\Delta}$. Setting the right side to $\mathbf{0}$ gives the linear system for the step. Writing $\boldsymbol{\Delta} = -J^{-1}\mathbf{F}$ shows the analogy with $-\frac{f}{f'}$, but in practice one solves the system by elimination; forming $J^{-1}$ costs more and is less accurate.

Worked example: One step

Solve $x^{2} + y^{2} = 4$, $xy = 1$, starting from $(2, 1)$.
  1. $\mathbf{F} = (x^{2} + y^{2} - 4,\ xy - 1)$ and $J = \begin{bmatrix} 2x & 2y \\ y & x \end{bmatrix}$.
  2. At $(2, 1)$: $\mathbf{F} = (1, 1)$ and $J = \begin{bmatrix} 4 & 2 \\ 1 & 2 \end{bmatrix}$.
  3. Solve $\begin{bmatrix} 4 & 2 \\ 1 & 2 \end{bmatrix}\boldsymbol{\Delta} = \begin{bmatrix} -1 \\ -1 \end{bmatrix}$: subtracting the equations gives $3\Delta_1 = 0$, so $\Delta_1 = 0$ and $\Delta_2 = -\frac{1}{2}$.
  4. $\mathbf{x}_1 = (2, 0.5)$.

Answer: $(2, 0.5)$

Worked example: Watching it converge

Continue the same iteration.
  1. At $(2, 0.5)$: $\mathbf{F} = (0.25, 0)$ and $J = \begin{bmatrix} 4 & 1 \\ 0.5 & 2 \end{bmatrix}$, giving $\boldsymbol{\Delta} \approx (-0.0667, 0.0167)$ and $\mathbf{x}_2 \approx (1.93333, 0.51667)$.
  2. One more step: $\mathbf{x}_3 \approx (1.931853, 0.517637)$.
  3. The root is $x = \sqrt{2 + \sqrt{3}} \approx 1.931852$, $y = \frac{1}{x} \approx 0.517638$. Errors: about $7 \times 10^{-2}$, $1.5 \times 10^{-3}$, $1 \times 10^{-6}$: digits roughly doubling.

Answer: $\approx (1.931852, 0.517638)$

The circle x² + y² = 4 and the hyperbola xy = 1 meet in four points. Newton's method from (2, 1) heads for the one near (1.93, 0.52).

Each step costs more than in one variable. Building $J$ takes $n^{2}$ partial derivatives, and solving the linear system by elimination takes about $\frac{2}{3}n^{3}$ operations (see The Cost of Elimination). For large systems, methods that update an approximate Jacobian instead of recomputing it (quasi-Newton methods) are common.

Plotting the curves first, as above, is a good way to choose a starting point. A system can have several roots; which one Newton's method finds depends on the start. Here the curves meet in four points, $(\pm 1.93, \pm 0.52)$ and $(\pm 0.52, \pm 1.93)$ with matching signs, and the start $(2, 1)$ leads to the nearest one. A sketch of the curves is the best way to choose starting guesses.

Common mistake

Putting the partial derivatives in the wrong places, or forgetting the minus sign. Row $i$ of $J$ holds $\frac{\partial F_i}{\partial x}, \frac{\partial F_i}{\partial y}, \ldots$; the system is $J\boldsymbol{\Delta} = -\mathbf{F}$. Check: if $\mathbf{F}$ were linear, $\mathbf{F}(\mathbf{x}) = A\mathbf{x} - \mathbf{b}$, one Newton step from anywhere must land exactly on the solution.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.

Loading practice…

Builds on

Leads to

This is one of the top rungs of Numerical Analysis.

Sources and further reading

  • Tobin A. Driscoll and Richard J. Braun, Fundamentals of Numerical Computation (University of Delaware, free online edition): chapter "Roots of nonlinear equations", section "Newton for nonlinear systems"
  • MIT OpenCourseWare 18.330, Introduction to Numerical Analysis: lecture notes on Newton's method for systems
@teddyrookbook GitHub