# Math Insight

### Applet: Function iteration with mapping

The effect of repeatedly applying the function $f(x)$ to the starting value $x_0$ is shown both by a graph of the entire trajectory of the values $x_n$ on the left and a graph of the mapping of the function $f$ on the right. As you click the “step” button, the two perspectives illustrate the process of iterating $f$ to obtain subsequent values of $x_n$ using the recursion $x_n = f(x_{n-1})$. The graph at the right illustrates how $f$ produces new values by mapping $x_{n-1}$ into $x_n$. This graph plots the value of $x_{n}$ versus the previous value $x_{n-1}$, along with the function $f(x)$ in blue.

When you first click “step,” green arrows show how to graphically compute $x_{n}$ from $x_{n-1}$ using the graph of $f$. When you click “step” again, a cyan curve shows how to take the new $x_{n}$ from the $y$-axis back to the same value on the $x$-axis, where it will become the old value $x_{n-1}$ for the next iteration. Clicking “step” additional times continues the process to obtain additional values. The graph at the left summarizes the results obtained from right graph, as it displays the trajectory containing all the generated $x_n$, showing the whole sequence by plotting the $x_n$ versus their index $n$. Note that the vertical axis of the left graph and both axes of the right graph plot the space of $x$. The horizontal axis of the left graph plots values of the index $n$. In the left graph, the values of each $x_{n}$ are also marked with horizontal lines and the last value $x_{n}$ is labeled.

You can change the function $f(x)$ by typing a new function in the box. You can change the initial value $x_0$ by typing a new value in the box or dragging the blue point in the left graph. You can zoom the vertical axis of the left graph with the + and - buttons and pan up and down with the buttons labeled by arrows. The right graph simultaneously changes so that both axes include at least the same range of $x$ as the left graph.

Applet file: function_iteration_mapping.ggb