Skip to content
The Lumenary
Grades 3–5Ages 8–11 40 min

Symmetry: slides, turns and flips

Fold it, turn it, slide it, flip it — and discover that two flips make a turn.

Formally verified · 17 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review

Your guides: Chloe, Margaret, Gideon

MotivationH

Patterns that fit onto themselves

Look at a butterfly: its left wing is the mirror image of its right wing. Look at a snowflake: turn it a little and it looks exactly the same. People all over the world make patterns like this on purpose. In Tamil Nadu in South India, families draw kolam patterns of loops and dots at their doorsteps each morning. In Ghana, Adinkra symbols are stamped onto cloth. In the Alhambra palace in Granada, Spain, walls are covered with tiles whose patterns repeat in every direction.

What do all these patterns have in common? They can be moved — folded over, turned or slid — and still fit exactly onto themselves. That is what mathematicians call symmetry.

IntuitionH

Folding and turning tests

The folding test. Draw a shape on paper and cut it out. If you can fold it so that the two halves match exactly, the fold line is a line of symmetry. A mirror placed on that line shows the whole shape.

The turning test. Lay a piece of tracing paper over the shape, trace it, and pin the tracing at the centre. Turn the tracing slowly, all the way round. Count how many times the tracing fits exactly over the shape — including the very end, when you have turned all the way back to the start.

A square passes the folding test along 4 different lines, and in the turning test it fits 4 times in one full turn. A rectangle that is not a square passes the folding test for only 2 lines. (Try folding a sheet of paper along its diagonal: the corners do not match!)

DefinitionsH

Words we need

Definition— line of symmetry

A line of symmetry (or mirror line) divides a shape into two halves that are mirror images of each other: flipping the shape over the line leaves it looking exactly the same.

Definition— rotational symmetry

A shape has rotational symmetry of order nn if exactly nn turns within one full turn (counting the full turn itself) leave it looking the same. A shape that only fits after a full turn has order 1 — we say it has no rotational symmetry.

There are three ways to move a shape without changing its size or shape:

Definition— slide, turn and flip

  • A slide (or translation) moves every point the same distance in the same direction — for example, 3 squares right and 1 square up.
  • A turn (or rotation) turns every point about a fixed point, the centre of turn, through the same angle — for example, a quarter turn anticlockwise about the point P.
  • A flip (or reflection) reflects every point in a mirror line: each point goes to the same distance on the other side of the line.
slideturnflip
A slide (3 squares right, 1 up), a quarter turn anticlockwise about the gold dot, and a flip in the dashed mirror line. The dashed flag is where each move started.
Worked examplesH

Counting symmetries

Example— Shapes

ShapeLines of symmetryOrder of rotational symmetry
square44
rectangle (not a square)22
equilateral triangle33
isosceles triangle (not equilateral)11
parallelogram (not a rectangle or rhombus)02
kite (not a rhombus)11
regular hexagon66
circleinfinitely manyany turn at all fits

Example— A surprise: the parallelogram

A parallelogram has no line of symmetry — fold it any way you like, the halves never match. But turn it through half a turn about its centre and it fits exactly onto itself. So a shape can have rotational symmetry without line symmetry.

Example— Letters

In simple block capitals, A has one (vertical) line of symmetry, B has one (horizontal) line, and H has two lines and rotational symmetry of order 2. N, S and Z have no line of symmetry but do have rotational symmetry of order 2: turn the page upside down and they look the same. (Letters in fancy fonts may break these rules!)

Explore

Explore: lines of symmetry and turns

Choose a shape. Switch on "symmetry" to see its lines of symmetry, and "rotation" to turn it over its outline; the gold dot shows where one corner goes. Which shapes have the same number of lines of symmetry as their order of rotational symmetry? Which do not?

Shape explorer

Count the lines of symmetry, then turn on rotation.

Equilateral triangleTriangle

Lines of symmetry
3

All three sides are equal and all three angles are 60°.

Each dashed line is a line of symmetry: fold along it and the two halves match exactly.

ProofH

Why the rules work

Theorem— Moves keep lengths and angles

Slides, turns and flips do not change lengths or angles. A shape and its image are exactly the same size and shape.

Think of the shape drawn on tracing paper. A slide pushes the tracing along; a turn spins it about a pin; a flip turns the tracing over onto its other side. The paper is never stretched, squashed or torn, so every length and every angle stays the same. (This is a physical picture, not a proof. In the Lean section below, the computer proves it for every pair of points on squared paper.)

Theorem— Flipping twice

Flipping twice in the same mirror line puts every point back where it started.

Proof

A point that is some distance dd on one side of the mirror goes to distance dd on the other side. Flipping again sends it distance dd back to the first side — exactly where it began. Points on the mirror line do not move at all.

∎

So every move can be undone: a slide is undone by the opposite slide (3 right and 1 up is undone by 3 left and 1 down); a turn is undone by turning back through the same angle about the same centre; and a flip is undone by the same flip.

Theorem— Two flips in parallel lines make a slide

Flipping in one mirror line and then in a second, parallel mirror line slides every point at right angles to the mirrors, by twice the distance between them.

mirror 1mirror 2moved 5 squares = twice the gap
Two parallel mirror lines 2½ squares apart. The first flip turns the flag to face left; the second turns it back. Altogether the flag has slid 5 squares: twice the gap between the mirrors.

Proof

Measure positions across the mirrors with a number line: the first mirror at 0 and the second at gg. A point at position xx goes to −x-x in the first mirror. Now it is at distance g−(−x)=g+xg - (-x) = g + x from the second mirror, so the second flip sends it to g+(g+x)=x+2gg + (g + x) = x + 2g. Every point has moved 2g2g: a slide by twice the gap.

∎

Theorem— Two flips in crossing lines make a turn

Flipping in one mirror line and then in a second mirror line that crosses it is a turn about the crossing point, through twice the angle between the mirrors.

Two examples: mirrors that cross at a right angle (90∘90^\circ) give a half turn (180∘180^\circ); mirrors that cross at 45∘45^\circ give a quarter turn (90∘90^\circ). Here is why, as a sketch. The crossing point lies on both mirrors, so it never moves, and each flip keeps every point at the same distance from it: every point stays on its own circle around the crossing point. To see how far round its circle a point goes, measure angles from the first mirror. A point at angle aa goes to angle −a-a in the first mirror, and then, if the second mirror is at angle mm, to angle 2m+a2m + a. Every point has moved round through the same angle 2m2m: that is a turn.

For grown-ups · watch two flips become a turn

This explorer is built for older students, so it uses matrices (grids of numbers that describe moves) — you can ignore the numbers. Matrix AA is a flip in the horizontal line and matrix BB is a flip in the diagonal line at 45∘45^\circ. Look at the little flag after "first AA, then BB": it has been turned a quarter turn, not flipped. Then look at "first BB, then AA": a quarter turn the other way. The order matters!

Two flips make a turn

Apply A and then B, or B and then A, and compare the results.

Entries of the matrix A
A =
Entries of the matrix B
B =
First A, then B: the matrix BA
BA =
0−110
First B, then A: the matrix AB
AB =
01−10
  • image of the grid
  • image of the unit square
  • image of the flag
  • before the transformation
  • after the first step

AB ≠ BA: the order matters.

BA means “apply A first, then B”: products of transformations are read from right to left.

det(AB) = det(BA) = det A · det B = −1 · −1 = 1 The area scale factor is the same in either order.

Theorem— Symmetries of a regular polygon

A regular polygon with nn sides has exactly nn lines of symmetry and rotational symmetry of order nn.

Proof

Number the corners 1,2,…,n1, 2, \dots, n going round. A symmetry moves corners to corners and keeps neighbours next to each other (it does not change lengths).

  • Corner 1 can go to any of the nn corners.
  • Corner 2, its neighbour, must go to a neighbour of wherever corner 1 went: there are only 2 choices, one on each side.
  • Once we know where corners 1 and 2 go, every other corner is fixed too: corner 3 is the other neighbour of corner 2, and so on round the polygon.

So there are at most n×2=2nn \times 2 = 2n symmetries. For a regular polygon all of them really happen. In nn of them the corners keep going round the same way: these are the nn turns (through 360∘n\frac{360^\circ}{n}, twice that, …, up to the full turn), so the order of rotational symmetry is nn. In the other nn the order of the corners is reversed: these are flips, one for each of nn lines of symmetry.

∎

For example, the equilateral triangle has 2×3=62 \times 3 = 6 symmetries: 3 turns (120∘120^\circ, 240∘240^\circ, 360∘360^\circ) and 3 flips. A rectangle that is not a square is not regular — its sides are not all equal — and it has only 4 symmetries: 2 turns and 2 flips. Its diagonals are not lines of symmetry.

ExplanationH

One move after another: does order matter?

Doing one move and then another is again a move. Two slides make a slide; two turns about the same centre make a turn; and, as we just saw, two flips make a slide or a turn.

But the order can matter. Cut out a paper letter F. First give it a quarter turn anticlockwise and then flip it in a vertical mirror line. Start again: first flip it, then turn it. The two results face different ways! Doing the same two moves in a different order can give a different result.

Formal mathematicsF

Gideon's true-or-false game

Gideon only plays with statements that are exactly true or exactly false. Decide, and give a reason.

  1. "The diagonals of every rectangle are lines of symmetry." — False. Only for squares. Fold a sheet of paper along a diagonal and the corners do not match.
  2. "Flipping a shape twice in the same mirror line puts it back where it started." — True.
  3. "A flip in a vertical line and a half turn always have the same effect." — False. A flipped letter F faces the other way; a half-turned F is upside down.
  4. "Two flips in parallel mirror lines 3 squares apart make a slide of 6 squares." — True. Twice the gap.
For grown-ups · the same ideas in Lean, a proof checker

In Lean, a point of squared paper is a pair of whole numbers (x, y), and each move is a function that sends every point to a new point:

slideLean 4Formally verified
/-- **Slide** every point `a` squares to the right and `b` squares up. -/
def slide (a b : Int) (p : Point) : Point := (p.1 + a, p.2 + b)
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
flipVLean 4Formally verified
/-- **Flip** in the vertical mirror line through `(0, 0)`: left and right swap over. -/
def flipV (p : Point) : Point := (-p.1, p.2)
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
quarterTurnLean 4Formally verified
/-- **Turn** a quarter turn (90°) anticlockwise about `(0, 0)`. -/
def quarterTurn (p : Point) : Point := (-p.2, p.1)
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

Lean proves the rules for every point, not just for the ones we tried:

flip_twiceLean 4Proved here from basic factsFormally verified
/-- **Flipping twice in the same line puts every point back where it started.** -/
theorem flip_twice (p : Point) : flipV (flipV p) = p := by
  obtain ⟨x, y⟩ := p
  simp [flipV]
Axioms used: propextformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
slide_undoLean 4Proved here from basic factsFormally verified
/-- A slide is undone by the opposite slide. -/
theorem slide_undo (a b : Int) (p : Point) : slide (-a) (-b) (slide a b p) = p := by
  obtain ⟨x, y⟩ := p
  simp only [slide, Prod.mk.injEq]
  omega
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
four_quarter_turnsLean 4Proved here from basic factsFormally verified
/-- Four quarter turns make a full turn: every point is back where it started. So a quarter
turn is undone by three more quarter turns. -/
theorem four_quarter_turns (p : Point) :
    quarterTurn (quarterTurn (quarterTurn (quarterTurn p))) = p := by
  obtain ⟨x, y⟩ := p
  simp [quarterTurn]
Axioms used: propextformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

Two flips make a turn or a slide:

flips_at_right_anglesLean 4Proved here from basic factsFormally verified
/-- **Two flips in mirror lines crossing at a right angle make a half turn** about the crossing
point. (The turn is twice the angle between the mirrors: 2 × 90° = 180°.) -/
theorem flips_at_right_angles (p : Point) : flipH (flipV p) = halfTurn p := by
  obtain ⟨x, y⟩ := p
  rfl
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
flips_at_45Lean 4Proved here from basic factsFormally verified
/-- **Two flips in mirror lines crossing at 45° make a quarter turn** (2 × 45° = 90°): first
flip in the diagonal `y = x`, then in the vertical line. -/
theorem flips_at_45 (p : Point) : flipV (flipD p) = quarterTurn p := by
  obtain ⟨x, y⟩ := p
  rfl
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
flips_in_parallel_linesLean 4Proved here from basic factsFormally verified
/-- **Two flips in parallel mirror lines make a slide.** Flipping in the line `x = c` and then
in the line `x = d` slides every point by twice the gap from the first line to the second. -/
theorem flips_in_parallel_lines (c d : Int) (p : Point) :
    flipAt d (flipAt c p) = slide (2 * (d - c)) 0 p := by
  obtain ⟨x, y⟩ := p
  simp only [flipAt, slide, Prod.mk.injEq]
  omega
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

Order matters, and a flip is not a half turn:

order_mattersLean 4Proved here from basic factsFormally verified
/-- **The order of moves can matter.** A quarter turn and then a flip in the vertical line is a
flip in the diagonal `y = x`; the flip first and then the quarter turn is a flip in the other
diagonal. They send the point `(1, 0)` to different places. -/
theorem order_matters :
    flipV (quarterTurn (1, 0)) ≠ quarterTurn (flipV (1, 0)) := by
  decide
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
flip_is_not_half_turnLean 4Proved here from basic factsFormally verified
/-- **A flip is not a half turn.** The flip in the vertical line sends `(1, 2)` to `(-1, 2)`,
but the half turn sends it to `(-1, -2)`. -/
theorem flip_is_not_half_turn : flipV (1, 2) ≠ halfTurn (1, 2) := by
  decide
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

Moves keep distances. To avoid square roots, Lean compares the squares of distances (Pythagoras):

dist2Lean 4Formally verified
/-- The **square** of the distance between two points (by Pythagoras). Working with the square
avoids square roots: two distances are equal exactly when their squares are. -/
def dist2 (p q : Point) : Int :=
  (p.1 - q.1) * (p.1 - q.1) + (p.2 - q.2) * (p.2 - q.2)
Axioms used: No axiomsformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
turn_keeps_distanceLean 4Proved here from basic factsFormally verified
/-- A quarter turn does not change the distance between any two points: the two parts of the
distance swap places, and one of them changes sign. -/
theorem turn_keeps_distance (p q : Point) :
    dist2 (quarterTurn p) (quarterTurn q) = dist2 p q := by
  obtain ⟨x₁, y₁⟩ := p
  obtain ⟨x₂, y₂⟩ := q
  simp only [quarterTurn, dist2]
  have hy : -y₁ - -y₂ = -(y₁ - y₂) := by omega
  rw [hy, Int.neg_mul_neg, Int.add_comm]
Axioms used: propext, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

Finally, symmetries of a square and of a rectangle. A move is a symmetry when it sends the corners onto the corners. Lean checks all eight grid moves that keep the centre fixed:

isSymmetryLean 4Formally verified
/-- A move is a **symmetry** of a shape (given by its corners) if it sends the corners onto the
corners — the same corners, possibly in a different order (`List.isPerm`). -/
def isSymmetry (m : Point → Point) (corners : List Point) : Bool :=
  (corners.map m).isPerm corners
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
square_symmetriesLean 4Proved here from basic factsFormally verified
/-- All 4 turns and all 4 flips are symmetries of the square: it has rotational symmetry of
order 4 and 4 lines of symmetry. -/
theorem square_symmetries :
    (turns.filter (isSymmetry · square)).length = 4 ∧
    (flips.filter (isSymmetry · square)).length = 4 := by
  decide
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
rectangle_symmetriesLean 4Proved here from basic factsFormally verified
/-- Only 2 of the turns (0° and 180°) and only 2 of the flips (vertical and horizontal) are
symmetries of the rectangle: rotational symmetry of order 2, and 2 lines of symmetry. -/
theorem rectangle_symmetries :
    (turns.filter (isSymmetry · rectangle)).length = 2 ∧
    (flips.filter (isSymmetry · rectangle)).length = 2 := by
  decide
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor
rectangle_diagonal_not_mirrorLean 4Proved here from basic factsFormally verified
/-- **The diagonal of a rectangle is not a line of symmetry** (unless the rectangle is a
square): flipping in the diagonal sends the corner `(2, 1)` to `(1, 2)`, which is not a corner. -/
theorem rectangle_diagonal_not_mirror :
    isSymmetry flipD rectangle = false ∧ isSymmetry flipD square = true := by
  decide
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/SymmetryTransformations.leanTry it in the Lean web editor

What is not formalised here: turns through angles other than multiples of 90∘90^\circ (they do not keep squared paper on itself), and the general rule for regular polygons with nn sides. Mathlib, Lean's large mathematics library, has all the rigid motions of the plane and the dihedral groups — the symmetries of regular polygons.

ComputationC

Margaret moves letters and counts symmetries

Slides, turns and flips on squared paperPythonExact computationExhaustive finite checkComputationally tested
"""Slides, turns and flips of letters on squared paper.

Each letter is a set of squares on a grid, with (0, 0) at its centre. The
program moves the letters with flips and half turns and draws the results
in text, so you can see that a flip and a half turn are different moves -
even though for a very symmetric letter like H they give the same picture.
Then it checks, for every point of a 21 x 21 grid, that flipping twice
puts the point back, that two flips in crossing lines make a turn, that
two flips in parallel lines make a slide, and that no move changes the
distance between two points.

Runs unchanged in the browser (Pyodide) using only the standard library.
"""

import textwrap
from itertools import product

#: Letters drawn in a 3 x 5 box of squares centred at (0, 0).
LETTERS = {
    "F": {(-1, y) for y in range(-2, 3)} | {(0, 2), (1, 2), (0, 0)},
    "H": {(-1, y) for y in range(-2, 3)} | {(1, y) for y in range(-2, 3)}
    | {(0, 0)},
}

def flip_v(p):
    """Flip in the vertical mirror line through (0, 0)."""
    return (-p[0], p[1])

def flip_h(p):
    """Flip in the horizontal mirror line through (0, 0)."""
    return (p[0], -p[1])

def flip_d(p):
    """Flip in the diagonal mirror line y = x."""
    return (p[1], p[0])

def flip_at(c, p):
    """Flip in the vertical mirror line x = c."""
    return (2 * c - p[0], p[1])

def quarter_turn(p):
    """Turn a quarter turn anticlockwise about (0, 0)."""
    return (-p[1], p[0])

def half_turn(p):
    """Turn a half turn about (0, 0)."""
    return (-p[0], -p[1])

def slide(a, b, p):
    """Slide a squares right and b squares up."""
    return (p[0] + a, p[1] + b)

def dist2(p, q):
    """The square of the distance between two points."""
    return (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2

def move_shape(move, shape):
    """Apply a move to every square of a shape."""
    return {move(p) for p in shape}

def picture(shape):
    """Rows of '#' and '.' for a shape inside the 3 x 5 letter box."""
    return ["".join("#" if (x, y) in shape else "." for x in range(-1, 2))
            for y in range(2, -3, -1)]

def check_on_grid(radius):
    """Check the rules on every point (and pair of points) of a square grid.

    Returns a dict from rule name to True/False.
    """
    pts = list(product(range(-radius, radius + 1), repeat=2))
    moves = [flip_v, flip_d, quarter_turn, lambda p: slide(3, -2, p)]
    some = pts[:: max(1, len(pts) // 60)]
    return {
        "flip twice = no move": all(flip_v(flip_v(p)) == p for p in pts),
        "two flips at 90 degrees = half turn":
            all(flip_h(flip_v(p)) == half_turn(p) for p in pts),
        "two flips at 45 degrees = quarter turn":
            all(flip_v(flip_d(p)) == quarter_turn(p) for p in pts),
        "flips in x = 1 then x = 4 = slide 6":
            all(flip_at(4, flip_at(1, p)) == slide(6, 0, p) for p in pts),
        "moves keep every distance": all(
            dist2(m(p), m(q)) == dist2(p, q)
            for m in moves for p in some for q in pts),
    }

def main():
    for name, shape in LETTERS.items():
        rows = zip(picture(shape), picture(move_shape(flip_v, shape)),
                   picture(move_shape(half_turn, shape)))
        print(f"{name}: original  flipped  half-turned")
        for a, b, c in rows:
            print(f"   {a:<10}{b:<9}{c}")
        same = move_shape(flip_v, shape) == move_shape(half_turn, shape)
        print(f"   Flip and half turn give the same picture? "
              f"{'yes' if same else 'no'}")
    corner = (-1, 2)
    print(f"Even for H, the corner square {corner} goes to {flip_v(corner)}"
          f" by the flip,")
    print(f"but to {half_turn(corner)} by the half turn: different moves.")
    print()
    print("Checked on every point of a 21 x 21 grid:")
    for rule, ok in check_on_grid(10).items():
        print(f"  {rule:<40} {'true' if ok else 'FALSE'}")
    print()
    print(textwrap.fill(
        "Epistemic status: exact whole-number arithmetic, checked on every "
        "point of one 21 x 21 grid (and many pairs of points for distances). "
        "That is finite evidence; the lesson explains why the rules hold "
        "everywhere, and the Lean module proves them for every point.",
        width=78,
    ))

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Counting symmetries: every way to move the cornersPythonExact computationExhaustive finite checkComputationally tested
"""Counting the symmetries of shapes by trying every way to move the corners.

A symmetry of a polygon sends corners to corners and keeps every distance
between corners the same. So the program tries *every* way of sending the
corners to the corners (every permutation) and keeps those that preserve all
distances. Each one it keeps is a symmetry: a turn if the corners keep their
order round the shape, a flip (a line of symmetry) if the order is reversed.

Regular polygons: the distance between two corners depends only on how many
steps apart they are round the polygon, so we compare steps exactly.
Quadrilaterals: corners have whole-number coordinates, so squared distances
are exact whole numbers.

Runs unchanged in the browser (Pyodide) using only the standard library.
"""

import math
import textwrap
from itertools import combinations, permutations

#: Quadrilaterals with whole-number corners, listed in order round the shape.
QUADRILATERALS = {
    "square": [(1, 1), (-1, 1), (-1, -1), (1, -1)],
    "rectangle": [(2, 1), (-2, 1), (-2, -1), (2, -1)],
    "rhombus": [(0, 2), (-1, 0), (0, -2), (1, 0)],
    "kite": [(0, 3), (-1, 0), (0, -1), (1, 0)],
    "parallelogram": [(0, 0), (3, 0), (4, 1), (1, 1)],
    "isosceles trapezium": [(-2, 0), (2, 0), (1, 2), (-1, 2)],
}

def steps_apart(n, i, j):
    """How many steps apart corners i and j are, round a regular n-gon."""
    k = (i - j) % n
    return min(k, n - k)

def cross(o, a, b):
    """Positive if o, a, b go anticlockwise, negative if clockwise."""
    return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0])

def sq_dist(p, q):
    """Squared distance between two points with whole-number coordinates."""
    return (p[0] - q[0]) ** 2 + (p[1] - q[1]) ** 2

def symmetries(n, dist, orientation):
    """All distance-preserving permutations, split into (turns, flips).

    `dist(i, j)` is the distance between corners i and j (or anything that
    determines it), and `orientation(i, j, k)` is +1 or -1 according to
    whether corners i, j, k go anticlockwise or clockwise.
    """
    turns, flips = [], []
    pairs = list(combinations(range(n), 2))
    for perm in permutations(range(n)):
        if all(dist(perm[i], perm[j]) == dist(i, j) for i, j in pairs):
            same = orientation(*perm[:3]) == orientation(0, 1, 2)
            (turns if same else flips).append(perm)
    return turns, flips

def regular_polygon_symmetries(n):
    """Turns and flips of a regular polygon with n corners."""
    def orientation(i, j, k):
        return 1 if (j - i) % n < (k - i) % n else -1
    return symmetries(n, lambda i, j: steps_apart(n, i, j), orientation)

def quadrilateral_symmetries(corners):
    """Turns and flips of a quadrilateral given by its corners."""
    def orientation(i, j, k):
        return 1 if cross(corners[i], corners[j], corners[k]) > 0 else -1
    return symmetries(len(corners),
                      lambda i, j: sq_dist(corners[i], corners[j]),
                      orientation)

def main():
    names = {3: "equilateral triangle", 4: "regular 4-gon (square)",
             5: "regular pentagon",
             6: "regular hexagon", 7: "regular heptagon"}
    print("Shape                   tried   symmetries   turns   flips")
    for n in range(3, 8):
        tried = math.factorial(n)
        turns, flips = regular_polygon_symmetries(n)
        print(f"{names[n]:<22} {tried:>6}   {len(turns) + len(flips):>10}"
              f"   {len(turns):>5}   {len(flips):>5}")
    for name, corners in QUADRILATERALS.items():
        turns, flips = quadrilateral_symmetries(corners)
        print(f"{name:<22} {24:>6}   {len(turns) + len(flips):>10}"
              f"   {len(turns):>5}   {len(flips):>5}")
    print()
    print("turns = order of rotational symmetry (the 'no move' counts);")
    print("flips = number of lines of symmetry.")
    print("A regular polygon with n sides: n turns and n lines of symmetry.")
    print("A rectangle has only 2 lines of symmetry: its diagonals are not.")
    print()
    print(textwrap.fill(
        "Epistemic status: exhaustive and exact for these eleven shapes - "
        "every way of moving the corners was tried. It is evidence for the "
        "rule about regular polygons, not a proof for every n; the lesson "
        "explains why a regular n-gon always has 2n symmetries.",
        width=78,
    ))

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

For these shapes the search is complete, so the counts are certain. The pattern for regular polygons — nn turns and nn flips — is checked here only up to 7 sides; the proof above explains why it holds for every nn.

Exercises

Your turn

Squared paper, a mirror and tracing paper will help. You can ask for a hint whenever you like.

1. Symmetry: slides, turns and flips

Warm-upHuman

How many lines of symmetry does a square have?

2. Symmetry: slides, turns and flips

Warm-upHuman

A rectangle is 6 cm long and 3 cm wide. How many lines of symmetry does it have?

3. Symmetry: slides, turns and flips

CoreHuman

Which shape has rotational symmetry (order 2 or more) but no line of symmetry?

Choose one

4. Symmetry: slides, turns and flips

CoreHuman

Which of these shapes have exactly 2 lines of symmetry? Choose from: square, rectangle, rhombus, kite, parallelogram, equilateral triangle. (Here the rectangle and the rhombus are not squares.) Write your answer like {kite, square}.

Write elements separated by commas. Order and repeats don’t matter — just like in a set!

5. Symmetry: slides, turns and flips

CoreHuman

A shape is given a quarter turn clockwise about the point P. Which single move puts it back where it started?

Choose one

6. Symmetry: slides, turns and flips

CoreHuman

A flag is flipped in a vertical mirror line, and then flipped in a second vertical mirror line 3 squares to the right of the first. The result is a slide. How many squares does the flag slide?

7. Symmetry: slides, turns and flips

CoreHuman

Amir says: "A flip in a vertical mirror line and a half turn always do the same thing." Which example shows that he is wrong?

Choose one

8. Symmetry: slides, turns and flips

StretchHuman

Two mirror lines cross at an angle of 60°. A shape is flipped in the first mirror and then in the second. The result is a turn about the crossing point. Through how many degrees is it turned?

9. Symmetry: slides, turns and flips

StretchFormal

Lean proved flips_in_parallel_lines: flipAt d (flipAt c p) = slide (2 * (d - c)) 0 p for every point p. Here flipAt c flips in the vertical line x = c, and slide a b slides a squares right and b squares up. What single move is "flip in the line x = 1, then flip in the line x = 4"?

Choose one

10. Symmetry: slides, turns and flips

StretchComputational

Points on squared paper are pairs (x, y). Complete flip(p) (flip in the vertical line through (0, 0), so left and right swap) and quarter_turn(p) (a quarter turn anticlockwise about (0, 0), which sends (1, 0) to (0, 1) and (0, 1) to (-1, 0)). The tests check that two flips and four quarter turns undo themselves.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Things that trip people up

Misconception

"The diagonals of a rectangle are lines of symmetry." Only when the rectangle is a square. Fold a sheet of A4 paper along a diagonal: the two halves do not match. A rectangle has just 2 lines of symmetry, through the middles of opposite sides.

Misconception

"A flip and a half turn always do the same thing." They are different moves. A flipped letter F faces the other way; a half-turned F is upside down. For a very symmetric shape such as H, the two pictures happen to agree, but the points still go to different places.

Misconception

"A parallelogram has two lines of symmetry, like a rectangle." A parallelogram that is not a rectangle or a rhombus has no line of symmetry at all — but it does have rotational symmetry of order 2.

Misconception

"A shape with no rotational symmetry has order 0." Every shape fits onto itself after a full turn, so the smallest order is 1.

ViewpointsH

Other ways of seeing

Algebra— Symmetries form a group

The symmetries of a shape can be combined (do one, then another) and undone, and "doing nothing" is always a symmetry. A collection of moves with these properties is called a group. The square has a group of 8 symmetries: 4 turns and 4 flips. Combining two of them always gives one of the 8 — two flips give a turn, a turn and a flip give a flip — and the order of combining can matter. Groups are one of the central ideas of modern mathematics: see groups.

Geometry— Geometry is what moves cannot change

Slides, turns and flips keep every length and every angle, so they never change the facts geometry cares about. In 1872 the mathematician Felix Klein suggested a new way to think about geometry: choose a family of moves, and study whatever those moves cannot change. You will meet this idea in rigid motions, congruence and similarity and, much later, in transformation geometry and the Erlangen programme.

Category-theoretic connectionH

One move after another

Doing one move after another, and undoing a move, are the same ideas you meet in one thing after another: actions that can be chained, where chaining is associative and "do nothing" changes nothing. Mathematicians who study such chains in general — functions, moves, processes — use the language of category theory. Young learners need only the moves.

Wonder Trails

Wonder Trails

History & global context

History and global context

  • Symmetric patterns appear in the art of almost every culture: woven cloth in the Andes, Adinkra stamps and kente weaving in Ghana, kolam and rangoli in India, lattice windows in China, and the tiled walls of the Alhambra in Granada, built under the Nasrid dynasty in the 13th and 14th centuries.
  • In the 19th century mathematicians began to study symmetry itself. In 1872 the German mathematician Felix Klein described geometry as the study of what stays the same under a group of moves.
  • In 1891 the Russian crystallographer Evgraf Fedorov proved that repeating wallpaper patterns can have exactly 17 different kinds of symmetry. The same result was found again in 1924 by George Pólya and Paul Niggli, and the Dutch artist M. C. Escher studied Pólya's paper while making his famous tessellations.
Further reading

For grown-ups: further reading

  • Hermann Weyl, Symmetry (1952) — a beautiful classic on symmetry in art, nature and mathematics.
  • Ian Stewart, Why Beauty Is Truth: A History of Symmetry (2007).
  • John H. Conway, Heidi Burgiel and Chaim Goodman-Strauss, The Symmetries of Things (2008) — symmetric patterns, explained with pictures.
  • Paulus Gerdes, Geometry from Africa: Mathematical and Educational Explorations (1999) — symmetry in African designs and classroom activities.