ArticleslgStudy

computer science

Newton's method in optimization

Newton's method in optimization is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Newton's method in optimization rather than just read about it. In short: In calculus, Newton's method (also called Newton–Raphson) is an iterative method for finding the roots of a differentiable function f, which are solutions to the equation f(x)=0. However, to optimize a twice-differentiable f, our goal is to find the roots of f′.

Newton's method in optimization — main illustration
Newton's method in optimization — illustration

Key takeaways

  • Newton's method in optimization belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Newton's method in optimization to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Newton's method in optimization from memory before moving on to harder problems.

Reference excerpt

In calculus, Newton's method (also called Newton–Raphson) is an iterative method for finding the roots of a differentiable function f, which are solutions to the equation f(x)=0. However, to optimize a twice-differentiable f, our goal is to find the roots of f′. We can therefore use Newton's method on its derivative f′ to find solutions to f′(x)=0, also known as the critical points of f. These solutions may be minima, maxima, or saddle points; see section "Several variables" in Critical point (mathematics) and also section "Geometric interpretation" in this article. This is relevant in optimization, which aims to find (global) minima of the function f.

Newton's method The central problem of optimization is minimization of functions. Let us first consider the case of univariate functions, i.e., functions of a single real variable. We will later consider the more general and more practically useful multivariate case. Given a twice differentiable function f:ℝ→ℝ, we seek to solve the optimization problem

minx∈ℝf(x). Newton's method attempts to solve this problem by constructing a sequence {xk} from an initial guess (starting point) x0∈ℝ that converges towards a minimizer x∗ of f by using a sequence of second-order Taylor approximations of f around the iterates. The second-order Taylor expansion of f around xk is

f(xk+t)≈f(xk)+f′(xk)t+12f″(xk)t2. The next iterate xk+1 is defined so as to minimize this quadratic approximation in t, and setting xk+1=xk+t. If the second derivative is positive, the quadratic approximation is a convex function of t, and its minimum can be found by setting the derivative to zero. Since

0=ddt(f(xk)+f′(xk)t+12f″(xk)t2)=f′(xk)+f″(xk)t, the minimum is achieved for

t=−f′(xk)f″(xk). Putting everything together, Newton's method performs the iteration

xk+1=xk+t=xk−f′(xk)f″(xk).

Geometric interpretation The geometric interpretation of Newton's method is that at each iteration, it amounts to the fitting of a parabola to the graph of f(x) at the trial value xk, having the same slope and curvature as the graph at that point, and then proceeding to the maximum or minimum of that parabola (in higher dimensions, this may also be a saddle point), see below. Note that if f 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 d>1 dimensions by replacing the derivative with the gradient (different authors use different notation for the gradient, including f′(x)=∇f(x)=gf(x)∈ℝd), and the reciprocal of the second derivative with the inverse of the Hessian matrix (different authors use different notation for the Hessian, including f″(x)=∇2f(x)=Hf(x)∈ℝd×d). One thus obtains the iterative scheme

xk+1=xk−[f″(xk)]−1f′(xk),k≥0. Often Newton's method is modified to include a small step size 0<γ≤1 instead of γ=1:

xk+1=xk−γ[f″(xk)]−1f′(xk). This is often done to ensure that the Wolfe conditions, or much simpler and efficient Armijo's condition, are satisfied at each step of the method. For step sizes other than 1, the method is often referred to as the relaxed or damped Newton's method.

Convergence If f is a strongly convex function with Lipschitz Hessian, then provided that x0 is close enough to x∗=arg⁡min⁡f(x), the sequence x0,x1,x2,… generated by Newton's method will converge to the (necessarily unique) minimizer x∗ of f quadratically fast. That is,

‖xk+1−x∗‖≤12‖xk−x∗‖2,∀k≥0.

Computing the Newton direction Finding the inverse of the Hessian in high dimensions to compute the Newton direction h=−(f″(xk))−1f′(xk) can be an expensive operation. In such cases, instead of directly inverting the Hessian, it is better to calculate the vector h as the solution to the system of linear equations

[f″(xk)]h=−f′(xk) 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 f″(xk) is a positive definite matrix. While this may seem like a limitation, it is often a useful indicator of something gone wrong; for example if a minimization problem is being approached and f″(xk) 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 xk+1 will need to be done with a method that will work for such, such as the LDL⊤ 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 Bk so as to make f″(xk)+Bk positive definite. One approach is to diagonalize the Hessian and choose Bk so that f″(xk)+Bk has the same eigenvectors as the Hessian, but with each negative eigenvalue replaced by ϵ>0. An approach exploited in the Levenberg–Marquardt algorithm (which uses an approximate Hessian) is to add a scaled identity matrix to the Hessian, μI, with the scale adjusted at every iteration as needed. For large μ and small Hessian, the iterations will behave like gradient descent with step size 1/μ. This results in slower but more reliable convergence where the Hessian doesn't provide useful information.

Some caveats Newton's method, in its original version, has several caveats:

… excerpt ends here. Continue reading the full article.

Illustrations

Newton's method in optimization: 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 (i.e. the second derivative) to take a more direct route.
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 (i.e. the second derivative) to take a more direct route.

Worked examples

Example 1 — a first encounter with Newton's method in optimization

Start with the simplest possible case. Write down what Newton's method in optimization claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Newton's method in optimization before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Newton's method in optimization ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Newton's method in optimization

In research
Newton's method in optimization appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Newton's method in optimization in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Newton's method in optimization is common in secondary-school and first-year university syllabi. It links to neighbouring topics Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Newton's method in optimization outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Newton's method in optimization” →

How to study Newton's method in optimization in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Newton's method in optimization means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Newton's method in optimization out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Newton's method in optimization in simple terms?

In calculus, Newton's method (also called Newton–Raphson) is an iterative method for finding the roots of a differentiable function f, which are solutions to the equation f(x)=0. However, to optimize a twice-differentiable f, our goal is to find the roots of f′.

Why does Newton's method in optimization matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Newton's method in optimization?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Newton's method in optimization.

Tags

  • Optimization algorithms and methods

Keep exploring