# Find the fixed points of a function $f(x) := exp(x - 2)$ using a recursive algorithm

I need to find the fixed points (i.e. when $f(x) = x$) of the following function $f(x) := exp(x - 2)$. I understood that the fixed points should be the intersecation points between $f(x)$ and a function $g(x) = x$, which has infinitely many fixed points (if I am not wrong).

So, to find the intersecation points I decided to do: $$f(x) = g(x) \\ f(x) - g(x) = 0 \\ f(x) - x = 0 \\ exp(x - 2) - x = 0$$.

Plotting $f(x)$ and $g(x)$ in the same graph (in a range $-5$ to $5$), it seems that $f(x)$ intersects twice $g(x)$, so it might have 2 fixed points: I have also discover that the fixed points of $f(x)$ are the roots of the following function: $$h := f(x) - x$$

So, I can simply find the roots for the function $h$, and I am done.

Apparently the following algorithm (which I don't know how is it called. Can you tell me?), should find the roots of a function:

Let $f: [a, b] \rightarrow \mathbb{R}$ be continuous function with $f(a) < 0 < f(b)$. Then we can find a $c$ with $f(c) = 0$ with any desired accuracy $\epsilon > 0$ as follows:

1. Let $a_0 := a$, $b_0 := b$ and $k := 0$.

2. Let $c_k := (a_k + b_k)/2$ and:

• $a_{k+1} := a_k$ and $b_{k+1} := c_k$, if $f(c_k) > 0$

• $a_{k+1} := c_k$ and $b_{k+1} := b_k$, if $f(c_k) \leq 0$, and incremenet $k$ by $1$.

3. If $|b_k - a_k| < \epsilon$, then return $c^{'} := (a_n + b_n)/2$, otherwise continue with step $2$.

This algorithm recursively defines the terms of the sequences $a_k$ and $b_k$ in such a way that $a_k$ is increasing and $b_k$ is decreasing. As the the sequences are clearly bounded, they both converge.

This algorithm should find the roots of function, but I am not seeing why. Could you please explain me why this algorithm should find the roots?

Also, could you explaing me why the fixed points of $f(x)$ are the the roots of $h(x)$?

Basically, I need to find the fixed points of f(x) with that algorithm. I need to implement it using Maxima, but before I need to understand it.

## 1 Answer

To mention another possible solution: You can use the Lambert W function $W$ which is the inverse of the function $x \mapsto xe^x$. So you have:

\begin{align} e^{x-2} & = x \\ -e^{-2} & = -x e^{-x} \\ W(-e^{-2}) & = x \end{align}

Note, that there a two branches of $W$ in the range $[-\tfrac 1e, 0[$. Thus the above equation will give two solutions...