This is a cat in a mathematical hat (part of The Physics of Cats).

A square photograph is run through a short computer program. One iteration of the program gives us a set of displaced strips. A few more iterations gives us something like TV interference.

After a very particular number of iterations, the photograph returns! Every pixel is exactly back where it started.

This is a standard demonstration of the “Arnold’s cat map”, named after the mathematician V. I. Arnold (the map, and the illustration of the cat, appear in his book Ergodic Problems of Classical Mechanics, with A. Avez; English translation 1968) [[1]]. This demonstration is also unusually efficient at making chaos look suspicious: if the operation is supposed to be chaotic, how can the cat return on schedule?

There are two maps being demonstrated here. One is a continuous map of a surface; the other is a permutation of a finite number of pixels. These two maps are related by the same matrix, but the fact that the number of pixels is finite makes a big difference to the meaning of “recurrence”. This was the starting point for a 1992 paper by Freeman Dyson and Harold Falk on the period of the “discrete” map; the digital cat in their paper returned after 24 iterations of a 161 × 161 pixel grid [[2]].


A Square Whose Opposite Edges Meet

Take coordinates $x,y$ in the unit square and apply

$$ \begin{pmatrix}x'\\y'\end{pmatrix} =A\begin{pmatrix}x\\y\end{pmatrix}\pmod 1, \qquad A=\begin{pmatrix}2&1\\1&1\end{pmatrix}. $$

The modulo operation subtracts integers until each coordinate lies in $[0,1)$. A point leaving the right edge enters through the left. Top meets bottom in the same way. The square therefore represents a torus, although drawing it as a square is considerably easier than printing a photograph on a doughnut.

The linear operation can be assembled from two shears:

$$ A= \begin{pmatrix}1&1\\0&1\end{pmatrix} \begin{pmatrix}1&0\\1&1\end{pmatrix}. $$

Each shear preserves area. Their product has determinant $2\times1-1\times1=1$, so it does too. Integer entries matter because points differing by an integer vector still differ by an integer vector after applying $A$: the rule respects the identification of opposite edges.

The inverse is equally explicit:

$$ A^{-1}=\begin{pmatrix}1&-1\\-1&2\end{pmatrix}. $$

It also has integer entries. The matrix belongs to $SL(2,\mathbb Z)$, the group of integer two-by-two matrices with determinant one. No information is thrown away by the ideal operation. Apparent scrambling is compatible with complete reversibility.


The Stretching Has a Number

An eigenvector is a direction that the matrix stretches without changing its direction. The characteristic equation is

$$ \det(A-\lambda I)=\lambda^2-3\lambda+1=0, $$

giving

$$ \lambda_+=\frac{3+\sqrt5}{2}\approx2.618, \qquad \lambda_-=\frac{3-\sqrt5}{2}\approx0.382. $$

Their product is one: stretching in one direction is balanced by contraction in the other. Corresponding vectors can be chosen as $(1,\lambda_\pm-2)$. Both slopes are irrational, which will matter for mixing.

Write a small displacement between nearby points as a sum of these two directions. Before the points wrap far enough around the torus to make their global separation ambiguous, the expanding component grows as $\lambda_+^n$ after $n$ iterations; the contracting component shrinks as $\lambda_-^n$. The Lyapunov exponents are

$$ \chi_\pm=\log\lambda_\pm =\pm0.96242365\ldots $$

per iteration. There is no time unit until one assigns a duration to each step.

So after 10 iterations, the expanding component of the displacement has grown by a factor of 15,127 or so. An initial displacement of a millionth of a width of the square becomes about $0.015$ (in that direction). This exponent describes generic local sensitivity; on a compact surface it does not mean that every pair of points keeps separating steadily for ever.

Stretching and wrapping repeatedly draw a region of the torus into thin filaments, which are difficult to distinguish from an even distribution (at a fixed resolution). With exact resolution the filaments remain, because an invertible map has not lost the original information.


Mixing Does Not Mean Forgetting

A precise statement of this is that the continuous cat map is “mixing”: if $E$ and $F$ are two measurable regions of the torus, the area of $A^n E \cap F$ approaches the product of the two areas. (This is proven by Arnold and Avez, and mentioned at the start of the Dyson and Falk paper) [[1]], [[2]]. A patch of the torus increasingly samples any fixed “observing” region in the proportions expected from an even distribution.

A short independent argument shows why the arithmetic is involved. Fourier modes on the torus have the form

$$ e_{\mathbf k}(\mathbf x)=\exp(2\pi i\mathbf k\cdot\mathbf x), \qquad \mathbf k\in\mathbb Z^2. $$

Iteration replaces their wavevector by $(A^{\mathsf T})^n\mathbf k$. Integrating a product of two modes over the torus gives zero unless their integer wavevectors cancel. For any nonzero integer vector, the iterated wavevector eventually grows beyond every fixed bound: it cannot lie exactly along the irrational contracting direction. Consequently two fixed nonconstant Fourier modes eventually have zero correlation. Approximating square-integrable functions by finite sums of modes extends the result to those functions, including indicators of regions.

So the scale of observation is fixed, while the scale of the pattern is becoming finer and finer. We get a loss of correlation without having an “eraser” in the matrix!


The Computer Operates Modulo a Different Number

For a digital $N\times N$ image, label pixel positions by integers $i,j$ between zero and $N-1$ and use

$$ \begin{pmatrix}i'\\j'\end{pmatrix} =A\begin{pmatrix}i\\j\end{pmatrix}\pmod N. $$

This is exact integer arithmetic. The same integer inverse proves that each position has one predecessor, so the operation is a permutation. Its cycles cannot run forever without closing.

The “period” of the map as a whole is the smallest positive integer $T_N$ such that

$$ A^{T_N}\equiv I\pmod N. $$

It is sufficient to test the two “basis” positions $(1, 0)$ and $(0, 1)$ (these determine the columns of the matrix). Repeatedly multiply the matrix by $A$, taking the result modulo $N$, and stop when you get the identity matrix for the first time. Here are some values (independently checked):

Grid width $N$Exact permutation period $T_N$
510
1030
50150
100150
16124
256192
257258
512384

The jump from 256 to 257 is a warning not to think of this as a simple function of the image size! It is a number-theoretic question (involving the arithmetic modulo $N$). Dyson and Falk prove that the period can never exceed $3N$, and this bound is reached only when $N = 2 \cdot 5^k$ (such as 10 and 50) [[2]]. Also, the cycles of individual pixels may have shorter periods, and a particular image may come back sooner if there are several positions with identical colours (a uniformly coloured image, not a particularly exciting cat, has period 1).

A familiar sequence is lurking in the matrix:

$$ A^n=\begin{pmatrix} F_{2n+1}&F_{2n}\\ F_{2n}&F_{2n-1} \end{pmatrix}, $$

where $F_0=0$, $F_1=1$, and $F_{m+2}=F_{m+1}+F_m$. Multiplying this expression by $A$ proves the next step using the Fibonacci recurrence. Thus the return condition is a statement about Fibonacci numbers modulo $N$. Dyson and Falk analyse this arithmetic in detail [[2]], using the axis-swapped matrix $\begin{pmatrix}1&1\\1&2\end{pmatrix}$, which has the same periods; the table here comes from direct matrix enumeration.


Which Cat Is Returning?

Any point on the continuous torus with rational coordinates lies on a finite rational grid, and is therefore periodic. In fact, it can be shown that if a point in the continuous map is periodic (with period $n$) then it must have rational coordinates: we need $(A^n - I) \mathbf{x}$ to be an integer vector. Neither eigenvalue of $A^n$ is 1 (so the matrix is invertible), and the inverse matrix has rational entries.

So exact periodic points are dense (but have zero area), but almost all points are non-periodic. However, the continuous map preserves area, and the space has a finite area, so we get Poincaré recurrence: almost all points return arbitrarily close to their initial position. (This is “arbitrarily close”, not “exactly”; and “sufficiently long time”, not a universal time for all points!). So we should not expect an exact return of a continuous photograph.

This same matrix $A$ has a second life as a quantized linear map of the torus (J. H. Hannay and M. V. Berry, 1980), and the “quantum cat map” is a standard test case for quantum chaos (the theory in which, for example, “trace formulae” relate the spectrum to sums over classical periodic orbits; the same sort of physics that underlies the analogy between primes and quantum energy levels) [[3]].

So the finite pixel-permutation can have initial stretching behaviour that mimics the continuous map, but its “indefinite future” is periodic. Once the resolution is fixed, the increasingly fine filaments cannot provide new information indefinitely. (If your implementation of the map involves interpolation, rounding positions to the nearest pixel, or cropping the edges, you may lose information and not have the “exact return” property at all).

The returning photograph is a theorem about the computer program; the chaos is a theorem about the continuous map.

Literature and calculations checked through 2026-10-12.


References

[1] Arnold, V. I., & Avez, A. (1968). Ergodic Problems of Classical Mechanics. W. A. Benjamin. Reprinted 1989, Addison-Wesley.

[2] Dyson, F. J., & Falk, H. (1992). Period of a discrete cat mapping. The American Mathematical Monthly, 99(7), 603–614. https://doi.org/10.1080/00029890.1992.11995900. JSTOR: https://www.jstor.org/stable/2324989.

[3] Hannay, J. H., & Berry, M. V. (1980). Quantization of linear maps on a torus—Fresnel diffraction by a periodic grating. Physica D: Nonlinear Phenomena, 1(3), 267–290. https://doi.org/10.1016/0167-2789(80)90026-3.


Changelog

  • 2026-10-12: Initial draft. Distinguished continuous mixing and near recurrence from the exact period of a finite pixel permutation; checked the displayed periods independently.

AI-likeness scores (0–1) · Mesmer 0.01 · MELD 0.36 · Open Pangram 0.06