fixed point iteration algebra problem I am looking at an example which finds the root of:
$$ f(x) = \cos(3x) \tag 1$$
using the fixed point iteration method.  It uses
$$ g(x) = \frac{2x+\cos(3x)}{2} \tag 2$$
However, it was my understanding that to get $g(x)$ I should make (1) equal to zero, and then re-arrange to get $x=$ .  The simplest method being to just add $x$ to each side.  So,
$$ 0=\cos(3x) \tag 3$$
$$ x=\cos(3x)+x \tag4$$
So how do I get from (4) to (2), or have I misunderstood something.
Thanks.
 A: When we write:
$$x_{n+1} = g(x_n)$$
we need:
$$|g'(r)| \lt 1$$
for convergence, where $r$ is the actual root.
If we find an example root of $\cos 3x = 0$, we have $x = \dfrac{\pi}{6}$ (of course there are many given the periodic function).
If we calculate this for your choice of $g(x) = x + \cos(3x)$, we have:
$$\left|g'\left(\dfrac{\pi}{6}\right)\right| = \left|1 - 3 \sin\left(\dfrac{\pi}{2}\right)\right| = |-2| \implies ~ \mbox{diverges}$$
However, if we use their choice of $g(x) = \dfrac{2x+cos(3x)}{2}$, we have:
$$\left|g'\left(\dfrac{\pi}{6}\right)\right| = \left|1 - \dfrac{3}{2} \sin\left(\dfrac{\pi}{2}\right)\right| = \left|-\dfrac{1}{2}\right| \implies ~ \mbox{converges}$$
Indeed, for a starting point of $x_0 = 1$, this one converges to the root:
$$x = 0.5235987756$$
Of course, this is $\dfrac{\pi}{6}$.
A: We want the iteration $x_{n+1}=g(x_n)$ to converge, where
$g(x)=x+a\cos(3x)$. (When $x$ is near the solution.)
This is guaranteed if $\lvert g'(x)\rvert <1$, near the root, where $g'(x)=1-3a\sin(3x)$.
The idea is to pick $a$, so that $\lvert g'(x)\rvert <1$.
Apparently, at the root $\sin 3x=\pm 1$, and hence $a$ should be picked, so that
$$
\lvert 1\pm 3a\rvert <1.
$$
If $\sin 3x=1$, then best pick for $a=1/3$, while if $\sin 3x=-1$, then pick $a=-1/3$.
