---
title: Newton's Method and Antiderivatives
module: Applications of Derivatives
moduleNumber: 3
lessonNumber: 4
order: 304
summary: >
  Newton's method solves $f(x) = 0$ by repeatedly replacing the curve with its
  tangent line and jumping to the tangent's root, converging fast when it works
  and diverging when the derivative is small. Antiderivatives reverse
  differentiation: every antiderivative of a function differs from another by a
  constant, so the general antiderivative is a family of parallel curves, pinned
  to one by an initial condition.
topics: [Applications of Derivatives]
sources:
  - book: Stewart
    ref: "Ch. 3 — Applications of Differentiation; §3.8 Newton's Method"
  - book: Stewart
    ref: "Ch. 3; §3.9 Antiderivatives"
---

Most equations that arise in practice have no solution formula. A polynomial of
degree five or higher has no root formula at all, and a transcendental equation
like $\cos x = x$ has none either. Newton's method solves such an equation
numerically by repeatedly replacing the curve with its tangent line and jumping to
the tangent's root. Antidifferentiation runs the derivative backward, recovering a
function from its rate of change.

## Newton's method

To solve $f(x) = 0$ is to locate an $x$-intercept of the graph of $f$. Newton's
method starts from a guess $x_1$ and improves it by following the tangent. Near
$x_1$ the tangent line hugs the curve, so the tangent's $x$-intercept is close to
the curve's. The tangent is a line, so its intercept is easy to compute.

The tangent at $(x_1, f(x_1))$ has slope $f'(x_1)$, so its equation is
$y - f(x_1) = f'(x_1)(x - x_1)$. Setting $y = 0$ and solving for the intercept
$x_2$, provided $f'(x_1) \ne 0$,

$$
x_2 = x_1 - \frac{f(x_1)}{f'(x_1)}.
$$

Repeating from $x_2$, then $x_3$, and so on produces a sequence defined by the
same rule at every step.

> **Definition (Newton's iteration).** Given $f$ with $f'(x_n) \ne 0$, the next
> Newton approximation is
>
> $$
> x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.
> $$
>
> If $x_n \to r$ as $n \to \infty$, the sequence **converges** to the root $r$.

$$
% caption: Each step drops from the guess to the curve, rides the tangent down to
% the axis, and lands closer to the root $r$.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (7.4,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.4) -- (0,4.0) node[above, black!70] {$y$};
% increasing convex curve with root near x=1.4
\draw[black, very thick] plot[domain=0.7:6.9, samples=80] (\x, {0.45*(\x-1.4)+0.05*(\x-1.4)*(\x-1.4)});
\node[black, anchor=south west] at (5.6,3.4) {$y=f(x)$};
% root
\fill[acc] (1.4,0) circle (2.2pt) node[below=2pt, black!75] {$r$};
% x1 = 6.2
\coordinate (x1) at (6.2,0);
\coordinate (fx1) at (6.2,3.31);
\fill[black!70] (6.2,0) circle (1.6pt) node[below=2pt, black!75] {$x_1$};
\draw[dashed, black] (x1) -- (fx1);
% tangent at x1 hitting axis at x2 = 4.3
\draw[black!70, thick] (6.9,4.35) -- (4.0,-0.35);
\coordinate (x2) at (4.3,0);
\fill[black!70] (4.3,0) circle (1.6pt) node[below=2pt, black!75] {$x_2$};
\draw[dashed, black] (4.3,0) -- (4.3,1.55);
% tangent at x2 hitting axis at x3 = 2.7
\draw[black!70, thick] (5.1,2.55) -- (2.4,-0.3);
\coordinate (x3) at (2.75,0);
\fill[black!70] (2.75,0) circle (1.6pt) node[below=2pt, black!75] {$x_3$};
\end{tikzpicture}
$$

Newton used $f(x) = x^3 - 2x - 5$ to demonstrate the method, starting from
$x_1 = 2$. With $f'(x) = 3x^2 - 2$,

$$
x_2 = 2 - \frac{f(2)}{f'(2)} = 2 - \frac{-1}{10} = 2.1,
\qquad
x_3 = 2.1 - \frac{f(2.1)}{f'(2.1)} = 2.1 - \frac{0.061}{11.23} \approx 2.0946.
$$

The correct root to four decimals is $2.0946$, reached in two steps. When it
converges, Newton's method roughly doubles the number of correct digits per
iteration.

> **Worked example.** Solve $\cos x = x$ to six decimal places. Write it as
> $f(x) = \cos x - x = 0$, so $f'(x) = -\sin x - 1$ and the iteration is
>
> $$
> x_{n+1} = x_n - \frac{\cos x_n - x_n}{-\sin x_n - 1}
>         = x_n + \frac{\cos x_n - x_n}{\sin x_n + 1}.
> $$
>
> The graphs of $y = \cos x$ and $y = x$ cross a little below $1$, so start at
> $x_1 = 1$ (in radian mode):
>
> $$
> x_2 \approx 0.750364, \quad x_3 \approx 0.739113, \quad
> x_4 \approx 0.739085, \quad x_5 \approx 0.739085.
> $$
>
> Since $x_4$ and $x_5$ agree to six decimals, the root is $0.739085$.

> **Worked example.** Applying Newton's method to $f(x) = x^2 - a$ recovers the
> square-root algorithm the Babylonians used. With $f'(x) = 2x$,
>
> $$
> x_{n+1} = x_n - \frac{x_n^2 - a}{2x_n}
>         = \frac{1}{2}\left(x_n + \frac{a}{x_n}\right),
> $$
>
> so each step averages a guess with $a$ divided by the guess. For $a = 1000$
> starting at $x_1 = 30$: $x_2 = \tfrac12\!\left(30 + \tfrac{1000}{30}\right)
> \approx 31.6667$, then $x_3 \approx 31.6228$ and $x_4 \approx 31.622777$,
> matching $\sqrt{1000}$ to six decimals in three steps.

The doubling of correct digits per step is visible when the iterates are laid out.

> **Worked example.** Compute $\sqrt[6]{2}$ to eight decimals. The value is the
> positive root of $f(x) = x^6 - 2$, so with $f'(x) = 6x^5$,
>
> $$
> x_{n+1} = x_n - \frac{x_n^6 - 2}{6x_n^5}.
> $$
>
> Starting from $x_1 = 1$, the iterates are
>
> | $n$ | $x_n$ | correct decimals |
> | --- | --- | --- |
> | $1$ | $1.00000000$ | $0$ |
> | $2$ | $1.16666667$ | $0$ |
> | $3$ | $1.12644368$ | $1$ |
> | $4$ | $1.12249707$ | $3$ |
> | $5$ | $1.12246205$ | $8$ |
> | $6$ | $1.12246205$ | $8$ |
>
> The count of correct decimals roughly doubles from $x_3$ onward, the hallmark of
> quadratic convergence. Since $x_5$ and $x_6$ agree, $\sqrt[6]{2} = 1.12246205$.

```algorithm
caption: $\textsc{Newton}(f, f', x_1, \varepsilon)$ — approximate a root of $f(x)=0$
$x \gets x_1$
repeat
  $x_{\text{new}} \gets x - f(x)/f'(x)$
  if $|x_{\text{new}} - x| < \varepsilon$ then return $x_{\text{new}}$
  $x \gets x_{\text{new}}$
until a step limit is reached
```

### When Newton's method fails

The tangent shortcut assumes the tangent points back toward the root. A small
derivative tilts the tangent nearly flat, throwing its intercept far away, and a
badly placed guess can send the iterates outside the domain or into an endless
oscillation.

$$
% caption: A near-horizontal tangent at $x_1$ (small $f'(x_1)$) sends $x_2$
% farther from the root than $x_1$ was.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-2.2,0) -- (5.2,0) node[right, black!70] {$x$};
\draw[->, black] (0,-1.8) -- (0,2.0) node[above, black!70] {$y$};
% curve with a gentle slope at x1
\draw[black, very thick] plot[domain=-2.0:2.6, samples=80] (\x, {0.9*sin(\x r)});
\node[black, anchor=west] at (2.3,1.2) {$y=f(x)$};
% root near x=0
\fill[acc] (0,0) circle (2.2pt) node[above right=0pt, black!75] {$r$};
% x1 near the crest where slope is small: x1 = 1.55
\coordinate (x1) at (1.55,0);
\fill[black!70] (1.55,0) circle (1.6pt) node[below=2pt, black!75] {$x_1$};
\draw[dashed, black] (1.55,0) -- (1.55,0.9);
% shallow tangent shooting far right to x2 = 4.6
\draw[acc, thick] (0.7,0.94) -- (4.9,0.35);
\coordinate (x2) at (4.6,0.41);
\fill[black!70] (4.6,0) circle (1.6pt) node[below=2pt, black!75] {$x_2$};
\node[black!70, anchor=south west] at (2.6,0.6) {small slope at $x_1$};
\end{tikzpicture}
$$

A poorly placed start can also trap the iteration in a loop. For
$f(x) = x^3 - 2x + 2$ starting at $x_1 = 0$, the tangent lands at $x_2 = 1$, and
the tangent at $x_2$ lands back at $x_1 = 0$; the iterates cycle between $0$ and
$1$ and never approach the real root near $-1.77$.

$$
% caption: Newton's method can cycle: from $x_1 = 0$ the tangent lands at
% $x_2 = 1$, and the tangent there returns to $x_1 = 0$, so the iterates loop.
\begin{tikzpicture}[scale=1.05, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-2.1,0) -- (2.2,0) node[right, black!70] {$x$};
\draw[->, black] (0,-1.1) -- (0,3.3) node[above, black!70] {$y$};
\draw[black, very thick] plot[domain=-1.9:1.72, samples=90] (\x, {\x*\x*\x - 2*\x + 2});
\node[black, anchor=west] at (1.2,2.7) {$y=f(x)$};
% tangent at (0,2): y = 2 - 2x, reaches axis at x=1
\draw[black!70, thick] (-0.3,2.6) -- (1.1,-0.2);
% tangent at (1,1): y = x, reaches axis at x=0
\draw[black!70, thick] (-0.25,-0.25) -- (1.5,1.5);
\fill[acc] (0,2) circle (2pt);
\fill[acc] (1,1) circle (2pt);
\draw[dashed, black] (0,0) -- (0,2);
\draw[dashed, black] (1,0) -- (1,1);
\fill[black!70] (0,0) circle (1.6pt);
\fill[black!70] (1,0) circle (1.6pt);
\node[black!75] at (-0.28,-0.3) {$x_1$};
\node[black!75] at (1.32,-0.3) {$x_2$};
\draw[black, ->] (0.18,-0.55) to[bend right=28] (0.82,-0.55);
\draw[black, ->] (0.82,-0.85) to[bend right=28] (0.18,-0.85);
\end{tikzpicture}
$$

Newton's method is a local method: it converges quickly from a good starting
point and unreliably from a poor one. A rough sketch or a bracketing of the root
supplies the good start.

## Antiderivatives

Differentiation sends a function to its rate of change. Recovering the function
from the rate reverses that operation. A physicist with a velocity wants position; an
engineer with a leak rate wants total volume lost. Each asks for a function whose
derivative is known.

> **Definition (Antiderivative).** A function $F$ is an **antiderivative** of $f$
> on an interval $I$ if $F'(x) = f(x)$ for all $x$ in $I$.

Antiderivatives are never unique. If $F(x) = \tfrac{1}{3}x^3$ then $F'(x) = x^2$,
but so does $G(x) = \tfrac{1}{3}x^3 + 100$, and so does any
$\tfrac{1}{3}x^3 + C$. The
[corollary to the Mean Value Theorem](/calculus/applications-of-derivatives/extrema-and-the-mean-value-theorem)
shows there are no others: two functions with the same derivative on an interval
differ by a constant.

> **Theorem (General antiderivative).** If $F$ is an antiderivative of $f$ on an
> interval $I$, then the most general antiderivative of $f$ on $I$ is $F(x) + C$,
> where $C$ is an arbitrary constant.

The constant is a vertical shift, so the antiderivatives of a function form a
family of curves stacked one above another, all with identical slope at each $x$.
Fixing one member requires one extra fact.

$$
% caption: The antiderivatives of a function are vertical translates of one
% curve; every member has the same slope at each $x$, and $C$ selects the height.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-2.2,0) -- (2.4,0) node[right, black!70] {$x$};
\draw[->, black] (0,-1.6) -- (0,3.2) node[above, black!70] {$y$};
\foreach \c/\op in {1.9/70, 1.25/55, 0.6/70, -0.05/55, -0.7/70}
  \draw[acc!\op, very thick] plot[domain=-1.5:1.5, samples=50] (\x, {0.2*\x*\x*\x+\c});
\node[black!70, anchor=west] at (1.55,2.5) {$+C$};
\draw[black, <->] (1.85,-0.05) -- (1.85,1.95);
\end{tikzpicture}
$$

### Reading antiderivatives off differentiation rules

Every differentiation formula, read from right to left, is an antidifferentiation
formula. Two structural rules and the reversed power rule cover most cases.

| Function $f(x)$ | Particular antiderivative $F(x)$ |
| --- | --- |
| $c\,f(x)$ | $c\,F(x)$ |
| $f(x) + g(x)$ | $F(x) + G(x)$ |
| $x^n \; (n \ne -1)$ | $\dfrac{x^{n+1}}{n+1}$ |
| $\cos x$ | $\sin x$ |
| $\sin x$ | $-\cos x$ |
| $\sec^2 x$ | $\tan x$ |
| $\sec x \tan x$ | $\sec x$ |

The power rule reversed, $x^n \mapsto \dfrac{x^{n+1}}{n+1}$, fails at $n = -1$
because the exponent $n+1$ would be zero; the antiderivative of $x^{-1}$ is
deferred to the [natural logarithm](/calculus/exponential-logarithmic-and-inverse-functions/inverse-functions-logarithms-and-exponentials).
For example, to antidifferentiate $g'(x) = 4\sin x + 2x^4 - x^{-1/2}$, apply the
table term by term:

$$
g(x) = -4\cos x + \tfrac{2}{5}x^5 - 2\sqrt{x} + C.
$$

### Initial conditions

An equation involving the derivatives of an unknown function is a **differential
equation**, and its general solution carries the arbitrary constant. An extra
condition on the function selects one solution from the family.

For $f'(x) = x\sqrt{x} = x^{3/2}$ with $f(1) = 2$, the general antiderivative is
$f(x) = \tfrac{2}{5}x^{5/2} + C$. Imposing $f(1) = 2$ gives
$\tfrac{2}{5} + C = 2$, so $C = \tfrac{8}{5}$ and
$f(x) = \tfrac{2}{5}x^{5/2} + \tfrac{8}{5}$. A second-order equation needs two
conditions, one for each integration.

> **Worked example.** Solve $f''(x) = 12x^2 + 6x - 4$ with $f(0) = 4$ and
> $f(1) = 1$. Antidifferentiating twice introduces two constants,
>
> $$
> f'(x) = 4x^3 + 3x^2 - 4x + C, \qquad
> f(x) = x^4 + x^3 - 2x^2 + Cx + D.
> $$
>
> The condition $f(0) = 4$ forces $D = 4$. Then
> $f(1) = 1 + 1 - 2 + C + 4 = C + 4 = 1$, so $C = -3$ and
> $f(x) = x^4 + x^3 - 2x^2 - 3x + 4$.

### Recovering motion from acceleration

Antidifferentiation reads position from velocity and velocity from acceleration.
Given $a(t)$, one antiderivative recovers $v(t)$ up to a constant fixed by the
initial velocity, and a second recovers $s(t)$ up to a constant fixed by the
initial position. The geometry is the reverse of the sign chart: the slope of $f$
is known at every point, and the curve is the one threaded through those slopes
from the starting height.

> **Worked example.** A particle moves along a line with acceleration
> $a(t) = 6t + 4$, initial velocity $v(0) = -6$ cm/s, and initial position
> $s(0) = 9$ cm. Antidifferentiating once,
>
> $$
> v(t) = 3t^2 + 4t + C, \qquad v(0) = C = -6,
> $$
>
> so $v(t) = 3t^2 + 4t - 6$. Antidifferentiating again,
>
> $$
> s(t) = t^3 + 2t^2 - 6t + D, \qquad s(0) = D = 9,
> $$
>
> giving the position function $s(t) = t^3 + 2t^2 - 6t + 9$.

Near the surface of the earth, gravity supplies a constant downward acceleration
of about $32$ ft/s$^2$, so a projectile's motion follows from antidifferentiating
that constant twice.

> **Worked example.** A ball is thrown upward at $48$ ft/s from a cliff $432$ ft
> high. Taking up as positive, $a(t) = -32$, so
>
> $$
> v(t) = -32t + 48, \qquad s(t) = -16t^2 + 48t + 432,
> $$
>
> using $v(0) = 48$ and $s(0) = 432$. The maximum height occurs when $v(t) = 0$,
> at $t = 1.5$ s. The ball lands when $s(t) = 0$, i.e. $t^2 - 3t - 27 = 0$, whose
> positive root is $t = \tfrac{3(1 + \sqrt{13})}{2} \approx 6.9$ s.[^stewart-anti]

$$
% caption: Height of the thrown ball, $s(t) = -16t^2 + 48t + 432$: it rises to a
% peak at $t = 1.5$ s, then falls, reaching the ground near $t = 6.9$ s.
\begin{tikzpicture}[xscale=0.72, yscale=0.0068, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (7.6,0) node[right, black!70] {$t$};
\draw[->, black] (0,-20) -- (0,510) node[above, black!70] {$s$};
\draw[black, very thick] plot[domain=0:6.9, samples=90] (\x, {-16*\x*\x + 48*\x + 432});
\fill[black] (0,432) circle (2.6pt) node[left, black!75] {$432$};
\fill[acc] (1.5,468) circle (2.6pt) node[above right=0pt, black!75] {peak height};
\fill[black] (6.9,0) circle (2.6pt) node[above right=1pt, black!75] {ground};
\draw[dashed, black] (1.5,0) -- (1.5,468);
\node[black!70, anchor=north] at (1.5,-8) {t = 1.5 s};
\end{tikzpicture}
$$

$$
% caption: Reconstructing $f$ from its slope: the known $f'$ prescribes a tangent
% direction at each $x$, and one initial point selects the curve through them.
\begin{tikzpicture}[scale=1.0, >=stealth, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->, black] (-0.3,0) -- (6.6,0) node[right, black!70] {$x$};
\draw[->, black] (0,-0.3) -- (0,3.4) node[above, black!70] {$y$};
% slope field: at each grid point a short segment of slope 0.16*x
\foreach \x in {0.8,1.7,2.6,3.5,4.4,5.3}{
  \foreach \y in {0.7,1.5,2.3,3.0}{
    \draw[black, thick] ({\x-0.3},{\y-0.3*0.16*\x}) -- ({\x+0.3},{\y+0.3*0.16*\x});
  }
}
% the integral curve threaded tangent to the field through the start point
\draw[acc, very thick] plot[domain=0.35:5.7, samples=60] (\x, {0.08*\x*\x+0.5});
\fill[acc] (0.6,0.53) circle (2.2pt) node[left, black!75] {start};
\node[acc, anchor=west] at (4.9,3.0) {$f$};
\end{tikzpicture}
$$

[^stewart-anti]: Stewart, §3.8 — Newton's Method: the tangent-line derivation of the iteration $x_{n+1} = x_n - f(x_n)/f'(x_n)$, the cubic example, and the small-derivative failure case; §3.9 — Antiderivatives: the definition, the general antiderivative $F + C$ from the Mean Value Theorem corollary, the antidifferentiation table, and initial-value problems.
