# Whirling Squares

> Squares nested in a square, each one turned and shrunk by the same step, so their corners run along four spirals; the step animates.

Go round a square counterclockwise and mark a point on each side, at the fraction $s$ of the side from the corner where the side starts, then join the four points: the result is a smaller square, turned a little. Do the same to the new square, and again. This document draws 30 steps. Each step cuts four triangles from the corners of a square; the document colours them blue and yellow in turn, and the triangles line up along four spiral arms.

Every step is the same motion. Written as complex numbers, with the centre of the square at $0$, a corner $c$ of a square and the next corner $\imaginaryI c$ give the new corner $(1 - s)c + s\,\imaginaryI c$, so each step multiplies the square by $(1 - s) + s\,\imaginaryI$: it shrinks by $m = \sqrt{s^2 + (1 - s)^2}$ and turns by the angle $q$ with $\tan q = \frac{s}{1 - s}$. The corners of square $n$ are at the distance $\sqrt{2}\,m^n$ from the centre, so they lie on four logarithmic spirals.

$s$ animates between $0.05$ and $0.95$. At $s = 0.5$ each square joins the midpoints of the one before, turns by $45°$ and has half its area. The values $s$ and $1 - s$ give mirror images, so the whirl changes direction at $s = 0.5$. When $s$ is small, the spirals approach the paths of four animals that start at the corners of a square and each walk toward the next one: those paths cross every line through the centre at $45°$.

After a JSXGraph example by The Center of Mobile Learning with Digital Technology.

- [Open the interactive version](https://graph-paper.io/showcase/en/whirling-squares)
