Newton’s Search Method
Source inspiration: (Mathew 2000-2019).
Description
Newton’s search method looks for a local minimum of a function \(f(\mathbf{X})\) of several variables, \(\mathbf{X} = (x_1, \ldots, x_n)\), whose first and second partial derivatives can be evaluated. At the current point \(\mathbf{P}_k\) it replaces \(f\) by its second-degree Taylor polynomial, which is built from the gradient \(\nabla f(\mathbf{P}_k)\) and the Hessian matrix \(\mathbf{H}(\mathbf{P}_k)\) of second partial derivatives, and moves to the point where the gradient of that quadratic is zero:
\[ \mathbf{P}_{k+1} = \mathbf{P}_k + \Delta\mathbf{P}_k, \qquad \mathbf{H}(\mathbf{P}_k)\,\Delta\mathbf{P}_k = -\nabla f(\mathbf{P}_k). \]
This is the Newton-Raphson method applied to the system \(\nabla f(\mathbf{X}) = \mathbf{0}\), with the Hessian playing the part of the Jacobian. With one variable it reduces to \(p_{k+1} = p_k - f'(p_k)/f''(p_k)\). Near a minimum where the Hessian is positive definite the iteration converges quadratically, and a quadratic \(f\) with a positive definite Hessian is minimised in a single step. But the method only looks for a zero of the gradient, so it converges just as readily to a saddle point or a maximum, and from a poor starting point it can run away altogether. Mathews works in two variables, \(\mathbf{P}_k = (x_k, y_k)\), so every run below is a path of points on the surface \(z = f(x, y)\), and every one has been recomputed in 60-digit arithmetic.
Animations
Each animation below draws Newton’s search method on a contour map of \(f\). The iterates \(\mathbf{P}_0, \mathbf{P}_1, \ldots\) are joined in order, and the stationary points are marked by type, found from the eigenvalues of the Hessian there: a star for a minimum, a cross for a saddle point, a triangle for a maximum. The titles give \(\mathbf{P}_k\), \(f(\mathbf{P}_k)\), the distance to the limit and whether \(\mathbf{H}(\mathbf{P}_k)\) is positive definite or indefinite, and frame \(k\) shows row \(k\) of the example’s table further down this page; Case 2 goes on to \(k = 10\), Mathews’ ten iterations, past the end of the table for \((-3, 2)\). The scripts iterate in 256-bit (about 77-digit) arithmetic, so every computed value in a title is correctly rounded to four significant figures. Cases 2 and 3 keep trailing zeros; Case 1 drops them; for example, its \(0.045\) stands for \(0.04500\) and its \(0.721\) for \(0.7210\). An independent run in 80-digit arithmetic produces the same title text in every frame.
Mathews’ module has no animation for this method. Neither the module page nor its notebook links to one, and the archive’s optimization animations (a2001/Animations/Optimization/) have none for Newton’s search, so all three animations are new, with no Mathews original. They use his examples and starting points, and the windows of his contour plots where the notebook gives one: \([-3, 3] \times [-0.5, 2]\) for Example 5 and \([-4, 4] \times [-4, 4]\) for Example 6. Examples 1 and 2 (a gradient, a Hessian and a Taylor polynomial at one point, with no iteration), Example 3 (a quadratic, minimised exactly in one step), Mathews’ comparison of \(f\) at four neighbours of \((1.0, 0.8)\) in Example 5, his FindMinimum comparisons (Examples 3 to 6), his plots of the vector field \(-\nabla f\) (Examples 5 and 6) and the enhanced method with a line search are not animated.
Julia source scripts that generated these animations are linked under each case.
Case 1 — Example 5, three minima and two saddle points, \(f(x, y) = 5x^2 + x^4 - 9x^2 y + 3y^2 + 2y^4 + \tfrac14 x\) (new)
Behavior: The five runs of Example 5 follow one another, \(25\) frames in all: the three minima from \((0, 0)\), \((2, 1.5)\) and \((-2, 1.5)\), with \(4\), \(5\) and \(5\) steps as in Mathews’ tables, then the two runs from \((1.0, 0.8)\) and \((-1.0, 0.8)\), with \(3\) steps each (Mathews runs \(5\) steps from \((1.0, 0.8)\), but steps \(4\) and \(5\) repeat \(\mathbf{P}_3\) to \(12\) decimals). The left panel keeps Mathews’ contour window and adds the two curves he plots separately, \(f_x = 0\) (dashed orange) and \(f_y = 0\) (dash-dot purple), whose five crossings are the stationary points. The right panel zooms on \(\mathbf{P}_j\), with axes in units of a power of ten that shrinks within each run (overall from \(10^{-1}\) down to \(10^{-29}\)), and draws the contours of \(f\) (grey) over those of the quadratic model \(Q\) at \(\mathbf{P}_j\) (dashed). The next iterate \(\mathbf{P}_{j+1}\) is the stationary point of \(Q\), at the end of the black arrow. In the three runs to a minimum, \(\mathbf{H}\) is positive definite at every iterate, the model’s contours are blue ellipses and each step goes to their centre. From \((1.0, 0.8)\) and \((-1.0, 0.8)\), \(\mathbf{H}\) is indefinite at every iterate (eigenvalues \(-4.79\) and \(33.75\) at both starts), the model’s contours are red hyperbolas, and each step goes to the saddle point of the model. Newton’s method converges just as fast to the saddle points \((0.9685, 0.7784)\) and \((-0.9021, 0.7210)\) of \(f\), and \(f\) goes up on the first step of both runs. At \(\mathbf{P}_0\) the contours of \(f\) and \(Q\) differ by up to \(5.6\%\) of the spread of \(Q\) across the zoom; from \(\mathbf{P}_2\) on they differ by less than \(0.1\%\) and the two sets of curves coincide. Each new iterate lands much closer to the limit than the last: in case (ii) the distances are \(0.172\), \(0.0450\), \(0.00203\), \(4.39 \times 10^{-6}\), \(2.07 \times 10^{-11}\) and \(4.59 \times 10^{-22}\).

Case 2 — Example 6, convergence from \((-0.3, 0.2)\) and divergence from \((-3, 2)\), \(f(x, y) = \dfrac{x - y}{x^2 + y^2 + 2}\) (new)
Behavior: The animation shows \(k = 0, \ldots, 10\). From \((-0.3, 0.2)\) (blue, in Mathews’ window on the left) the iterates reach the minimum \((-1, 1)\) with \(\mathbf{H}\) positive definite and \(f\) decreasing at every step. On the log scale at the bottom the error \(\lVert \mathbf{P}_k - (-1, 1) \rVert\) falls ever more steeply, through \(1.063\), \(0.1743\), \(0.0137\), \(1.893 \times 10^{-4}\), \(3.748 \times 10^{-8}\) and \(1.481 \times 10^{-15}\), while the ratio \(e_{k+1}/e_k^2\) rises from \(0.15\) to \(1.05\): quadratic convergence. Like Mathews, this run stops after \(5\) iterations. From \((-3, 2)\) (red) the first step already leaves Mathews’ window, to \(\mathbf{P}_1 = (-5.763, 3.579)\), so the left panel shows the path running off its edge, and the panel on the right, whose window widens every frame, holds the whole path. There \(\mathbf{H}\) is indefinite at every iterate and \(f\) rises at every step toward \(0\). The distance from the origin grows by the factors \(1.882\), \(1.571\), \(1.527\), \(1.511\), \(1.505\), \(1.502\), \(1.501\), \(1.500\), \(1.500\) and \(1.500\), to \(\lVert \mathbf{P}_{10} \rVert = 281.6\) at \(\mathbf{P}_{10} = (-241.0, 145.6)\), where \(f = -0.004876\).

Case 3 — Example 4, Rosenbrock’s function \(f(x, y) = 100(y - x^2)^2 + (1 - x)^2\) from \((0.99, 1.01)\) and \((1.8, 1.2)\) (new)
Behavior: Both runs are shown for \(k = 0, \ldots, 5\), with the valley floor \(y = x^2\) dashed. On the left is Mathews’ run from \((0.99, 1.01)\), in a window much smaller than his contour plot’s \([0.5, 1.5]^2\) so that the steps can be seen. \(\mathbf{H}(\mathbf{P}_0)\) is indefinite; the first step lands on the valley floor but moves away from \((1, 1)\), from a distance of \(0.01414\) to \(0.02673\). From then on \(\mathbf{H}\) is positive definite and the distances fall to \(1.636 \times 10^{-4}\), \(6.056 \times 10^{-7}\), \(8.305 \times 10^{-14}\) and \(1.571 \times 10^{-25}\). On the right is the run from \((1.8, 1.2)\), which starts outside Mathews’ window, in \([0.5, 2] \times [0, 3.5]\). \(\mathbf{H}\) is positive definite at every iterate, yet \(f\) does not decrease at every step. The first step goes up to the valley floor at \(\mathbf{P}_1 = (1.798, 3.233)\) and lowers \(f\) from \(416.8\) to \(0.6369\). The second jumps across the valley to \(\mathbf{P}_2 = (1.001, 0.3653)\) and raises \(f\) to \(40.44\), which the log-scale panel at the bottom marks. The third step returns to the floor at \((1.001, 1.001)\), and the run then converges to \(f(\mathbf{P}_5) = 4.045 \times 10^{-32}\). Newton’s method is not a descent method.

Gradient and Hessian
If \(f(x, y)\) has partial derivatives \(f_x\) and \(f_y\), its gradient is the vector function
\[ \nabla f(x, y) = \bigl(f_x(x, y),\ f_y(x, y)\bigr). \]
If \(f_1(x, y)\) and \(f_2(x, y)\) have partial derivatives, their Jacobian matrix is
\[ \mathbf{J}(x, y) = \begin{pmatrix} \dfrac{\partial f_1}{\partial x} & \dfrac{\partial f_1}{\partial y} \\[2mm] \dfrac{\partial f_2}{\partial x} & \dfrac{\partial f_2}{\partial y} \end{pmatrix}. \]
If \(f(x, y)\) has partial derivatives up to order two, its Hessian matrix is
\[ \mathbf{H}(x, y) = \begin{pmatrix} f_{xx}(x, y) & f_{xy}(x, y) \\ f_{yx}(x, y) & f_{yy}(x, y) \end{pmatrix}. \]
- The Hessian of \(f\) is the Jacobian of the two components of its gradient, \(f_1 = f_x\) and \(f_2 = f_y\): \(\ \mathbf{H}(x, y) = \mathbf{J}\bigl(f_x, f_y\bigr)\).
- If the second partial derivatives of \(f\) are continuous, then \(f_{xy} = f_{yx}\) and the Hessian is symmetric.
Example 1 — Gradient and Hessian of \(f(x, y) = (x - y)/(x^2 + y^2 + 2)\) at \((-3, -2)\)
Step 1 (first derivatives): by the quotient rule,
\[ f_x = -\frac{x^2 - 2xy - y^2 - 2}{(x^2 + y^2 + 2)^2}, \qquad f_y = -\frac{x^2 + 2xy - y^2 + 2}{(x^2 + y^2 + 2)^2}. \]
At \((-3, -2)\) the denominator is \(15^2 = 225\), and
\[ \nabla f(-3, -2) = \left(\frac{9}{225},\ -\frac{19}{225}\right) = \left(\frac{1}{25},\ -\frac{19}{225}\right) \approx (0.04,\ -0.084444). \]
Step 2 (second derivatives):
\[ \begin{aligned} f_{xx} &= \frac{2\,(x^3 - 3x^2 y - 3x y^2 + y^3 - 6x + 2y)}{(x^2 + y^2 + 2)^3}, \\ f_{xy} &= \frac{2\,(x^3 + 3x^2 y - 3x y^2 - y^3 + 2x - 2y)}{(x^2 + y^2 + 2)^3}, \\ f_{yy} &= -\frac{2\,(x^3 - 3x^2 y - 3x y^2 + y^3 + 2x - 6y)}{(x^2 + y^2 + 2)^3}. \end{aligned} \]
Step 3 (Hessian at the point): the denominator is \(15^3 = 3375\) and the three numerators are \(138\), \(-78\) and \(-122\), so
\[ \boxed{\ \mathbf{H}(-3, -2) = \frac{1}{3375}\begin{pmatrix} 138 & -78 \\ -78 & -122 \end{pmatrix} = \begin{pmatrix} \tfrac{46}{1125} & -\tfrac{26}{1125} \\[1mm] -\tfrac{26}{1125} & -\tfrac{122}{3375} \end{pmatrix} \approx \begin{pmatrix} 0.040889 & -0.023111 \\ -0.023111 & -0.036148 \end{pmatrix}\ } \]
The Hessian agrees with Mathews’ output. Verification: the derivatives above were checked symbolically against direct differentiation (the differences simplify to \(0\)). The Hessian here is indefinite: \(\det \mathbf{H}(-3, -2) = -1528/759375 < 0\), and its eigenvalues are \(-0.042550\) and \(0.047290\). Near \((-3, -2)\) the surface curves up in one direction and down in another, which matters in Example 2.
The Quadratic Taylor Polynomial
Expand \(f\) about the point \(\mathbf{P} = (p, q)\) and write \(\Delta p = x - p\), \(\Delta q = y - q\). In series notation the second-degree Taylor polynomial is
\[ Q(x, y) = f(p, q) + f_x(p, q)\,\Delta p + f_y(p, q)\,\Delta q + \tfrac12\Bigl(f_{xx}(p, q)\,\Delta p^2 + 2 f_{xy}(p, q)\,\Delta p\,\Delta q + f_{yy}(p, q)\,\Delta q^2\Bigr). \tag{1} \]
With \(\mathbf{X} = (x, y)\) and \(\Delta\mathbf{P} = \mathbf{X} - \mathbf{P} = (\Delta p, \Delta q)\), the same polynomial in vector and matrix notation is
\[ Q(\mathbf{X}) = f(\mathbf{P}) + \nabla f(\mathbf{P}) \cdot \Delta\mathbf{P} + \tfrac12\, \Delta\mathbf{P}\, \mathbf{H}(\mathbf{P})\, \Delta\mathbf{P}^{T}. \tag{2} \]
Form (2) holds unchanged for \(n\) variables, with \(\nabla f\) a vector of \(n\) first partial derivatives and \(\mathbf{H}\) the \(n \times n\) matrix of second partial derivatives.
Example 2 — Taylor polynomials of \(f(x, y) = (x - y)/(x^2 + y^2 + 2)\)
(a) Centre \(\mathbf{P} = (-3, -2)\). From Example 1, \(f(-3, -2) = -\tfrac{1}{15}\), so by (1)
\[ Q(x, y) = -\frac{1}{15} + \frac{x + 3}{25} - \frac{19\,(y + 2)}{225} + \frac{23\,(x + 3)^2}{1125} - \frac{26\,(x + 3)(y + 2)}{1125} - \frac{61\,(y + 2)^2}{3375}, \]
and expanding,
\[ \boxed{\ Q(x, y) = \frac{-481 + 393x + 69x^2 - 763y - 78xy - 61y^2}{3375}\ } \]
which is Mathews’ simplified form. Because \(\mathbf{H}(-3, -2)\) is indefinite, this quadratic is a saddle surface: it has no minimum. Its only stationary point is at \((-\tfrac{1791}{382}, -\tfrac{622}{191}) \approx (-4.688482, -3.256545)\), where \(f = -0.041401\), higher than \(f(-3, -2) = -0.066667\). A Newton step from \((-3, -2)\) would go there.
(b) Centre \(\mathbf{P} = (-0.3, 0.2)\), closer to the minimum. Here
\[ f(-0.3, 0.2) = -\frac{50}{213} \approx -0.234742, \qquad \nabla f(-0.3, 0.2) \approx (0.403359,\ -0.425401), \]
\[ \mathbf{H}(-0.3, 0.2) \approx \begin{pmatrix} 0.447659 & -0.195579 \\ -0.195579 & 0.380190 \end{pmatrix}, \]
and
\[ Q(x, y) \approx 0.010829 + 0.576773\,x - 0.560112\,y + 0.223830\,x^2 - 0.195579\,xy + 0.190095\,y^2 . \]
This Hessian is positive definite (eigenvalues \(0.215457\) and \(0.612392\)), so \(Q\) is a bowl. Its minimum is at \((-0.831690,\ 1.045402)\), with \(Q = -0.521790\) and \(f = -0.495985\) there. The true minimum of \(f\) is at \((-1, 1)\), where \(f = -\tfrac12\).
Verification: both expansions were recomputed symbolically from (2), and the stationary points of \(Q\) were found by solving \(\nabla Q = \mathbf{0}\) exactly. The two stationary points of \(f\) itself are \((-1, 1)\), a minimum with \(\mathbf{H} = \tfrac14 \mathbf{I}\), and \((1, -1)\), a maximum with \(f = \tfrac12\). As Mathews observes, when the centre is close to the minimum, the minimum of the quadratic is close to the minimum of the surface. That is the idea of Newton’s method, and the minimiser of \(Q\) in (b) is exactly the first Newton step \(\mathbf{P}_1\) of Example 6.
Newton’s Method for Finding a Minimum
Assume that the first and second partial derivatives of \(f\) are continuous near a minimum \(\mathbf{P}^*\) and that \(\mathbf{P}_0\) is close to it. The minimum of the quadratic approximation (2), centred at \(\mathbf{P}_0\), is where \(\nabla Q(\mathbf{X}) = \mathbf{0}\). Since \(\mathbf{H}\) is symmetric,
\[ \nabla Q(\mathbf{X}) = \nabla f(\mathbf{P}_0) + \Delta\mathbf{P}\, \mathbf{H}(\mathbf{P}_0), \]
so setting \(\nabla Q(\mathbf{X}) = \mathbf{0}\) gives \(\Delta\mathbf{P}\, \mathbf{H}(\mathbf{P}_0) = -\nabla f(\mathbf{P}_0)\). If \(\mathbf{H}(\mathbf{P}_0)\) is invertible,
\[ \mathbf{X} = \mathbf{P}_0 - \nabla f(\mathbf{P}_0)\, \bigl(\mathbf{H}(\mathbf{P}_0)\bigr)^{-1}. \]
This \(\mathbf{X}\) is the next approximation \(\mathbf{P}_1\). Repeating the construction at each new point gives Newton’s method for finding a minimum:
\[ \mathbf{P}_{k+1} = \mathbf{P}_k - \nabla f(\mathbf{P}_k)\, \bigl(\mathbf{H}(\mathbf{P}_k)\bigr)^{-1} \qquad \text{(row vectors)}, \tag{3} \]
\[ \mathbf{P}_{k+1}^{T} = \mathbf{P}_k^{T} - \bigl(\mathbf{H}(\mathbf{P}_k)\bigr)^{-1} \nabla f(\mathbf{P}_k)^{T} \qquad \text{(column vectors)}. \tag{4} \]
The two forms agree because \(\mathbf{H}\) is symmetric. Form (4) is the Newton-Raphson formula \(\mathbf{P}_{k+1}^{T} = \mathbf{P}_k^{T} - \mathbf{J}(\mathbf{P}_k)^{-1} \mathbf{F}(\mathbf{P}_k)^{T}\) for a root of the vector function \(\mathbf{F}(\mathbf{X}) = \nabla f(\mathbf{X})\), since by Lemma 1 its Jacobian is \(\mathbf{J} = \mathbf{H}\). For a function of one variable, (3) is \(p_{k+1} = p_k - f'(p_k)/f''(p_k)\): Newton-Raphson applied to \(f'(x) = 0\).
The theory of Newton-Raphson therefore carries over. The following is a general result, not a claim about any one example:
Suppose the second partial derivatives of \(f\) are continuous near \(\mathbf{P}^*\) and satisfy a Lipschitz condition there, that \(\nabla f(\mathbf{P}^*) = \mathbf{0}\), and that \(\mathbf{H}(\mathbf{P}^*)\) is nonsingular. Then there is a \(\delta > 0\) such that for every \(\mathbf{P}_0\) with \(\lVert \mathbf{P}_0 - \mathbf{P}^* \rVert < \delta\) the iterates (3) are defined, converge to \(\mathbf{P}^*\), and satisfy
\[ \lVert \mathbf{P}_{k+1} - \mathbf{P}^* \rVert \le C\, \lVert \mathbf{P}_k - \mathbf{P}^* \rVert^2 \]
for some constant \(C\). The point \(\mathbf{P}^*\) is a strict local minimum if \(\mathbf{H}(\mathbf{P}^*)\) is positive definite, a strict local maximum if it is negative definite, and a saddle point if it is indefinite.
The theorem does not require \(\mathbf{P}^*\) to be a minimum. Newton’s method treats every nondegenerate stationary point alike. Examples 5 and 6 show it converging quadratically to two saddle points and to a maximum, so the type of the limit has to be checked afterwards with the Hessian. Nor does the theorem say how small \(\delta\) is: Example 6 shows a starting point from which the iterates go off to infinity.
Algorithm
Start with an approximation \(\mathbf{P}_0\) to the minimum point \(\mathbf{P}^*\). Set \(k = 0\).
- Evaluate the gradient vector \(\nabla f(\mathbf{P}_k)\) and the Hessian matrix \(\mathbf{H}(\mathbf{P}_k)\).
- Solve the linear system \(\mathbf{H}(\mathbf{P}_k)\, \Delta\mathbf{P}_k^{T} = -\nabla f(\mathbf{P}_k)^{T}\) and set \(\mathbf{P}_{k+1} = \mathbf{P}_k + \Delta\mathbf{P}_k\).
- Perform the termination test: stop when \(\lVert \Delta\mathbf{P}_k \rVert\) and \(\lVert \nabla f(\mathbf{P}_{k+1}) \rVert\) are small enough. Otherwise set \(k = k + 1\) and repeat.
- Check the Hessian at the final point. If it is not positive definite, the point is not a local minimum.
Mathews’ formula (3) is written with the inverse of the Hessian, but as he notes, it is better to solve the linear system in step 2 with a linear system solver: the inverse is a theoretical tool, and computing it is inefficient. His program NewtonSearch runs a fixed number of iterations of (3) and prints each point and the value of \(f\) there; the tables below do the same.
Example 3 — A quadratic function: one step is exact
Use Newton’s method to find the minimum of
\[ f(x, y) = x^2 - 4x + y^2 - y - xy \]
starting from \(\mathbf{P}_0 = (0, 0)\).
Step 1: the gradient and Hessian are
\[ \nabla f(x, y) = (2x - y - 4,\ 2y - x - 1), \qquad \mathbf{H} = \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix}. \]
The Hessian is constant, with eigenvalues \(1\) and \(3\), so it is positive definite everywhere.
Step 2: at \(\mathbf{P}_0\), \(\nabla f(0, 0) = (-4, -1)\). Solve
\[ \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix} \begin{pmatrix} \Delta x \\ \Delta y \end{pmatrix} = \begin{pmatrix} 4 \\ 1 \end{pmatrix} \quad\Longrightarrow\quad \Delta\mathbf{P}_0 = (3,\ 2). \]
Step 3: \(\mathbf{P}_1 = (0, 0) + (3, 2) = (3, 2)\), and \(\nabla f(3, 2) = (6 - 2 - 4,\ 4 - 3 - 1) = (0, 0)\).
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | 0.000000000000 | 0.000000000000 | 0 | 3.61 | 4.12 |
| 1 | 3.000000000000 | 2.000000000000 | -7.000000000000 | 0 | 0 |
| 2 | 3.000000000000 | 2.000000000000 | -7.000000000000 | 0 | 0 |
\[ \boxed{\ \mathbf{P}^* = (3, 2), \qquad f(3, 2) = -7\ } \]
Mathews asks whether the result is surprising: the method converged in one iteration. It should, because the quadratic approximation of a quadratic surface is the surface itself, so the minimum of \(Q\) is the minimum of \(f\). Later iterations stay at \((3, 2)\).
Verification: \(\nabla f(3, 2) = (0, 0)\) and the Hessian is positive definite, so \((3, 2)\) is the minimum. Because \(\mathbf{H}\) is positive definite everywhere, \(f\) is convex and this is the global minimum.
Example 4 — Rosenbrock’s parabolic valley
Use Newton’s method to find the minimum of Rosenbrock’s function (circa 1960)
\[ f(x, y) = 100\,(y - x^2)^2 + (1 - x)^2 \]
starting from \(\mathbf{P}_0 = (0.99, 1.01)\). The minimum is at \((1, 1)\), where \(f = 0\). It lies in a long, curved valley along the parabola \(y = x^2\).
Step 1: the gradient and Hessian are
\[ \nabla f = \bigl(-400x(y - x^2) - 2(1 - x),\ \ 200(y - x^2)\bigr), \qquad \mathbf{H} = \begin{pmatrix} 1200x^2 - 400y + 2 & -400x \\ -400x & 200 \end{pmatrix}. \]
Step 2: at \(\mathbf{P}_0 = (0.99, 1.01)\), \(y - x^2 = 0.0299\) and \(f(\mathbf{P}_0) = 0.089501\), so
\[ \nabla f(\mathbf{P}_0) = (-11.8604,\ 5.98), \qquad \mathbf{H}(\mathbf{P}_0) = \begin{pmatrix} 774.12 & -396 \\ -396 & 200 \end{pmatrix}. \]
Step 3: solving \(\mathbf{H}(\mathbf{P}_0)\,\Delta\mathbf{P}_0^T = -\nabla f(\mathbf{P}_0)^T\) gives \(\Delta\mathbf{P}_0 = \bigl(-\tfrac{1}{498},\ -\tfrac{28117}{830000}\bigr) \approx (-0.002008,\ -0.033876)\), so
\[ \mathbf{P}_1 \approx (0.987992,\ 0.976124), \qquad f(\mathbf{P}_1) = 1.441945 \times 10^{-4}. \]
The full run of five iterations, Mathews’ setting:
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | 0.990000000000 | 1.010000000000 | 0.089501000000 | 0.0141 | 13.3 |
| 1 | 0.987991967871 | 0.976124096386 | 0.000144194461 | 0.0267 | 0.0224 |
| 2 | 0.999990324062 | 0.999836687667 | \(2.073 \times 10^{-6}\) | \(1.64 \times 10^{-4}\) | 0.0644 |
| 3 | 0.999999729206 | 0.999999458324 | \(7.333 \times 10^{-14}\) | \(6.06 \times 10^{-7}\) | \(5.07 \times 10^{-7}\) |
| 4 | 1.000000000000 | 1.000000000000 | \(5.377 \times 10^{-25}\) | \(8.30 \times 10^{-14}\) | \(3.28 \times 10^{-11}\) |
| 5 | 1.000000000000 | 1.000000000000 | \(4.937 \times 10^{-51}\) | \(1.57 \times 10^{-25}\) | \(1.31 \times 10^{-25}\) |
\[ \boxed{\ \mathbf{P}^* = (1, 1), \qquad f(1, 1) = 0\ } \]
Several things happen here:
- The Hessian at \(\mathbf{P}_0\) is not positive definite: \(\det \mathbf{H}(\mathbf{P}_0) = -1992\), with eigenvalues \(-2.04\) and \(976.16\). The first step still lowers \(f\), and it lands almost exactly on the valley floor (\(y_1 - x_1^2 = -4.0 \times 10^{-6}\), against \(0.0299\) at \(\mathbf{P}_0\)), but it moves away from \((1, 1)\): the distance grows from \(0.0141\) to \(0.0267\). From \(k = 1\) on, the Hessian is positive definite at every iterate.
- From then on the convergence is quadratic: the ratio \(\lVert \mathbf{P}_{k+1} - \mathbf{P}^* \rVert / \lVert \mathbf{P}_k - \mathbf{P}^* \rVert^2\) alternates between about \(0.23\) and about \(23\) instead of settling to one value, but it stays bounded, and the number of correct digits roughly doubles each step (\(1.6 \times 10^{-4}\), \(6.1 \times 10^{-7}\), \(8.3 \times 10^{-14}\), \(1.6 \times 10^{-25}\)).
- The function values in the table are computed in 60-digit arithmetic. A double-precision run gives the same points to the printed 12 decimals, but its last values of \(f\) are rounding noise. Mathews’ printout shows \(f = 5.40 \times 10^{-25}\) at \(k = 4\) and \(3.16 \times 10^{-30}\) at \(k = 5\); a double-precision rerun gives about \(5.4 \times 10^{-25}\) and then rounding noise between \(0\) and about \(10^{-27}\), depending on how the gradient and the Newton step are coded, while the exact values are \(5.38 \times 10^{-25}\) and \(4.9 \times 10^{-51}\).
Mathews compares the answer with Mathematica’s FindMinimum started at \((1.8, 1.2)\) and remarks that the function is “flat” near the minimum. In numbers: \(\mathbf{H}(1, 1) = \begin{pmatrix} 802 & -400 \\ -400 & 200 \end{pmatrix}\) has eigenvalues \(0.3994\) and \(1001.6\), so along the valley \(f\) rises about \(2500\) times more slowly than across it.
Variant — Newton from \((1.8, 1.2)\). Newton’s method from the same starting point as Mathews’ FindMinimum also converges, but not monotonically:
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) |
|---|---|---|---|---|
| 0 | 1.800000000000 | 1.200000000000 | 416.800000000000 | 0.825 |
| 1 | 1.798044009780 | 3.232958435208 | 0.636874243009 | 2.37 |
| 2 | 1.000610180058 | 0.365320019649 | 40.436972024463 | 0.635 |
| 3 | 1.000605419725 | 1.001211205961 | \(3.665 \times 10^{-7}\) | 0.00135 |
| 4 | 1.000000000003 | 0.999999633472 | \(1.343 \times 10^{-11}\) | \(3.67 \times 10^{-7}\) |
| 5 | 1.000000000000 | 1.000000000000 | \(4.045 \times 10^{-32}\) | \(4.50 \times 10^{-16}\) |
At \(k = 1\) the Hessian is positive definite (eigenvalues \(0.144\) and \(2788\)) and the Newton direction points downhill, yet the full step raises \(f\) from \(0.637\) to \(40.4\). Newton’s method is not a descent method: nothing in (3) forces \(f(\mathbf{P}_{k+1}) < f(\mathbf{P}_k)\). The line search of the enhanced method addresses this.
Verification: \(\nabla f(1, 1) = (0, 0)\), \(\mathbf{H}(1, 1)\) is positive definite, and \(f \ge 0\) everywhere with \(f(1, 1) = 0\), so \((1, 1)\) is the global minimum.
Example 5 — Three minima and two saddle points
Use Newton’s method to find the minima of
\[ f(x, y) = 5x^2 + x^4 - 9x^2 y + 3y^2 + 2y^4 + \tfrac14 x . \]
Mathews asks the reader to estimate the local minima from graphs of the surface and its contours on \(-3 \le x \le 3\), \(-0.5 \le y \le 2\), and then to plot the curves where each component of the gradient is zero:
\[ \nabla f = \bigl(4x^3 + 10x - 18xy + \tfrac14,\ \ -9x^2 + 6y + 8y^3\bigr), \qquad \mathbf{H} = \begin{pmatrix} 12x^2 - 18y + 10 & -18x \\ -18x & 24y^2 + 6 \end{pmatrix}. \]
The curve \(f_x = 0\) can be written \(y = (4x^3 + 10x + \tfrac14)/(18x)\), which has a vertical asymptote at \(x = 0\). The stationary points are the intersections of the two curves. Eliminating \(x\) gives a polynomial of degree 9 in \(y\) with exactly five real roots, and each gives one stationary point:
| Stationary point \((x, y)\) | \(f(x, y)\) | Eigenvalues of \(\mathbf{H}\) | Type |
|---|---|---|---|
| \((-2.181751873124,\ 1.606976562652)\) | \(-1.846282959604\) | \(11.086,\ 95.086\) | minimum (global) |
| \((-0.902145787276,\ 0.721019500722)\) | \(1.324987413902\) | \(-4.626,\ 29.891\) | saddle |
| \((-0.025036093327,\ 0.000940207845)\) | \(-0.003127252578\) | \(5.950,\ 10.041\) | minimum |
| \((0.968535517936,\ 0.778353659028)\) | \(1.792682348042\) | \(-4.765,\ 32.551\) | saddle |
| \((2.148212130319,\ 1.587535403973)\) | \(-0.763680059186\) | \(10.226,\ 93.063\) | minimum |
Newton’s method finds each of them from a nearby starting point.
Case (i) — The minimum near \((0, 0)\)
At \(\mathbf{P}_0 = (0, 0)\): \(\nabla f = (\tfrac14, 0)\) and \(\mathbf{H} = \begin{pmatrix} 10 & 0 \\ 0 & 6 \end{pmatrix}\), so \(\Delta\mathbf{P}_0 = (-\tfrac{1}{40}, 0)\), and
\[ \mathbf{P}_1 = (-0.025,\ 0), \qquad f(\mathbf{P}_1) = -\tfrac{7999}{2560000} = -0.003124609375 . \]
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | 0.000000000000 | 0.000000000000 | 0 | 0.0251 | 0.250 |
| 1 | -0.025000000000 | 0.000000000000 | -0.003124609375 | \(9.41 \times 10^{-4}\) | 0.00563 |
| 2 | -0.025036032084 | 0.000940202406 | -0.003127252578 | \(6.15 \times 10^{-8}\) | \(6.09 \times 10^{-7}\) |
| 3 | -0.025036093327 | 0.000940207845 | -0.003127252578 | \(5.73 \times 10^{-15}\) | \(3.41 \times 10^{-14}\) |
| 4 | -0.025036093327 | 0.000940207845 | -0.003127252578 | \(7.76 \times 10^{-30}\) | \(7.60 \times 10^{-29}\) |
Case (ii) — The minimum near \((2, 1.5)\)
At \(\mathbf{P}_0 = (2, 1.5)\): \(\nabla f = (-\tfrac74, 0)\) and \(\mathbf{H} = \begin{pmatrix} 31 & -36 \\ -36 & 60 \end{pmatrix}\), so \(\Delta\mathbf{P}_0 = (\tfrac{35}{188}, \tfrac{21}{188})\) and \(\mathbf{P}_1 = (\tfrac{411}{188}, \tfrac{303}{188}) \approx (2.186170,\ 1.611702)\).
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | 2.000000000000 | 1.500000000000 | -0.625000000000 | 0.172 | 1.75 |
| 1 | 2.186170212766 | 1.611702127660 | -0.752884718060 | 0.0450 | 0.506 |
| 2 | 2.149904635808 | 1.588649103038 | -0.763658971595 | 0.00203 | 0.0211 |
| 3 | 2.148215779408 | 1.587537848146 | -0.763680059087 | \(4.39 \times 10^{-6}\) | \(4.52 \times 10^{-5}\) |
| 4 | 2.148212130336 | 1.587535403985 | -0.763680059186 | \(2.07 \times 10^{-11}\) | \(2.12 \times 10^{-10}\) |
| 5 | 2.148212130319 | 1.587535403973 | -0.763680059186 | \(4.59 \times 10^{-22}\) | \(4.70 \times 10^{-21}\) |
Case (iii) — The minimum near \((-2, 1.5)\)
At \(\mathbf{P}_0 = (-2, 1.5)\): \(\nabla f = (\tfrac94, 0)\) and \(\mathbf{H} = \begin{pmatrix} 31 & 36 \\ 36 & 60 \end{pmatrix}\), so \(\Delta\mathbf{P}_0 = (-\tfrac{45}{188}, \tfrac{27}{188})\) and \(\mathbf{P}_1 = (-\tfrac{421}{188}, \tfrac{309}{188}) \approx (-2.239362,\ 1.643617)\).
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | -2.000000000000 | 1.500000000000 | -1.625000000000 | 0.211 | 2.25 |
| 1 | -2.239361702128 | 1.643617021277 | -1.818945395233 | 0.0683 | 0.849 |
| 2 | -2.185339669518 | 1.609338564133 | -1.846180011106 | 0.00430 | 0.0487 |
| 3 | -2.181767365472 | 1.606986963856 | -1.846282957671 | \(1.87 \times 10^{-5}\) | \(2.08 \times 10^{-4}\) |
| 4 | -2.181751873418 | 1.606976562851 | -1.846282959604 | \(3.54 \times 10^{-10}\) | \(3.94 \times 10^{-9}\) |
| 5 | -2.181751873124 | 1.606976562652 | -1.846282959604 | \(1.28 \times 10^{-19}\) | \(1.42 \times 10^{-18}\) |
In all three cases the iterates printed by Mathews agree with these to all 12 decimals, the Hessian is positive definite at every iterate, and \(f\) decreases at every step. In cases (ii) and (iii) the ratio \(\lVert \mathbf{P}_{k+1} - \mathbf{P}^* \rVert / \lVert \mathbf{P}_k - \mathbf{P}^* \rVert^2\) settles at about \(1.07\) and \(1.02\): the convergence is quadratic.
The saddle points — “extraneous solutions”
The plot of the two gradient curves on a larger window also shows intersections near \((1.0, 0.8)\) and \((-1.0, 0.8)\). (Mathews writes \((1.0, 0.8)\) for both; the second is near \((-1.0, 0.8)\).) Newton’s method started there converges just as fast, but to saddle points. (Mathews runs \(5\) steps from \((1.0, 0.8)\); steps \(4\) and \(5\) repeat \(\mathbf{P}_3\) to \(12\) decimals, so the table stops at \(k = 3\).)
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) |
|---|---|---|---|---|
| 0 | 1.000000000000 | 0.800000000000 | 1.789200000000 | 0.0382 |
| 1 | 0.968601543943 | 0.778409540776 | 1.792682331584 | \(8.65 \times 10^{-5}\) |
| 2 | 0.968535517874 | 0.778353659905 | 1.792682348042 | \(8.79 \times 10^{-10}\) |
| 3 | 0.968535517936 | 0.778353659028 | 1.792682348042 | \(1.92 \times 10^{-18}\) |
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) |
|---|---|---|---|---|
| 0 | -1.000000000000 | 0.800000000000 | 1.289200000000 | 0.126 |
| 1 | -0.902538598575 | 0.722738519398 | 1.325004299414 | 0.00176 |
| 2 | -0.902141346099 | 0.721018296482 | 1.324987413895 | \(4.60 \times 10^{-6}\) |
| 3 | -0.902145787278 | 0.721019500715 | 1.324987413902 | \(6.67 \times 10^{-12}\) |
In both runs \(f\) goes up on the first step, from \(1.7892\) to \(1.7927\) and from \(1.2892\) to \(1.3250\). At both starting points the Hessian is indefinite (eigenvalues \(-4.79\) and \(33.75\)), so the Newton step aims at the saddle of the local quadratic. Mathews says there is no way to tell from the iteration that a saddle point has been found. The iteration itself does give no warning, but the second-derivative test settles it: at both limits \(\mathbf{H}\) has one negative eigenvalue (see the table above).
Mathews shows that \((1.0, 0.8)\) is not a minimum by comparing \(f(1.0, 0.8) = 1.7892\) with \(f\) at four neighbours: \(f(1.1, 0.9) = 1.7303\) and \(f(0.9, 0.7) = 1.7783\) are smaller, while \(f(0.9, 0.9) = 2.1123\) and \(f(1.1, 0.7) = 2.1163\) are larger. That comparison is made at the starting point, which is not a stationary point (\(\nabla f(1.0, 0.8) = (-0.15, -0.104)\)), so it cannot classify the limit. The Hessian test at \((0.968536, 0.778354)\) does.
Verification: at each of the five limits, \(\lVert \nabla f \rVert\) falls below \(10^{-17}\) within five steps, and the Hessian eigenvalues in the stationary-point table classify them. The smallest value, \(f = -1.846283\) at \((-2.181752,\ 1.606977)\), is the global minimum.
Example 6 — Iterating to the minimum, and a starting point that fails
Given \(f(x, y) = \dfrac{x - y}{x^2 + y^2 + 2}\) (the function of Examples 1 and 2) and the initial point \(\mathbf{P}_0 = (-0.3, 0.2)\), use Newton’s method to find \(\mathbf{P}_1\) and \(\mathbf{P}_2\).
The plots of the gradient components show the two curves \(f_x = 0\) and \(f_y = 0\) crossing at \((-1, 1)\). Since \(f_x = 0\) means \(x^2 - 2xy - y^2 = 2\) and \(f_y = 0\) means \(x^2 + 2xy - y^2 = -2\), adding gives \(x^2 = y^2\) and subtracting gives \(xy = -1\), so the only stationary points are \((-1, 1)\) and \((1, -1)\).
Step 1 (find \(\mathbf{P}_1\)): the gradient and Hessian at \(\mathbf{P}_0\) are those of Example 2(b),
\[ \nabla f(\mathbf{P}_0) \approx (0.403359,\ -0.425401), \qquad \mathbf{H}(\mathbf{P}_0) \approx \begin{pmatrix} 0.447659 & -0.195579 \\ -0.195579 & 0.380190 \end{pmatrix}. \]
Solving \(\mathbf{H}(\mathbf{P}_0)\,\Delta\mathbf{P}_0^T = -\nabla f(\mathbf{P}_0)^T\) gives \(\Delta\mathbf{P}_0 \approx (-0.531690,\ 0.845402)\), so
\[ \mathbf{P}_1 = \left(-\tfrac{120279}{144620},\ \tfrac{10799}{10330}\right) \approx (-0.831690,\ 1.045402), \qquad f(\mathbf{P}_1) = -0.495985 . \]
Step 2 (find \(\mathbf{P}_2\)): at \(\mathbf{P}_1\),
\[ \nabla f(\mathbf{P}_1) \approx (0.0462373,\ 0.00977846), \qquad \mathbf{H}(\mathbf{P}_1) \approx \begin{pmatrix} 0.302753 & -0.0212462 \\ -0.0212462 & 0.251305 \end{pmatrix}, \]
\(\Delta\mathbf{P}_1 \approx (-0.156381,\ -0.0521319)\), and
\[ \mathbf{P}_2 \approx (-0.988071,\ 0.993270), \qquad f(\mathbf{P}_2) = -0.499976 . \]
Continuing with NewtonSearch for five iterations:
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k - \mathbf{P}^* \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|
| 0 | -0.300000000000 | 0.200000000000 | -0.234741784038 | 1.06 | 0.586 |
| 1 | -0.831689946066 | 1.045401742498 | -0.495985069819 | 0.174 | 0.0473 |
| 2 | -0.988071251848 | 0.993269887406 | -0.499976331616 | 0.0137 | 0.00347 |
| 3 | -0.999844582140 | 0.999891872331 | -0.499999995519 | \(1.89 \times 10^{-4}\) | \(4.73 \times 10^{-5}\) |
| 4 | -0.999999970566 | 0.999999976795 | -0.500000000000 | \(3.75 \times 10^{-8}\) | \(9.37 \times 10^{-9}\) |
| 5 | -1.000000000000 | 1.000000000000 | -0.500000000000 | \(1.48 \times 10^{-15}\) | \(3.70 \times 10^{-16}\) |
\[ \boxed{\ \mathbf{P}^* = (-1, 1), \qquad f(-1, 1) = -\tfrac12\ } \]
The Hessian is positive definite at every iterate, \(f\) decreases at every step, and the ratio \(\lVert \mathbf{P}_{k+1} - \mathbf{P}^* \rVert / \lVert \mathbf{P}_k - \mathbf{P}^* \rVert^2\) rises from \(0.15\) to \(1.05\): quadratic convergence.
Verification: \(\nabla f(-1, 1) = (0, 0)\) and \(\mathbf{H}(-1, 1) = \tfrac14 \mathbf{I}\) is positive definite. Since \(f \to 0\) far from the origin and the only other stationary point is the maximum \((1, -1)\), \(f(-1, 1) = -\tfrac12\) is the global minimum.
The starting point \((-3, 2)\): divergence
Mathews’ caveat: Newton’s method requires a good initial point, as does the Newton-Raphson method for \(f(x) = 0\). From \(\mathbf{P}_0 = (-3, 2)\) it fails. There
\[ \nabla f(-3, 2) = \left(-\tfrac{1}{15},\ \tfrac{1}{45}\right), \qquad \mathbf{H}(-3, 2) = \frac{1}{675}\begin{pmatrix} -6 & 18 \\ 18 & 22 \end{pmatrix}, \]
an indefinite matrix (eigenvalues \(-0.0219\) and \(0.0456\)). The Newton step is \(\Delta\mathbf{P}_0 = (-\tfrac{105}{38}, \tfrac{30}{19})\), which leads away from the minimum, to \(\mathbf{P}_1 = (-\tfrac{219}{38}, \tfrac{68}{19}) \approx (-5.763158,\ 3.578947)\), and \(f\) rises from \(-\tfrac13\) to \(-0.194535\).
| \(k\) | \(x_k\) | \(y_k\) | \(f(x_k, y_k)\) | \(\lVert \mathbf{P}_k \rVert\) | \(\lVert \mathbf{P}_k \rVert / \lVert \mathbf{P}_{k-1} \rVert\) | \(\lVert \nabla f(\mathbf{P}_k) \rVert\) |
|---|---|---|---|---|---|---|
| 0 | -3.000000 | 2.000000 | -0.333333 | 3.61 | – | 0.0703 |
| 1 | -5.763158 | 3.578947 | -0.194535 | 6.78 | 1.8815 | 0.0271 |
| 2 | -9.092918 | 5.555381 | -0.126777 | 10.7 | 1.5707 | 0.0118 |
| 3 | -13.905287 | 8.441827 | -0.083816 | 16.3 | 1.5266 | 0.00523 |
| 4 | -21.027684 | 12.731649 | -0.055685 | 24.6 | 1.5111 | 0.00232 |
| 5 | -31.652676 | 19.142452 | -0.037068 | 37.0 | 1.5048 | 0.00103 |
| 6 | -47.552539 | 28.743391 | -0.024696 | 55.6 | 1.5021 | \(4.57 \times 10^{-4}\) |
The distance from the origin grows at every step, by a factor that approaches \(1.5\) (it is \(1.5000\) to five digits from \(k = 11\) on, in a run of 80 steps), \(f\) increases at every step toward \(0\), and the gradient shrinks toward \(\mathbf{0}\). After Mathews’ ten iterations the point is \((-241.019696,\ 145.628489)\), with \(f = -0.004876\). Newton’s method is “diverging to the point at infinity”, in Mathews’ words. Far from the origin the surface flattens out and its gradient tends to zero, and the iteration chases that flat region instead of a stationary point. The Hessian is indefinite at every iterate computed (\(k = 0\) to \(12\)), and at each of them the Newton step points uphill (\(\nabla f \cdot \Delta\mathbf{P}_k > 0\)).
Convergence to a maximum
Because \(f(-x, -y) = -f(x, y)\), the gradient satisfies \(\nabla f(-\mathbf{X}) = \nabla f(\mathbf{X})\) and the Hessian \(\mathbf{H}(-\mathbf{X}) = -\mathbf{H}(\mathbf{X})\), so the Newton step from \(-\mathbf{P}\) is exactly the negative of the step from \(\mathbf{P}\). Started at \((0.3, -0.2)\), Newton’s method therefore produces the negatives of the iterates in the table above, \((0.831690, -1.045402)\), \((0.988071, -0.993270)\), \(\ldots\), and converges just as quickly to \((1, -1)\), where \(f = \tfrac12\) is the maximum (\(\mathbf{H}(1, -1) = -\tfrac14 \mathbf{I}\)). In one variable the same holds in general: by the theorem with \(n = 1\), \(p_{k+1} = p_k - f'(p_k)/f''(p_k)\) started close enough to a maximum, where \(f'' < 0\), converges to that maximum.
Convergence in the Examples
The ratio \(e_{k+1}/e_k^2\), where \(e_k = \lVert \mathbf{P}_k - \mathbf{P}^* \rVert\), stays bounded in every converging run, which is what quadratic convergence means. It was measured in 400-digit arithmetic over the first seven steps (in some runs the first one or two ratios, taken far from \(\mathbf{P}^*\), are left out):
| Run | Limit | Type | \(e_{k+1}/e_k^2\) |
|---|---|---|---|
| Example 4 from \((0.99, 1.01)\) | \((1, 1)\) | minimum | alternates \(\approx 0.23\) and \(\approx 23\) |
| Example 4 from \((1.8, 1.2)\) | \((1, 1)\) | minimum | alternates \(\approx 0.0034\) and \(\approx 0.20\) |
| Example 5 (i) from \((0, 0)\) | \((-0.025036, 0.000940)\) | minimum | between \(0.07\) and \(1.52\) |
| Example 5 (ii) from \((2, 1.5)\) | \((2.148212, 1.587535)\) | minimum | \(\to 1.07\) |
| Example 5 (iii) from \((-2, 1.5)\) | \((-2.181752, 1.606977)\) | minimum | \(\to 1.017\) |
| Example 5 from \((1.0, 0.8)\) | \((0.968536, 0.778354)\) | saddle | between \(0.06\) and \(3.25\) |
| Example 5 from \((-1.0, 0.8)\) | \((-0.902146, 0.721020)\) | saddle | between \(0.25\) and \(3.1\) |
| Example 6 from \((-0.3, 0.2)\) | \((-1, 1)\) | minimum | \(\to 1.06\) |
The local estimates of the order, \(\log(e_{k+1}/e_k) / \log(e_k/e_{k-1})\), approach \(2\) in every one of these runs. In Example 3 the error is zero after one step.
Enhanced Newton Method for Finding a Minimum
Newton’s method can be modified by treating \(\mathbf{S}_k = -\nabla f(\mathbf{P}_k)\,\bigl(\mathbf{H}(\mathbf{P}_k)\bigr)^{-1}\) as a search direction, as the gradient method uses the direction \(-\nabla f(\mathbf{P}_k)\), and doing a one-parameter minimisation (line search) along it:
- Evaluate the gradient vector \(\nabla f(\mathbf{P}_k)\) and the Hessian matrix \(\mathbf{H}(\mathbf{P}_k)\).
- Compute the search direction \(\mathbf{S}_k = -\nabla f(\mathbf{P}_k)\,\bigl(\mathbf{H}(\mathbf{P}_k)\bigr)^{-1}\).
- Minimise the function of one variable \(\phi(t) = f(\mathbf{P}_k + t\,\mathbf{S}_k)\), for instance with a golden ratio or quadratic interpolative search, giving a value \(t_k\). This is a minimum of \(f\) along the search line; at an interior minimum \(\phi'(t_k) = \nabla f(\mathbf{P}_k + t_k\,\mathbf{S}_k) \cdot \mathbf{S}_k = 0\), so the gradient at the new point is perpendicular to the line.
- Set \(\mathbf{P}_{k+1} = \mathbf{P}_k + t_k\,\mathbf{S}_k\).
- Perform the termination test: are \(f(\mathbf{P}_k)\) and \(f(\mathbf{P}_{k+1})\) sufficiently close, and is \(\lVert \mathbf{P}_{k+1} - \mathbf{P}_k \rVert\) small enough? If not, set \(k = k + 1\) and repeat.
With \(t_k = 1\) this is the plain method (3). In general, Mathews says, the modified method is more reliable, and he leaves its investigation to the reader. Two of the runs above show what the line search can and cannot fix:
- In the Example 4 variant from \((1.8, 1.2)\), the direction at \(k = 1\) points downhill but the full step overshoots and raises \(f\) from \(0.637\) to \(40.4\). A line search along that direction would pick a step that lowers \(f\).
- From \((-3, 2)\) in Example 6, \(\mathbf{S}_k\) points uphill at every iterate. If \(\mathbf{H}(\mathbf{P}_k)\) is positive definite, then \(\nabla f \cdot \mathbf{S}_k = -\nabla f\, \mathbf{H}^{-1} \nabla f^{T} < 0\) and \(\mathbf{S}_k\) is a descent direction, but here \(\mathbf{H}\) is indefinite. A line search over \(t > 0\) along an uphill direction cannot lower \(f\). The direction itself has to be changed, for example to \(-\nabla f(\mathbf{P}_k)\) or to the Newton direction of a modified, positive definite Hessian.
Implementation Notes
- Solve, don’t invert. Compute \(\Delta\mathbf{P}_k\) from \(\mathbf{H}(\mathbf{P}_k)\,\Delta\mathbf{P}_k^T = -\nabla f(\mathbf{P}_k)^T\) with a linear solver (for example a Cholesky factorisation, which also reports whether \(\mathbf{H}\) is positive definite).
- Cost per step. Each iteration needs the \(n\) first partial derivatives, the \(n(n+1)/2\) distinct second partial derivatives and the solution of an \(n \times n\) system. The gradient method needs only the first derivatives but generally converges much more slowly.
- Check what was found. The iteration stops where \(\nabla f = \mathbf{0}\), and that can be a saddle point (Example 5) or a maximum (Example 6). Test the Hessian at the final point.
- Watch the starting point. Convergence is guaranteed only from close enough to \(\mathbf{P}^*\). Signs of trouble are a Hessian that is not positive definite and a step that increases \(f\) (Example 6 from \((-3, 2)\)). A safeguarded version takes a line search along the Newton direction, and falls back to \(-\nabla f\) when that direction is not downhill.
- Termination. Use \(\lVert \nabla f(\mathbf{P}_k) \rVert\) and \(\lVert \Delta\mathbf{P}_k \rVert\), not only the change in \(f\). Near a minimum \(f(\mathbf{P}) - f(\mathbf{P}^*) \approx \tfrac12 (\mathbf{P} - \mathbf{P}^*)\,\mathbf{H}\,(\mathbf{P} - \mathbf{P}^*)^T\) is quadratic in the error, so the values of \(f\) settle long before the point does. In Example 6 the printed \(f(\mathbf{P}_4)\) is already \(-0.500000000000\) while \(\mathbf{P}_4\) is still \(3.7 \times 10^{-8}\) from \((-1, 1)\).
- Flat valleys. When the Hessian at the minimum is badly conditioned (eigenvalues \(0.40\) and \(1002\) for Rosenbrock’s function), function values alone locate the minimum poorly along the valley. Newton’s method still converges quickly there, because it uses the curvature in each direction.