# Newton's method in optimization

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff) A comparison of gradient descent (green) and Newton's method (red) for minimizing a function (with small step sizes). Newton's method uses curvature information to take a more direct route.

## Method

and attains its extremum when its derivative with respect to $\Delta x$ is equal to zero, i.e. when:

## Geometric interpretation

The geometric interpretation of Newton's method is that at each iteration one approximates $f(\mathbf {x} )$ by a quadratic function around $\mathbf {x} _{n}$ , and then takes a step towards the maximum/minimum of that quadratic function (in higher dimensions, this may also be a saddle point). Note that if $f(\mathbf {x} )$ happens to be a quadratic function, then the exact extremum is found in one step.

## Higher dimensions

The above iterative scheme can be generalized to several dimensions by replacing the derivative with the gradient, $\nabla f(\mathbf {x} )$ , and the reciprocal of the second derivative with the inverse of the Hessian matrix, $Hf(\mathbf {x} )$ . One obtains the iterative scheme

$\mathbf {x} _{n+1}=\mathbf {x} _{n}-[Hf(\mathbf {x} _{n})]^{-1}\nabla f(\mathbf {x} _{n}),\ n\geq 0.$ $\mathbf {x} _{n+1}=\mathbf {x} _{n}-\gamma [Hf(\mathbf {x} _{n})]^{-1}\nabla f(\mathbf {x} _{n}).$ This is often done to ensure that the Wolfe conditions are satisfied at each step $\mathbf {x} _{n}\to \mathbf {x} _{n+1}$ of the iteration.

Where applicable, Newton's method converges much faster towards a local maximum or minimum than gradient descent. In fact, every local minimum has a neighborhood $N$ such that, if we start with $\mathbf {x} _{0}\in N,$ Newton's method with step size $\gamma =1$ converges quadratically (if the Hessian is invertible and a Lipschitz continuous function of $\mathbf {x}$ in that neighborhood).

Finding the inverse of the Hessian in high dimensions can be an expensive operation. In such cases, instead of directly inverting the Hessian it's better to calculate the vector $\mathbf {p} _{n}=[Hf(\mathbf {x} _{n})]^{-1}\nabla f(\mathbf {x} _{n})$ as the solution to the system of linear equations

$[Hf(\mathbf {x} _{n})]\mathbf {p} _{n}=\nabla f(\mathbf {x} _{n})$ which may be solved by various factorizations or approximately (but to great accuracy) using iterative methods. Many of these methods are only applicable to certain types of equations, for example the Cholesky factorization and conjugate gradient will only work if $[Hf(\mathbf {x} _{n})]$ is a positive definite matrix. While this may seem like a limitation, it's often useful indicator of something gone wrong, for example if a minimization problem is being approached and $[Hf(\mathbf {x} _{n})]$ is not positive definite, then the iterations are converging to a saddle point and not a minimum.

On the other hand, if a constrained optimization is done (for example, with Lagrange multipliers), the problem may become one of saddle point finding, in which case the Hessian will be symmetric indefinite and the solution of $\mathbf {p} _{n}$ will need to be done with a method that will work for such, such as the LDLT variant of Cholesky factorization or the conjugate residual method.

There also exist various quasi-Newton methods, where an approximation for the Hessian (or its inverse directly) is built up from changes in the gradient.

If the Hessian is close to a non-invertible matrix, the inverted Hessian can be numerically unstable and the solution may diverge. In this case, certain workarounds have been tried in the past, which have varied success with certain problems. One can, for example, modify the Hessian by adding a correction matrix $B_{n}$ so as to make $H_{f}(\mathbf {x} _{n})+B_{n}$ positive definite. One approach is to diagonalize $H_{f}$ and choose $B_{n}$ so that $H_{f}(\mathbf {x} _{n})+B_{n}$ has the same eigenvectors as $H_{f}$ , but with each negative eigenvalue replaced by $\epsilon >0.$ An approach exploited in the Levenberg–Marquardt algorithm (which uses an approximate Hessian) is to add a scaled identity matrix to the Hessian, $\mu \mathbf {I}$ , with the scale adjusted at every iteration as needed. For large $\mu$ and small Hessian, the iterations will behave like gradient descent with step size ${\frac {1}{\mu }}$ . This results in slower but more reliable convergence where the Hessian doesn't provide useful information.