$\alpha$ is a fixed point of $g$ if
$$g(\alpha)=\alpha$$Since any equation $f(x)=0$ can be rewritten as $g(x)=x,$ for example, $g(x)=f(x)+x,$ solving the first equation is equivalent to finding a fixed point of the second function.
For example, let $f(x)=\cos(x)-x$ and we find the zeros of $f,$ that is, the values of $x$ such that $$\cos(x)-x=0.$$ We can rearrange the equation as $$\cos(x)=x.$$
The solution of this second equation also called the fixed point of the function
$$ g(x) =\cos(x)$$will also be a zero of $f$.
Once we have the function $g$ we calculate the fixed point following the steps
- Given an initial guess $x_0$.
- For $k=1,2,\ldots,\mathrm{MaxNumIter}$:
- Compute $x_k=g(x_{k-1})$
- If $x_k$ meets stopping conditions, stop.
- Else, perform another iteration.
For example, if we start with $x_0=1$ for $g(x)=\cos(x)$ (Beware! Angle units in maths and physics are radians):
Graphically the sequence is constructed:
The Contraction Mapping Theorem: let $g$ be a differentiable function defined in the interval $[a,b] \subset \mathbb{R} $ and $x_0 \in [a,b]$ is an initial guess. Suppose that
Then $g$ has a unique fixed point $\alpha \in [a,b]$, and the sequence $x_n$ defined as $x_{i+1}=g(x_i)$ with initial guess $x_0$ converges to $\alpha$ with order at least linear.
Let's see if these conditions are met by the function $g(x)=\cos x$ in the interval $[0,1]$
Graphically
Analytically
As $\cos(x)$ decreases in $\left[0,\dfrac{\pi}{2}\right]$
and has a maximum in $0$ and a minimum in $1$, that is
$$\cos(1)\le \cos(x) \le \cos(0)$$ and $$0.54\le \cos(x) \le 1$$
and finally
$$\mathrm{Si}\quad x\in[0,1]\quad \Longrightarrow\quad \cos(x)\in [0.54,1]\subset[0,1]$$and $$0\le \sin(x) \le 0.84$$
finally
$$\left|g'(x)\right|\le 0.84\lt 1 \;\mathrm{for}\; \mathrm{all}\; x\in [0,1]$$As the Contraction Mapping Theorem conditions are met, we can choose any point within the interval $[0,1]$ as $x_0$ and the convergence of the sequence generated with the iteration function $g$ is guaranteed.
There are four possible cases:
We want to find the zeros of the function $f(x)=x+\ln(x)$ using the fixed point method and the following iteration functions are proposed
$$(i)~g_{1}(x)=-\ln(x),\quad(ii)~g_{2}(x)=\text{e}^{-x},\quad(iii)~g_{3}(x)=\frac{x+\text{e}^{-x}}{2}$$Let us verify that the root of the equation is the fixed point of the functions that are defined from the equivalent equations. That is,
Let's start with the iteration function
The Contraction Mapping Theorem: let $g$ be a differentiable function derivable defined in the interval $[a,b] \subset \mathbb{R} $ and $x_0 \in [a,b]$ and initial guess. Suppose that
Then $g$ has a unique fixed point $\alpha \in [a,b]$, and the sequence $x_n$ defined as $x_{i+1}=g(x_i)$ with initial guess $x_0$ converges to $\alpha$ with order at least linear.
Looking at the graphs:
If we start with $x_0=0.5$ with iteration function $g_1(x)=-\ln(x)$:
Similarly for the other functions
We see that, for the function $g_1,$ since it is not defined for negative values, from a certain point, the sequence is not defined.
We can assume that, if a series of decimals are repeated in successive iterations, they are correct. Thus, the sequences generated with $g_2$ and $g_3$ converge, but the one generated with $g_3$ converges faster because we can assume that as in $0.567143$ the 6 decimals are repeated in the last two iterations, this is the correct solution with 6 decimals. On the other hand, for $g_2$, with 9 iterations, only two decimal digits are repeated.
Taking into account the previous results, we can use $ g_2 $ and $g_3.$ The function $g_1$ does not meet the convergence conditions and the sequence generated by it does not converge.
The best iteration function is the one with the lowest derivative in the interval because it converges more quickly, that is, $g_3.$