maths.free › Numerical Methods › Finding roots › Newton's method
Newton's method
In numerical analysis, the Newton–Raphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the…
Newton's method
In numerical analysis, the Newton-Raphson method, also known simply as Newton's method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real-valued function. The most basic version starts with a real-valued function f, its derivative f′, and an initial guess x0 for a root of f. If f satisfies certain assumptions and the initial guess is close, then
\[x_{1} = x_0 - \frac{f(x_0)}{f'(x_0)}\]
is a better approximation of the root than x0. Geometrically, (x1, 0) is the x-intercept of the tangent to the graph of f at (x0, f(x0)): that is, the improved guess, x1, is the unique root of the linear approximation of f at the initial guess, x0. The process is repeated as
\[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\]
until a sufficiently precise value is reached. The number of correct digits roughly doubles with each step. This algorithm is first in the class of Householder's methods, and was succeeded by Halley's method. The method can also be extended to complex functions and to systems of equations.
Description
The purpose of Newton's method is to find a root of a function. The idea is to start with an initial guess near a root, approximate the function by its tangent line near the guess, and then take the root of the linear approximation as a next guess at the function's root. This will typically be closer to the function's root than the previous guess, and the method can be iterated.
The best linear approximation to an arbitrary differentiable function \(f(x)\) near the point \(x = x_{n}\) is the tangent line to the curve, with equation
\[f(x) \approx f(x_{n}) + f'(x_{n})(x - x_{n}).\]
The root of this linear function, the place where it intercepts the \(x\)-axis, can be taken as a closer approximate root \(x_{n+1}\) if \(f'(x_n)\neq 0\):
\[x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.\]
The process can be started with any arbitrary initial guess \(x_0\), though it will generally require fewer iterations to converge if the guess is close to one of the function's roots. The method will usually converge if \(f'(x_0) \neq 0\). Furthermore, for a root of multiplicity 1, the convergence is at least quadratic (see Rate of convergence) in some sufficiently small neighbourhood of the root: the number of correct digits of the approximation roughly doubles with each additional step. More details can be found in § Analysis below.
Householder's methods are similar but have higher order for even faster convergence. However, the extra computations required for each step can slow down the overall performance relative to Newton's method, particularly if \(f\) or its derivatives are computationally expensive to evaluate.
History
In the Old Babylonian period (19th, 16th century BCE), the side of a square of known area could be effectively approximated, and this is conjectured to have been done using a special case of Newton's method, described algebraically below, by iteratively improving an initial estimate; an equivalent method can be found in Hero of Alexandria's Metrica (1st, 2nd century CE), so is often called Heron's method. Jamshīd al-Kāshī used a method to solve x − N = 0 to find roots of N, a method that was algebraically equivalent to Newton's method, and in which a similar method was found in Trigonometria Britannica, published by Henry Briggs in 1633. His method first appeared in his 1427 publication Miftāḥ al-Ḥisāb (The Key to Arithmetic). Al-Kāshī's work was founded on the earlier contributions of the polymath al-Bīrūnī (973-1048) and the mathematician Sharaf al-Dīn al-Ṭūsī (1135-1213). The contributions of al-Kāshī remained largely unknown to the Western scientific community for centuries, until the work of François Viète (1540-1603). In 1600, Viète rediscovered a technique similar to al-Kāshī's in the context of solving scalar polynomial equations of degree six.
The method that laid the groundwork for what is now the modern Newton's method which would be developed by Joseph Raphson and Thomas Simpson first appeared in Isaac Newton's work in De analysi per aequationes numero terminorum infinitas (written in 1669, published in 1711 by William Jones) and in De metodis fluxionum et serierum infinitarum (written in 1671, translated and published as Method of Fluxions in 1736 by John Colson). However, while Newton gave the basic ideas, his method differs from the modern method given above. He applied the method only to polynomials, starting with an initial root estimate and extracting a sequence of error corrections. He used each correction to rewrite the polynomial in terms of the remaining error, and then solved for a new correction by neglecting higher-degree terms. He did not explicitly connect the method with derivatives or present a general formula. Newton applied this method to both numerical and algebraic problems, producing Taylor series in the latter case. Despite this, in the later second and third editions of Newton's 1687 Philosophiæ Naturalis Principia Mathematica, he did apply his method in an iterative manner to a nonpolynomial equation, specifically Kepler's equation, which were the first published uses of Newton's method in this form by him.
Newton may have derived his method from a similar, less precise method by mathematician Viète, however, the two methods are not the same. The essence of Viète's own method can be found in the work of the mathematician Sharaf al-Din al-Tusi.
The Japanese mathematician Seki Kōwa used a form of Newton's method in the 1680s to solve single-variable equations, though the connection with calculus was missing.
Arthur Cayley in 1879 in The Newton-Fourier imaginary problem was the first to notice the difficulties in generalizing Newton's method to complex roots of polynomials with degree greater than 2 and complex initial values. This opened the way to the study of the theory of iterations of rational functions.
Condensed: the full section is in Wikipedia.
Practical considerations
Newton's method is a powerful technique, if the derivative of the function at the root is nonzero, then the convergence is at least quadratic: as the method converges on the root, the difference between the root and the approximation is squared (the number of accurate digits roughly doubles) at each step. However, there are some difficulties with the method.
Difficulty in calculating the derivative of a function
Newton's method requires that the derivative can be calculated directly. An analytical expression for the derivative may not be easily obtainable or could be expensive to evaluate. In these situations, it may be appropriate to approximate the derivative by using the slope of a line through two nearby points on the function. Using this approximation would result in something like the secant method whose convergence is slower than that of Newton's method.
Failure of the method to converge to the root
It is important to review the proof of quadratic convergence of Newton's method before implementing it. Specifically, one should review the assumptions made in the proof. For situations where the method fails to converge, it is because the assumptions made in this proof are not met.
For example, in some cases, if the first derivative is not well behaved in the neighborhood of a particular root, then it is possible that Newton's method will fail to converge no matter where the initialization is set. In some cases, Newton's method can be stabilized by using successive over-relaxation, or the speed of convergence can be increased by using the same method.
In a robust implementation of Newton's method, it is common to place limits on the number of iterations, bound the solution to an interval known to contain the root, and combine the method with a more robust root finding method.
Slow convergence for roots of multiplicity greater than 1
If the root being sought has multiplicity greater than one, the convergence rate is merely linear (errors reduced by a constant factor at each step) unless special steps are taken. When there are two or more roots that are close together then it may take many iterations before the iterates get close enough to one of them for the quadratic convergence to be apparent. However, if the multiplicity m of the root is known, the following modified algorithm preserves the quadratic convergence rate:
\[x_{n+1} = x_n - m\frac{f(x_n)}{f'(x_n)}.\]
This is equivalent to using successive over-relaxation. On the other hand, if the multiplicity m of the root is not known, it is possible to estimate m after carrying out one or two iterations, and then use that value to increase the rate of convergence.
If the multiplicity m of the root is finite then g(x) = f(x)/f′(x) will have a root at the same location with multiplicity 1. Applying Newton's method to find the root of g(x) recovers quadratic convergence in many cases although it generally involves the second derivative of f(x). In a particularly simple case, if f(x) = x then g(x) = x/m and Newton's method finds the root in a single iteration with
\[x_{n+1} = x_n - \frac{g(x_n)}{g'(x_n)} = x_n - \frac{\;\frac{x_n}{m}\;}{\frac{1}{m}} = 0\,.\]
Slow convergence
The function f(x) = x has a root at 0. Since f is continuously differentiable at its root, the theory guarantees that Newton's method as initialized sufficiently close to the root will converge. However, since the derivative f ′ is zero at the root, quadratic convergence is not ensured by the theory. In this particular example, the Newton iteration is given by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=\frac{1}{2}x_n.\)
It is visible from this that Newton's method could be initialized anywhere and converge to zero, but at only a linear rate. If initialized at 1, dozens of iterations would be required before ten digits of accuracy are achieved.
The function f(x) = x + x also has a root at 0, where it is continuously differentiable. Although the first derivative f ′ is nonzero at the root, the second derivative f ′′ is nonexistent there, so that quadratic convergence cannot be guaranteed. In fact the Newton iteration is given by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=\frac{x_n^{4/3}}{3+4x_n^{1/3}} \approx x_n \cdot \frac{x_n^{1/3}}{3} .\)
From this, it can be seen that the rate of convergence is superlinear but subquadratic. This can be seen in the following tables, the left of which shows Newton's method applied to the above f(x) = x + x and the right of which shows Newton's method applied to f(x) = x + x. The quadratic convergence in iteration shown on the right is illustrated by the orders of magnitude in the distance from the iterate to the true root (0,1,2,3,5,10,20,39,...) being approximately doubled from row to row. While the convergence on the left is superlinear, the order of magnitude is only multiplied by about 4/3 from row to row (0,1,2,4,5,7,10,13,...).
The rate of convergence is distinguished from the number of iterations required to reach a given accuracy. For example, the function f(x) = x − 1 has a root at 1. Since f ′(1) ≠ 0 and f is smooth, it is known that any Newton iteration convergent to 1 will converge quadratically. However, if initialized at 0.5, the first few iterates of Newton's method are approximately 26214, 24904, 23658, 22476, decreasing slowly, with only the 200th iterate being 1.0371. The following iterates are 1.0103, 1.00093, 1.0000082, and 1.00000000065, illustrating quadratic convergence. This highlights that quadratic convergence of a Newton iteration does not mean that only few iterates are required; this only applies once the sequence of iterates is sufficiently close to the root.
Convergence dependent on initialization
The function f(x) = x(1 + x) has a root at 0. The Newton iteration is given by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n-\frac{x_n(1+x_n^2)^{-1/2}}{(1+x_n^2)^{-3/2}}=-x_n^3.\)
From this, it can be seen that there are three possible phenomena for a Newton iteration. If initialized strictly between ±1, the Newton iteration will converge (super-)quadratically to 0; if initialized exactly at 1 or −1, the Newton iteration will oscillate endlessly between ±1; if initialized anywhere else, the Newton iteration will diverge. This same trichotomy occurs for f(x) = arctan x.
In cases where the function in question has multiple roots, it can be difficult to control, via choice of initialization, which root (if any) is identified by Newton's method. For example, the function f(x) = x(x − 1)(x − 3)e has roots at −1, 0, 1, and 3. If initialized at −1.488, the Newton iteration converges to 0; if initialized at −1.487, it diverges to ∞; if initialized at −1.486, it converges to −1; if initialized at −1.485, it diverges to −∞; if initialized at −1.4843, it converges to 3; if initialized at −1.484, it converges to 1. This kind of subtle dependence on initialization is not uncommon; it is frequently studied in the complex plane in the form of the Newton fractal.
Divergence even when initialization is close to the root
Consider the problem of finding a root of f(x) = x. The Newton iteration is
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n-\frac{x_n^{1/3}}{\frac{1}{3}x_n^{-2/3}}=-2x_n.\)
Unless Newton's method is initialized at the exact root 0, it is seen that the sequence of iterates will fail to converge. For example, even if initialized at the reasonably accurate guess of 0.001, the first several iterates are −0.002, 0.004, −0.008, 0.016, reaching 1048.58, −2097.15, ... by the 20th iterate. This failure of convergence is not contradicted by the analytic theory, since in this case f is not differentiable at its root.
In the above example, failure of convergence is reflected by the failure of f(xn) to get closer to zero as n increases, as well as by the fact that successive iterates are growing further and further apart. However, the function f(x) = xe also has a root at 0. The Newton iteration is given by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n\left(1-\frac{3}{1-6x_n^2}\right).\)
In this example, where again f is not differentiable at the root, any Newton iteration not starting exactly at the root will diverge, but with both xn + 1 − xn and f(xn) converging to zero. This is seen in the following table showing the iterates with initialization 1:
Although the convergence of xn + 1 − xn in this case is not very rapid, it can be proved from the iteration formula. This example highlights the possibility that a stopping criterion for Newton's method based only on the smallness of xn + 1 − xn and f(xn) might falsely identify a root.
Oscillatory behavior
It is easy to find situations for which Newton's method oscillates endlessly between two distinct values. For example, for Newton's method as applied to a function f to oscillate between 0 and 1, it is only necessary that the tangent line to f at 0 intersects the x-axis at 1 and that the tangent line to f at 1 intersects the x-axis at 0. This is the case, for example, if f(x) = x − 2x + 2. For this function, it is even the case that Newton's iteration as initialized sufficiently close to 0 or 1 will asymptotically oscillate between these values. For example, Newton's method as initialized at 0.99 yields iterates 0.99, −0.06317, 1.00628, 0.03651, 1.00196, 0.01162, 1.00020, 0.00120, 1.000002, and so on. This behavior is present despite the presence of a root of f approximately equal to −1.76929.
Undefinedness of Newton's method
In some cases, it is not even possible to perform the Newton iteration. For example, if f(x) = x − 1, then the Newton iteration is defined by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)} = x_n-\frac{x_n^2-1}{2x_n} = \frac{x_n^2+1}{2x_n}.\)
So Newton's method cannot be initialized at 0, since this would make x1 undefined. Geometrically, this is because the tangent line to f at 0 is horizontal (i.e. f ′(0) = 0), never intersecting the x-axis.
Even if the initialization is selected so that the Newton iteration can begin, the same phenomenon can block the iteration from being indefinitely continued.
If f has an incomplete domain, it is possible for Newton's method to send the iterates outside of the domain, so that it is impossible to continue the iteration. For example, the natural logarithm function f(x) = ln x has a root at 1, and is defined only for positive x. Newton's iteration in this case is given by
\(x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}=x_n(1- \ln x_n).\)
So if the iteration is initialized at e, the next iterate is 0; if the iteration is initialized at a value larger than e, then the next iterate is negative. In either case, the method cannot be continued.
Analysis
Suppose that the function f has a zero at α, i.e., f(α) = 0, and f is differentiable in a neighborhood of α.
If f is continuously differentiable and its derivative is nonzero at α, then there exists a neighborhood of α such that for all starting values x0 in that neighborhood, the sequence (xn) will converge to α.
If f is continuously differentiable, its derivative is nonzero at α, and it has a second derivative at α, then the convergence is quadratic or faster. If the second derivative is not 0 at α then the convergence is merely quadratic. If the third derivative exists and is bounded in a neighborhood of α, then:
\[\Delta x_{i+1} = \frac{f'' (\alpha)}{2 f' (\alpha)} \left(\Delta x_{i}\right)^2 + O\left(\Delta x_{i}\right)^3 \,,\]
where
\[\Delta x_i \triangleq x_i - \alpha \,.\]
If the derivative is 0 at α, then the convergence is usually only linear. Specifically, if f is twice continuously differentiable, f′(α) = 0 and f″(α) ≠ 0, then there exists a neighborhood of α such that, for all starting values x0 in that neighborhood, the sequence of iterates converges linearly, with rate 1/2. Alternatively, if f′(α) = 0 and f′(x) ≠ 0 for x ≠ α, x in a neighborhood U of α, α being a zero of multiplicity r, and if f ∈ C(U), then there exists a neighborhood of α such that, for all starting values x0 in that neighborhood, the sequence of iterates converges linearly.
Condensed: the full section is in Wikipedia.
Proof of quadratic convergence for Newton's iterative method
According to Taylor's theorem, any function f(x) which has a continuous second derivative can be represented by an expansion about a point that is close to a root of f(x). Suppose this root is α. Then the expansion of f(α) about xn is:
where the Lagrange form of the Taylor series expansion remainder is
\[R_1 = \frac{1}{2!}f''(\xi_n)\left(\alpha - x_n\right)^{2} \,,\]
where ξn is in between xn and α.
Since α is the root, (1) becomes:
Dividing equation (2) by f′(xn) and rearranging gives
Remembering that xn + 1 is defined by
- f′(x) ≠ 0; for all x ∈ I, where I is the interval [α − |ε0|, α + |ε0|];
- f″(x) is continuous, for all x ∈ I;
- M |ε0| < 1
Condensed: the full section is in Wikipedia.
Dabar tu Joks skaičiuotuvas nenusistato, bet jo dalys yra skaičiuojamos. Pabandykite vieną žemiau arba įveskite savo.
Nemokama paskyra prideda pastabas apie kiekvieną pamoką, įrašą apie tai, ką baigėte, savo išspręstas problemas vienoje vietoje ir mokytoją, kurį galite paklausti apie šį puslapį. Pati matematika yra atvira visiems, kurie yra ar nėra užsiregistravę.
Prisijungti PrisijungtiČia naudojami simboliai
Bakstelėkite visus simbolius, kad būtų galima apibrėžti visą apibrėžimą, paveikslėlį ir ką reiškia kiekviena raidė.
Klausimai, kuriuos klausia žmonės
Why not just solve exactly?
Most equations have no closed-form solution at all, and many that do are unusable in practice. A numerical method delivers as many correct digits as you need, and a good one tells you how many that is.
Why can Newton's method fail?
If it starts where the tangent is nearly flat it shoots far away; near a repeated root it slows to a crawl; and with several roots it may land on the wrong one. A bracketing method like bisection is slower but cannot fail.
Šio puslapio dalys pritaikytos nuo Wikipedia (CC BY-SA 4.0). Čia yra įtikinamų ir iš naujo paaiškintų klaidų.
Daugiau informacijos Numerical Methods
Root finding: bisection and Newton's methodNumerical integration: trapezoid and SimpsonInterpolation and Taylor approximationFloating point and error