Solving Equations by Fixed Point Iteration (of Contraction Mappings)
Contents
2. Solving Equations by Fixed Point Iteration (of Contraction Mappings)#
References:
Section 1.2 of Sauer
Section 2.2 of Burden&Faires
2.1. Introduction#
in the next section we will meet Newton’s Method for Solving Equations for root-finding, which you might have seen in a calculus course. This is one very important example of a more general strategy of fixed-point iteration, so we start with that.
using PyPlot
2.2. Fixed-point equations#
A variant of stating equations as root-finding (
Such problems are interchangeable with root-finding.
One way to convert from
for any “weight function”
One can convert the other way too, for example functionining
Compare the two setups graphically: in each case, the
f_1(x) = x - cos(x)
g_1(x) = cos(x);
a = -1.0
b = 1.0
x = range(a, b, 100);
figure(figsize=[10,6])
title("Zeros of y = f(x) = x - cos(x)")
plot(x, f_1.(x), label="y = f(x) = x - cos(x)")
plot([a, b], [0, 0], label="y = 0")
legend()
grid(true)

figure(figsize=[8,8])
title(L"Fixed points of the map $g_1(x) = \cos(x)$")
plot(x, g_1.(x), label=L"y = g_1(x) = \cos(x)")
plot(x, x, label="y=x")
legend()
grid(true);

The fixed point form can be convenient partly because we almost always have to solve by successive approximations,
or iteration, and fixed point form suggests one choice of iterative procedure:
start with any first approximation
Proposition 2.1
If
Proof. From
On the other hand,
Comparing gives
That second “if” is a big one. Fortunately, it can often be resolved using the idea of a contraction mapping.
Definition 2.1 (Mapping)
A function
(Aside: The same applies for a function
A mapping is sometimes thought of as moving a region
A very important case is mappings that shrink the region, by reducing the distance between points:
Proposition 2.2
Any continuous mapping on a closed interval
Proof. Consider the “root-finding cousin”,
First,
From the Intermediate Value Theorem,
In other words, the graph of
Example 2.1
Let us illustrate this with the mapping
g_4(x) = 4cos(x)
a = -4.0
b = 4.0;
x = range(a, b, 100);
figure(figsize=[8,8])
title(L"Fixed points of the map $g_4(x) = 4 \cos(x)$")
plot(x, g_4.(x), label=L"y = g_4(x)")
plot(x, x, label="y=x")
legend()
grid(true);

This example has multiple fixed points (three of them). To ensure both the existence of a unique solution, and covergence of the iteration to that solution, we need an extra condition.
Definition 2.2 (Contraction Mapping)
A mapping
for any
(Aside: The same applies for a domain in
Remark 2.1
It is not enough to have
Theorem 2.1 (A Contraction Mapping Theorem)
Any contraction mapping on a closed, bounded interval
Proof. The main idea of the proof can be shown with the help of a few pictures.
First, uniqeness:
between any two of the multiple fixed points above — call them
So instead, for a contraction, the graph of a contraction map looks like the one below for our favorite example,
The second claim, about convergence to the fixed point from any initial approximation
An easy way of checking whether a differentiable function is a contraction#
With differentiable functions, the contraction condition can often be easily verified using derivatives:
Theorem 2.2 (A derivative-based fixed point theorem)
If a function
Proof. Using the Mean Value Theorem,
Example 2.2 (
Our favorite example
For all real
However, we have seen that iteration values will settle in the interval
And as seen in the graph above, there is indeed a unique fixed point.
The contraction constant as a measure of how fast the approximations improve (the smaller the better)#
It can be shown that if
To see this, we functionine some jargon for talking about errors. (For more details on error concepts, see section Measures of Error and Order of Convergence
Definition 2.3 (Error)
The error in
This will often be abbreviated as
Definition 2.4 (Absolute Error)
The absolute error in
(Aside: This will later be extended to
In the case of
Proposition 2.3
That is, the error decreases at worst in a geometric sequence,
which is exponential decrease with respect to the variable
Proof.
Applying this again,
and repeating
Remark 2.2
We will often use this “recursive” strategy of relating the error in one iterate to that in the previous iterate.
We can now complete the proof of the above contraction mapping theorem Theorem 2.1
Proof. This now follows from Proposition 2.3
For any initial approximation
which is another way of saying that
Example 2.3 (Solving
We have seen that one way to convert the example
Here is what this iteration looks like:
a = 0.0
b = 1.0
x = range(a, b, 100)
iterations = 10
# Start at left
x_k = a
figure(figsize=[8,8])
title(L"Solving $x = \cos(x)$ starting to the left, at $x_0 =$"*" $a")
plot(x, x, "g")
plot(x, g_1.(x), "r")
grid(true)
println("x_0 = $x_k")
for k in 1:iterations
g_x_k = g_1(x_k)
# Graph evalation of g(x_k) from x_k:
plot([x_k, x_k], [x_k, g_1(x_k)], "b")
x_k_plus_1 = g_1(x_k)
#Connect to the new x_k on the line y = x:
plot([x_k, g_1(x_k)], [x_k_plus_1, x_k_plus_1], "b")
# Update names: the old x_k+1 is the new x_k
x_k = x_k_plus_1
println("x_$(k) = $x_k")
end
x_0 = 0.0
x_1 = 1.0
x_2 = 0.5403023058681398
x_3 = 0.8575532158463934
x_4 = 0.6542897904977791
x_5 = 0.7934803587425656
x_6 = 0.7013687736227565
x_7 = 0.7639596829006542
x_8 = 0.7221024250267077
x_9 = 0.7504177617637605
x_10 = 0.7314040424225098

# Start at right
x_k = b
figure(figsize=[8,8])
title("Solving " * L"x = \cos(x)" * " starting to the right, at " * L"x_0 = " * "$b")
# Julia note: "*" is concatenation of strings
plot(x, x, "g")
plot(x, g_1.(x), "r")
grid(true)
println("x_0 = $x_k")
for k in 1:iterations
g_x_k = g_1(x_k)
# Graph evalation of g(x_k) from x_k:
plot([x_k, x_k], [x_k, g_1(x_k)], "b")
x_k_plus_1 = g_1(x_k)
#Connect to the new x_k on the line y = x:
plot([x_k, g_1(x_k)], [x_k_plus_1, x_k_plus_1], "b")
# Update names: the old x_k+1 is the new x_k
x_k = x_k_plus_1
println("x_$(k) = $x_k")
end
x_0 = 1.0
x_1 = 0.5403023058681398
x_2 = 0.8575532158463934
x_3 = 0.6542897904977791
x_4 = 0.7934803587425656
x_5 = 0.7013687736227565
x_6 = 0.7639596829006542
x_7 = 0.7221024250267077
x_8 = 0.7504177617637605
x_9 = 0.7314040424225098
x_10 = 0.744237354900557

In each case, one gets a “box spiral” in to the fixed point.
It always looks like this when
If instead
Example 2.4 (Solving
The roots are 1 and 4; for now we aim at the first of these,
so we chose a domain
Let us get a fixed point for by “partially solving for
f_2(x) = x^2 - 5*x + 4;
g_2(x) = (x^2 + 4)/5;
a = 0.0;
b = 3.0;
x = range(a, b, 100);
figure(figsize=[8,8])
title(L"Solving $y = f_2(x) = x^2-5x+4 = 0$")
plot(x, f_2.(x))
plot([a, b], [0, 0])
grid(true)

figure(figsize=[8,8])
title(L"Finding fixed point of $y = g_2(x) = (x^2 + 4)/5$")
plot(x, g_2.(x))
plot(x, x)
grid(true)

iterations = 10
a = 0.0
b = 1.5
x = range(a, b, 100);
# Start at left
x_k = a
figure(figsize=[8,8])
title(L"Starting to the left, at $x_0 =$"*"$a")
grid(true)
plot(x, x, "g")
plot(x, g_2.(x), "r")
println("x_0 = $x_k")
for k in 1:iterations
g_x_k = g_2(x_k)
# Graph evalation of g(x_k) from x_k:
plot([x_k, x_k], [x_k, g_2(x_k)], "b")
x_k_plus_1 = g_2(x_k)
#Connect to the new x_k on the line y = x:
plot([x_k, g_2(x_k)], [x_k_plus_1, x_k_plus_1], "b")
# Update names: the old x_k+1 is the new x_k
x_k = x_k_plus_1
println("x_$(k) = $x_k")
end;
x_0 = 0.0
x_1 = 0.8
x_2 = 0.9280000000000002
x_3 = 0.9722368000000001
x_4 = 0.9890488790548482
x_5 = 0.9956435370319303
x_6 = 0.9982612105666906
x_7 = 0.9993050889044148
x_8 = 0.999722132142052
x_9 = 0.9998888682989302
x_10 = 0.999955549789623

# Start at right
a = 0.0;
b = 3.0;
x = range(a, b, 100)
x_k = b;
figure(figsize=[8,8])
title(L"Starting to the right, at $x_0 =$"*"$b")
grid(true)
plot(x, x, "g")
plot(x, g_2.(x), "r")
println("x_0 = $x_k")
for k in 1:iterations
g_x_k = g_2(x_k)
# Graph evalation of g(x_k) from x_k:
plot([x_k, x_k], [x_k, g_2(x_k)], "b")
x_k_plus_1 = g_2(x_k)
#Connect to the new x_k on the line y = x:
plot([x_k, g_2(x_k)], [x_k_plus_1, x_k_plus_1], "b")
# Update names: the old x_k+1 is the new x_k
x_k = x_k_plus_1
println("x_$(k) = $x_k")
end;
x_0 = 3.0
x_1 = 2.6
x_2 = 2.152
x_3 = 1.7262208
x_4 = 1.3959676500705283
x_5 = 1.1897451360086866
x_6 = 1.0830986977312658
x_7 = 1.0346205578054328
x_8 = 1.014087939726725
x_9 = 1.0056748698998388
x_10 = 1.0022763887896116

This work is licensed under Creative Commons Attribution-ShareAlike 4.0 International