Arnold's cat map explained
Arnold's cat map is one of the simplest chaotic systems there is: a rule one line long that stretches a square, cuts it and puts it back together. Applied to a photo it turns a cat into noise within a few steps, and then, after a number of steps that depends on the size of the picture, brings the cat back exactly.
The rule
Number the pixels of a square picture by their column x and their row y, from 0 to N − 1, starting at the bottom left. One step of the cat map moves the pixel at (x, y) to (x + y, x + 2y), and every coordinate that comes out larger than N − 1 is reduced modulo N, so that it wraps around the edges. In matrix form the step multiplies (x, y) by (1 1 / 1 2). Vladimir Arnold described it in 1967, in a book on ergodic theory with André Avez, and drew a cat to show what it does.
Stretch, cut, fold
Seen as geometry, the step is a shear followed by a fold. The matrix turns the square into a parallelogram with corners (0, 0), (1, 1), (2, 3) and (1, 2), which sticks out of the square. Cut it along the edges of the square, slide each piece back by whole sides, and the pieces fill the square again exactly, with no gaps and no overlaps. That is because the determinant of the matrix is 1: the step keeps every area. The generator draws the cut lines with Show the cuts.
Why it is chaotic
The matrix has two eigenvalues, (3 + √5)/2 ≈ 2.618 and (3 − √5)/2 ≈ 0.382, the square of the golden ratio and its inverse. Along one direction everything is stretched by 2.618 at every step, along the other it is squeezed by the same factor. Two points that start a hair apart are soon on opposite sides of the square, and a blob of colour is drawn into ever thinner stripes that wrap around until it is spread evenly over the whole square. Such a map is called hyperbolic, or an Anosov map, and it is the standard example of mixing.
Why a picture still comes back
A picture has only finitely many pixels, so there are only finitely many ways to arrange them, and every step can be undone. The sequence of frames must therefore repeat, and the first frame that repeats is the very first one: the original photo. This is a discrete version of Poincaré's recurrence theorem. On the continuous square, with infinitely many points, the map never returns; on a grid of pixels it always does, exactly.
The period and the Fibonacci numbers
The powers of the matrix are made of Fibonacci numbers: (1 1 / 1 2) to the power t is (F₂ₜ₋₁ F₂ₜ / F₂ₜ F₂ₜ₊₁). The photo is back when this power leaves every pixel in place, that is when it equals the identity modulo N. So for N greater than 2 the period of the cat map is half the Pisano period of N, the length after which the Fibonacci numbers modulo N repeat. Freeman Dyson and Harold Falk proved in 1992 that it never exceeds 3N, yet it varies wildly: 12 for 144, 15 for 124, 25 for 101, 60 for 240, 300 for 150 and 384 for 512.
Near returns
Between the start and the end the picture is not always pure noise. For some sizes the matrix power halfway through the period is minus the identity, and the photo appears upside down; at other steps faint traces of it show through. The chart in the generator measures how much each step looks like the photo, so these moments stand out as peaks.
Try it
Open the cat map, play it with the tiger or your own photo, and change the size to see the period jump. Animate the stretch shows each step as a shear and a fold, Show the cuts draws the lines along which the square is cut, and the chart lets you jump to any step. The pencil opens the picture in the photo editor, with the picture and the cuts on layers of their own.
Frequently asked questions
Is Arnold's cat map chaotic or periodic?
Both, depending on where it acts. On the continuous square it is chaotic: nearby points separate exponentially and no region ever returns to its shape. On a grid of N × N pixels it is periodic, because there are only finitely many arrangements of the pixels; the period is the smallest t for which the matrix to the power t equals the identity modulo N.
What is the longest possible period?
3N for a square of N × N pixels, reached exactly when N is twice a power of 5 from 10 on: 10 (30 steps), 50 (150 steps), 250 (750 steps) and so on. Most sizes return much sooner.
Can the cat map encrypt images?
It is used as a building block in image encryption schemes, because a few steps carry every pixel far from its neighbours. On its own it is not secure: anyone who knows the size can undo it, and the period is easy to compute.
Are there other cat maps?
Every 2 × 2 matrix of whole numbers with determinant 1 and a trace greater than 2 gives a map of the same kind: it keeps areas, stretches in one direction and squeezes in the other. The generator offers (1 2 / 1 3), (1 3 / 1 4) and (2 1 / 1 1) beside Arnold's (1 1 / 1 2).
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Open the cat map