☜ Navigate through the Chaos pages ☞

Lather, Rinse, Repeat...

What happens to the sequence x, f(x), f(f(x)), etc...?

Brief Explanation

This page lets you explore iterated functions — that is, you take the output of a function and plug it back into the function again. The sequence of values you get is called the orbit. First, enter a function in the f(x) field. Or, click one of the buttons in the “Interesting functions” list. You can only use the letter ‘x’ for a variable.

For advanced users: note that unless you have just one expression, like “sin(x)”, you must use JavaScript notation. For example, “Math.sin(x) + Math.cos(x)”. If there is only one expression, the “Math.” is automatically prepended.

Then click the “Step” button. The picture below shows what happens with each step.


Depending on the function, repeated stepping may do one of several things:

Try It Yourself

To watch recursion in action, click the red button. For more sample functions, click the buttons in the “Interesting functions” section below.

Expression for f(x)Orbit values x, f(x), f(f(x)), ...

This sets x to be f(x)

Interesting functions to try


What’s one of the first things a young student does when she gets a new tool like a calculator? Presses every button over and over, just to see what happens! This amounts to finding orbits, if the key is a specific function, like x squared, log(x), sin(x), and so on. This apparently trivial game takes the student into a very deep topic.

Part of the importance of this is that many phenomena in the world outside math can be modeled by a function that take the way things are today, and cranks out a prediction of how they will be tomorrow. Well... and what about the day after tomorrow? Of course, you take the prediction, and plug it back in the function. As in the diagram below. In other words, generate an orbit!


The behavior of orbits of iterated functions can be either simple (periodic orbits) or complex (chaotic orbits). The functions with the green buttons above are versions of the logistic map, and are the topic of the next page to come in this sequence. In brief, as the coefficient varies from 0 to 4, the orbits have period 1, then 2, then 4... then 3, then 6, then 9... and for each possible period there is some coefficient . For example, when the coefficient is 3.5 the orbit will settle down into a period of 4. Can you find a coefficient that results in a period of 5? (Not easy!) When the coefficient is 4, the orbits are chaotic.

☜ Navigate through the Chaos pages ☞