HomeChaos & DynamicsGingerbreadman Map — A Self-Similar Fractal from Folding

🍪 Gingerbreadman Map — A Self-Similar Fractal from Folding

Interactive simulation of Devaney's Gingerbreadman map: click to seed points and watch bounded chaotic orbits trace a self-similar fractal silhouette while escaping orbits vanish.

Chaos & Dynamics2DModerate60 FPS
gingerbread-map ↗ Open standalone

About the Gingerbreadman Map

The Gingerbreadman map is a deceptively simple two-dimensional discrete dynamical system popularised by the American mathematician Robert Devaney in his textbooks on chaotic dynamics. Devaney used it as a "toy" model — a piecewise-linear cousin of the horseshoe map and the kind of stretch-and-fold construction that underlies kneading theory — because its behaviour can be worked out almost entirely by hand, yet it still reproduces every hallmark of genuine chaos. The map takes a point (xₙ, yₙ) to a new point via xₙ₊₁ = 1 − yₙ + |xₙ|, yₙ₊₁ = xₙ. The name comes purely from geometry: when you iterate a dense grid of starting points and keep only the ones whose orbits never escape, the surviving points trace out a blobby, self-similar region that — with a little imagination — looks like the silhouette of a gingerbread man.

The absolute value |xₙ| is the whole engine of the map: it folds the plane back on itself along the line x = 0, turning an otherwise ordinary linear recurrence into a piecewise-linear one with a crease. That single fold is enough to stretch nearby orbits apart in some directions while squeezing them together in others, exactly the stretch-and-fold mechanism that produces sensitive dependence on initial conditions. Iterating the map divides the plane into two very different fates: a bounded invariant region where orbits wander forever without ever leaving (visiting a dense, chaotic set of points inside the gingerbread-man shape), and everything outside it, from which orbits are flung further and further from the origin on every step until they diverge to infinity. The boundary of the bounded region is itself a fractal curve, built from countably many straight edges arranged in a self-similar pattern — zoom into any corner and you find a smaller copy of the whole shape. This simulation lets you explore that structure directly: click on the canvas to drop a test point anywhere, or reset to auto-seed a fine grid of points across the view window, then watch each point get iterated forward. Points that remain bounded are drawn in the accent colour and accumulate into the fractal silhouette; points that escape past a large threshold are simply removed from the plot, so after a few seconds of iteration the shape of the invariant region emerges directly from the data.

Frequently Asked Questions

What is the Gingerbreadman map, and where does the name come from?

It is the discrete map xₙ₊₁ = 1 − yₙ + |xₙ|, yₙ₊₁ = xₙ, popularised by Robert Devaney as a simple piecewise-linear example of chaos. The name comes from the shape of its bounded invariant region: when you plot every point whose orbit never escapes to infinity, the surviving points trace out a rounded, self-similar blob that resembles the silhouette of a gingerbread man.

Why is the map piecewise linear — what does the |x| term do?

Without the absolute value the recurrence would be a plain linear map, which cannot produce chaos on its own. The term |xₙ| folds the plane along the line x = 0: for xₙ ≥ 0 the map behaves one way, and for xₙ < 0 it behaves differently, joined at a crease. This fold is what stretches some directions and compresses others on each iteration, the same stretch-and-fold mechanism used in the baker's map and Smale's horseshoe to generate genuine chaotic dynamics from purely linear pieces.

What determines whether an orbit stays bounded or escapes?

It depends entirely on the starting point. Points that lie inside a specific bounded invariant region keep bouncing around forever within that region, densely filling out the chaotic gingerbread-man shape. Points that start outside this region get pushed further from the origin on every iteration and diverge to infinity. There is no in-between: the fate is decided the instant you choose (x₀, y₀), which is exactly what clicking on the canvas lets you test.

What is the fractal, self-similar structure of the bounded region?

The boundary of the invariant region is built from a countable union of straight line segments, arranged so that small pieces of the boundary are rescaled copies of larger pieces — a self-similar, fractal curve. This happens because the map is piecewise linear: each linear piece maps straight edges to straight edges, and the folding action repeatedly cuts and reassembles the boundary at every scale. Zooming into any corner of the plotted gingerbread-man shape reveals smaller versions of the same jagged, angular pattern found at the full scale.

Is this map really chaotic, even though it's piecewise LINEAR?

Yes. "Linear" only describes each individual piece of the map; the map as a whole is nonlinear because of the fold introduced by |xₙ|. Chaos does not require curvy nonlinear formulas — it requires stretching and folding, and piecewise-linear maps can do both. The baker's map and Smale's horseshoe map are the classic examples: both are built entirely from straight-line pieces, yet both are provably chaotic, with dense periodic orbits, sensitive dependence on initial conditions, and topological mixing. The Gingerbreadman map inherits exactly this kind of chaos from its own fold.

What happens if I click outside the bounded region?

The point you place is iterated forward like any other. If it lies outside the invariant region, its coordinates grow rapidly on each step — within a handful of iterations |x| and |y| blow past any reasonable bound. Once a point's coordinates exceed the escape threshold used in this simulation, it is marked as escaped and removed from the plot, so you will see it vanish rather than settle into the coloured, accumulating cloud of bounded points.

How does this relate to symbolic dynamics and kneading theory?

Piecewise-linear folding maps like this one are exactly the kind of system Devaney and others use to introduce symbolic dynamics: because the plane is cut into pieces by the fold, every orbit can be encoded as an infinite sequence of symbols recording which piece it visits at each step. Kneading theory studies how these itinerary sequences behave — which sequences are actually realised by orbits, and how the folding structure of the map constrains them. The Gingerbreadman map's simplicity makes it a convenient hands-on example for this otherwise abstract machinery.

Who was Robert Devaney, and why did he study this map?

Robert L. Devaney is an American mathematician known for his widely used textbooks and expository work on chaotic dynamical systems, and for his rigorous definition of chaos (a map is chaotic if it has sensitive dependence on initial conditions, is topologically transitive, and has dense periodic points). He introduced piecewise-linear "toy" maps such as this one specifically because their orbits can be tracked by direct calculation, making them ideal teaching examples that still capture the full richness of chaotic behaviour found in far more complicated systems.

⚙ Under the hood

Interactive simulation of Devaney's Gingerbreadman map: click to seed points and watch bounded chaotic orbits trace a self-similar fractal silhouette while escaping orbits vanish.

Canvas 2DChaos TheoryFractalPiecewise-Linear MapInvariant Set

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)