Patterns on a wall
Nomvula lives in Mpumalanga, in South Africa. Today she is helping her grandmother paint the outside wall of their home in the bold Ndebele style. Grandmother paints big black lines. Nomvula fills in the spaces with bright colours.
"Which colour goes in the triangles?" asks Nomvula. "And which in the squares?"
To answer, Nomvula has to see the shapes: the triangles, the squares, the long rectangles. Some triangles point up and some point down. Some squares stand on a corner, like a diamond. Are they still squares?
Look around you, too. A door is a rectangle. A plate is a circle. A box is a cube, a tin is a cylinder, and a ball is a sphere. Shapes are everywhere.
What makes a triangle a triangle?
Here are some shapes that are all triangles. They are different sizes. They point in different directions. One is long and thin.
And here are some shapes that are not triangles. Can you say why?
So what matters is how the shape is made: how many sides it has, whether they are straight, and whether they join up. What does not matter is its colour, its size, or which way it is facing.
Explore the shapes
Pick a shape and count its sides and corners. Then switch on Rotational symmetry and press Turn. Does the square stop being a square when it turns? Watch the gold dot: it shows you that the shape really moved.
Count the sides and corners
Pick a shape. Count the sides, then the corners. Then try turning it.
Equilateral triangleTriangle
- Sides
- 3
- Vertices (corners)
- 3
All three sides are equal and all three angles are 60°.
Sides with the same number of ticks are equal.
Did you notice that every closed shape with straight sides has the same number of corners as sides? Count them on the hexagon: 6 sides, 6 corners. A circle has no corners at all.
Big ideas
Definition— side and corner
A side is a straight edge of a flat shape. A corner is where two sides meet. Grown-up mathematicians call a corner a vertex (and more than one, vertices).
Definition— triangle
A triangle is a closed flat shape with three straight sides. It has three corners.
Definition— rectangle
A rectangle is a closed flat shape with four straight sides and four square corners, like the corner of a page.
Definition— square
A square is a rectangle whose four sides all have the same length.
Definition— circle
A circle is a round flat shape. Every point on its edge is the same distance from its centre. It has one curved edge and no corners.
Let's look together
Example— Is it still a square?
Here is a square sitting flat, and the same square turned so that it stands on one corner.
People sometimes call the turned one a "diamond". But it has four straight sides, all the same length, and four square corners. So it is a square — a square that has been turned.
Example— Square, rectangle, or both?
- A page of a book has four square corners. Its sides are not all the same length. It is a rectangle, but not a square.
- A square tile has four square corners, and all four sides are the same length. It is a square — and, because it has four square corners, it is a rectangle too.
Example— Counting sides and corners
| Shape | Sides | Corners |
|---|---|---|
| triangle | 3 | 3 |
| square | 4 | 4 |
| rectangle | 4 | 4 |
| hexagon (like a honeycomb cell) | 6 | 6 |
| circle | no straight sides | 0 |
Why turning does not change a shape
When you turn a shape, or slide it across the table, every side keeps its length and every corner keeps its size. A side that was 3 fingers long is still 3 fingers long. A square corner is still a square corner. Nothing was stretched, bent or cut.
The name of a shape only depends on its sides and corners. So if the sides and corners do not change, the name does not change either. A triangle pointing down is still a triangle. A square standing on a corner is still a square.
Solid shapes
Some shapes are flat, like a drawing on paper. Others are solid: you can hold them in your hand.
A solid shape has faces: the surfaces on its outside. A face can be flat or curved.
- A cube has 6 flat faces, all squares. It has 12 straight edges and 8 corners. It stacks, but it does not roll.
- A cylinder has 2 flat faces (circles) and one curved face. It rolls on its side and stacks on its flat faces.
- A cone has 1 flat face (a circle), one curved face and one point at the top. It rolls round in a circle.
- A sphere has one curved face and nothing flat at all. It rolls in every direction.
Count the corners, edges and faces
Drag a solid to turn it. Type how many corners (vertices), edges and faces it has, then press Check.
Drag to turn it. Dashed lines are edges at the back.
Cube
Count them yourself — turning the solid helps. Click in a box to highlight what you are counting.
| Solid | V | E | F | V − E + F |
|---|---|---|---|---|
| Cube | ? | ? | ? | ? |
| Square pyramid | ? | ? | ? | ? |
| Triangular prism | ? | ? | ? | ? |
| Tetrahedron | ? | ? | ? | ? |
Counted 0 of 4. Every solid without holes gives 2; holes change the answer.
For grown-ups · a surprise in the counting
After counting, the widget shows corners − edges + faces. For a cube that is 8 − 12 + 6 = 2, and every solid here without a hole gives 2 as well. This is Euler's formula, one of the founding results of topology. Its proof comes much later, in Surfaces, polyhedra and the Euler characteristic, but children can discover the pattern now.
Building and breaking shapes
Shapes can be put together to make new shapes, and cut into smaller shapes.
Example— Make a square from triangles
Fold a square piece of paper from one corner to the opposite corner and cut along the fold. You get two triangles, each with one square corner. Put them back together and you have the square again. Can you put the same two triangles together to make a bigger triangle?
Example— A puzzle from China
The tangram is a puzzle that came from China. A square is cut into seven pieces: five triangles, a square and a parallelogram (a slanted four-sided shape). The pieces can be put back together to make the square — or a cat, a boat, a running person, and hundreds of other pictures.
Gideon's yes-or-no game
Gideon reads a statement. You say true or false, and why.
- "A square turned onto its corner is still a square." — True. Its sides are still all the same length, and its corners are still square.
- "Every square is a rectangle." — True. A square has four square corners, which is all a rectangle needs.
- "Every rectangle is a square." — False! A long rectangle, 3 steps long and 1 step tall, is a rectangle that is not a square. One example is enough.
- "Three dots in a straight line make a triangle." — False. Joining them up gives a straight line, not a closed shape with three corners.
For grown-ups · the same game in Lean, a proof checker
To let a computer check statements like these, we draw shapes on a dot grid: each corner is a dot with whole-number coordinates. Lengths are compared using their squares (Pythagoras without square roots), and a corner is square when a number called the dot product is zero.
/-- The *squared* length of the side from `p` to `q`. By Pythagoras the length itself is the
square root of this, but comparing squared lengths is enough to tell whether two sides are
equal, and it keeps everything in whole numbers. -/
def dist2 (p q : Pt) : Int :=
(q.x - p.x) * (q.x - p.x) + (q.y - p.y) * (q.y - p.y)/-- The dot product of the arrows `p → q` and `p → r`. It is `0` exactly when the two arrows
meet at a square corner (a right angle) — provided neither arrow has length zero. -/
def dot (p q r : Pt) : Int :=
(q.x - p.x) * (r.x - p.x) + (q.y - p.y) * (r.y - p.y)/-- A **rectangle**: four sides of positive length and four square corners. (At corner `A`
the sides go to `B` and to `D`, and so on round the shape.) -/
def IsRectangle (q : Quad) : Prop :=
0 < dist2 q.A q.B ∧ 0 < dist2 q.B q.C ∧ 0 < dist2 q.C q.D ∧ 0 < dist2 q.D q.A ∧
dot q.A q.B q.D = 0 ∧ dot q.B q.C q.A = 0 ∧ dot q.C q.D q.B = 0 ∧ dot q.D q.A q.C = 0/-- A **square**: a rectangle whose four sides all have the same length — the definition
used in the lesson. -/
def IsSquare (q : Quad) : Prop :=
IsRectangle q ∧ dist2 q.A q.B = dist2 q.B q.C ∧ dist2 q.B q.C = dist2 q.C q.D ∧
dist2 q.C q.D = dist2 q.D q.ANow the four statements of the game. Lean checks the turned square ("diamond") and the counterexample by calculation (decide); "every square is a rectangle" follows straight from the definition, just as Chloe said.
/-- The same kind of shape standing on one corner (a "diamond"):
corners `(1,0), (2,1), (1,2), (0,1)`. -/
def diamond : Quad := ⟨⟨1, 0⟩, ⟨2, 1⟩, ⟨1, 2⟩, ⟨0, 1⟩⟩/-- **A square standing on its corner is still a square.** The "diamond" has four equal
sides (each of squared length 2) and four square corners. -/
theorem diamond_is_square : IsSquare diamond := by decide/-- **Every square is a rectangle.** With the lesson's definition (a square is a rectangle
whose sides are all equal) this is immediate: forget the "all sides equal" part. -/
theorem square_is_rectangle (q : Quad) (h : IsSquare q) : IsRectangle q := h.1/-- **Not every rectangle is a square:** the 3-by-1 rectangle is one example. Lean checks
all the corners and sides by calculation (`decide`). -/
theorem not_every_rectangle_is_square : ∃ q : Quad, IsRectangle q ∧ ¬ IsSquare q :=
⟨longRectangle, by decide, by decide⟩/-- A triangle does not need a flat bottom: the dots `(0,0), (3,1), (1,3)` make a triangle
with no side lying flat. -/
theorem tilted_triangle : IsTriangle ⟨0, 0⟩ ⟨3, 1⟩ ⟨1, 3⟩ := by decide/-- Three dots in a straight line do not make a triangle. -/
theorem line_not_triangle : ¬ IsTriangle ⟨0, 0⟩ ⟨1, 1⟩ ⟨2, 2⟩ := by decideFinally, the lesson's key result, proved for every four-sided shape on the grid: a quarter turn (or a slide) never changes whether it is a square. The proof follows the explanation above: a quarter turn keeps every length and every corner.
/-- A quarter turn (90°, anticlockwise) about the start dot: `(x, y) ↦ (−y, x)`. -/
def turn (p : Pt) : Pt := ⟨-p.y, p.x⟩/-- A quarter turn keeps every length. The side from `p` to `q` goes `(Δx, Δy)`; after the
turn it goes `(−Δy, Δx)`, and `(−Δy)² + Δx² = Δx² + Δy²` because `(−a)·(−a) = a·a`. -/
theorem dist2_turn (p q : Pt) : dist2 (turn p) (turn q) = dist2 p q := by
simp only [dist2, turn]
have h : -q.y - -p.y = -(q.y - p.y) := by omega
rw [h, Int.neg_mul_neg, Int.add_comm]/-- A quarter turn keeps every corner: the dot product of two arrows is unchanged, for the
same reason as in `dist2_turn`. So square corners stay square. -/
theorem dot_turn (p q r : Pt) : dot (turn p) (turn q) (turn r) = dot p q r := by
simp only [dot, turn]
have hq : -q.y - -p.y = -(q.y - p.y) := by omega
have hr : -r.y - -p.y = -(r.y - p.y) := by omega
rw [hq, hr, Int.neg_mul_neg, Int.add_comm]/-- **Turning a shape does not change what shape it is** (for quarter turns): a four-sided
shape is a square after a quarter turn exactly when it was a square before. The proof only
uses that lengths and corners are unchanged (`dist2_turn`, `dot_turn`). -/
theorem isSquare_turn_iff (q : Quad) : IsSquare (q.map turn) ↔ IsSquare q := by
simp only [IsSquare, IsRectangle, Quad.map, dist2_turn, dot_turn]/-- **Moving a shape does not change what shape it is** (for slides). -/
theorem isSquare_slide_iff (a b : Int) (q : Quad) :
IsSquare (q.map (slide a b)) ↔ IsSquare q := by
simp only [IsSquare, IsRectangle, Quad.map, dist2_slide, dot_slide]What is not formalised here: turns through other angles. A 45° turn moves most grid dots off the grid, so on the grid we can only check examples, like the diamond. The general fact — every rigid motion of the plane keeps all lengths and angles — is part of Euclidean geometry. In Mathlib a rigid motion is an isometry (a map that keeps all distances), and AffineIsometry.angle_map says that such maps keep angles too.
Margaret hunts for hidden squares
For grown-ups · Margaret's program, and why her pattern always holds
The program below tries every pair of dots as one side of a square and builds the rest of the square by a quarter turn — the same idea as the Lean file. It counts upright and tilted squares on grids of 2 × 2 up to 6 × 6 dots and compares the totals with the formula for an grid of dots.
"""How many squares hide on a dot grid, if tilted squares count too?
A square stays a square when it is turned, so a dot grid hides more squares
than the upright ones children usually find first. This program lists every
set of four dots that are the corners of a square, using whole numbers only:
from each pair of dots it builds the square on that side by a quarter turn,
exactly like the lesson's Lean file. It counts upright and tilted squares on
grids of 2 x 2 up to 6 x 6 dots, checks that a quarter turn of the grid sends
every square to a square, and compares the totals with the formula
n^2 (n^2 - 1) / 12 for an n x n grid of dots.
Runs unchanged in the browser (Pyodide) using only the standard library.
"""
import textwrap
def grid(n):
"""All dots (x, y) of an n x n grid, with 0 <= x, y < n."""
if n < 1:
raise ValueError("a grid needs at least one dot per side")
return [(x, y) for y in range(n) for x in range(n)]
def quarter_turn(v):
"""Turn the arrow v = (dx, dy) a quarter turn anticlockwise: (-dy, dx)."""
dx, dy = v
return (-dy, dx)
def squares_on_grid(n):
"""Return the set of squares on an n x n dot grid.
Each square is a frozenset of its four corners. From every ordered pair
of different dots p, q we turn the side p -> q a quarter turn to find the
other two corners; each square is found four times, and the set keeps it
once.
"""
dots = set(grid(n))
found = set()
for p in dots:
for q in dots:
if p == q:
continue
dx, dy = quarter_turn((q[0] - p[0], q[1] - p[1]))
r = (q[0] + dx, q[1] + dy)
s = (p[0] + dx, p[1] + dy)
if r in dots and s in dots:
found.add(frozenset((p, q, r, s)))
return found
def is_upright(square):
"""A square is upright when its sides run along the grid lines."""
xs = {x for x, _ in square}
return len(xs) == 2
def side_squared(square):
"""The squared side length of a square (the smallest squared distance)."""
pts = sorted(square)
return min(
(a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
for i, a in enumerate(pts)
for b in pts[i + 1:]
)
def turn_grid(square, n):
"""Turn a whole n x n grid a quarter turn about its centre."""
return frozenset((n - 1 - y, x) for x, y in square)
def turned_squares_are_squares(n):
"""Check that turning the grid sends every square on it to a square."""
found = squares_on_grid(n)
return all(turn_grid(sq, n) in found for sq in found)
def formula(n):
"""The number of squares on an n x n dot grid: n^2 (n^2 - 1) / 12."""
return n * n * (n * n - 1) // 12
def count_by_bounding_box(n):
"""Count squares as in the lesson's proof: a k x k box holds k squares.
An upright k x k box fits in (n - k)^2 places, and inside it there are
k squares with corners on its sides (side arrows (a, k - a), a < k).
"""
return sum(k * (n - k) ** 2 for k in range(1, n))
def main():
print("Squares with corners on the dots of an n x n dot grid:")
print(" dots upright tilted total n^2(n^2-1)/12")
for n in range(2, 7):
found = squares_on_grid(n)
up = sum(1 for sq in found if is_upright(sq))
print(f" {n} x {n} {up:7d} {len(found) - up:7d} {len(found):6d}"
f" {formula(n):9d}")
print()
found = squares_on_grid(4)
tilted = sorted((side_squared(sq), sorted(sq)) for sq in found
if not is_upright(sq))
print(f"The {len(tilted)} tilted squares on the 4 x 4 grid (corners):")
for _, corners in tilted:
print(" " + " ".join(f"({x},{y})" for x, y in corners))
print()
ok = all(turned_squares_are_squares(n) for n in range(2, 7))
print(f"A quarter turn of the grid sends every square to a square: {ok}")
same = all(count_by_bounding_box(n) == formula(n) for n in range(2, 51))
print(f"Box count sum k(n-k)^2 equals the formula for n = 2..50: {same}")
print()
print(textwrap.fill(
"Epistemic status: the counts are exact and come from checking every "
"pair of dots, so they are certain for grids of 2 x 2 to 6 x 6 dots. "
"Agreement with n^2(n^2-1)/12 for these sizes, and of the box count "
"up to n = 50, is evidence, not a proof for every grid; the lesson's "
"bounding-box argument is the proof.",
width=78,
))
if __name__ == "__main__":
main()The computer's counts are certain for the grids it checked, but no computer can check every grid. Here is why the formula is always right. Every square on the grid, tilted or not, fits snugly inside exactly one upright square box with sides of steps, touching all four sides of the box (an upright square is its own box). Inside such a box there are exactly snug squares: going steps along one side of the box to the first corner, for . On an grid of dots a box fits in places. So the number of squares is
where the last step is an exercise in the standard formulas for , and . For : .
Your turn
Take your time. You can ask for a hint whenever you like. Paper, scissors and a few boxes and tins from the kitchen will help!
1. Shapes
Warm-upHumanWhich of these are triangles? Choose all the triangles.
2. Shapes
Warm-upHumanHow many corners does a rectangle have?
3. Shapes
CoreHumanKofi turns a square tile so that it stands on one corner. His friend says, "Now it's a diamond, not a square." Is the tile still a square?
4. Shapes
CoreFormalGideon's game: is this statement true or false? "Every square is a rectangle."
5. Shapes
CoreFormalGideon's game again: "Every rectangle is a square." True or false?
6. Shapes
CoreHumanA dice is a cube. How many flat faces does a cube have?
7. Shapes
CoreHumanWhich solid shape can roll, and can also be stacked into a tower of the same shape?
9. Shapes
StretchHumanA hexagon like a honeycomb cell can be cut from its middle to each corner. How many triangles do you get?
Things that trip people up
Misconception
"A square on its corner is a diamond, not a square." Turning a shape does not change its sides or its corners. A square standing on a corner still has four equal sides and four square corners, so it is still a square. ("Diamond" is an everyday word, not a different shape.)
Misconception
"A triangle must sit on a flat bottom" or "a triangle must have equal sides." Any closed flat shape with three straight sides is a triangle — pointing up, down or sideways, fat or thin, with equal sides or not.
Misconception
"Only red ones are triangles" or "a big square is a different shape from a small square." Colour and size are not part of the definition. A tiny green square and a huge blue square are both squares.
Misconception
"A square is not a rectangle." A rectangle needs four straight sides and four square corners — and a square has them. A square is a special rectangle, the way a kitten is a special cat.
Sorting shapes into collections
Sorting shapes is a great way to see their properties. Try sorting a pile of shapes into two collections: "has four sides" and "does not have four sides". Then sort the same pile a different way: "has a square corner" and "does not".
Some shapes belong to both "has four sides" and "has a square corner" — rectangles and squares, for example. Drawing two overlapping loops shows this. These loops are called Venn diagrams, and you will meet them in Sets. They grow from the very first lesson on Collections.
For grown-ups · the square-inside-rectangle picture
"Every square is a rectangle" says that the collection of squares is a subset of the collection of rectangles: . "Not every rectangle is a square" says the subset is not the whole thing. Children who sort shapes are already reasoning about subsets.
Two ways of looking at shapes
Geometry— The geometer: lengths and corners
A geometer cares about lengths and angles. Two shapes are exactly the same (congruent) when one can be moved onto the other by sliding, turning or flipping, without stretching. They have the same shape (similar) when one is a zoomed-in copy of the other, like a small square and a big square. But a square and a long rectangle are never similar: zooming in cannot make all the sides of a long rectangle equal. This is the view of this lesson, and of Symmetry: slides, turns and flips.
Topology— The topologist: the rubber-sheet view
Imagine shapes drawn on a sheet of rubber that you may stretch and squash, but not tear or glue. A triangle can be stretched into a square, and a square into a circle — so a topologist says they are all the same! But a ring with a hole in the middle can never be stretched into a plate without tearing. Topology studies what stays the same under stretching: holes, pieces, and the surprising number you met with the solids.
Wonder Trails
Optional, and never graded: a question that leads somewhere further.
Wonder Trail · Optional · never gradedCorners, edges and facesCount the corners, edges and faces of a cube, then work out corners − edges + faces. Try a pyramid and a tetrahedron too. Why do you keep getting the same number — and can you find a shape that gives a different one?Follow the trailShapes around the world, long ago
- Egypt. The great pyramids at Giza, built about 4,500 years ago, have square bases and triangular sides. Their builders needed accurate square corners.
- India. The Śulba Sūtras, written more than 2,000 years ago, give instructions for building fire altars of exact shapes and sizes: squares, rectangles, and a square with the same area as a given rectangle.
- Greece. Around 300 BCE, Euclid's Elements gave careful definitions of a triangle, a square and a circle, and proved facts about them. It was copied and studied for more than 2,000 years, in Greek, Arabic, Latin and many other languages.
- The Islamic world. Artists in places such as Isfahan, Fez and Granada made beautiful tile patterns from stars, polygons and interlacing lines.
- China. The tangram puzzle became popular in China, and books of tangram puzzles were printed there in the early 1800s, before the puzzle spread around the world.
- Southern Africa. Ndebele house painting, like Nomvula's, uses bold triangles, rectangles and lines. The artist Esther Mahlangu has carried this tradition to galleries around the world.
For grown-ups: further reading
- Douglas H. Clements and Julie Sarama, Learning and Teaching Early Math: The Learning Trajectories Approach (2009; 2nd ed. 2014) — how young children's ideas of shape develop, from "it looks like a door" to properties.
- Pierre M. van Hiele, Structure and Insight: A Theory of Mathematics Education (1986) — the van Hiele levels of geometric thinking.
- Euclid, The Elements, translated by Thomas L. Heath (1908) — Book I begins with the definitions of point, line, circle, triangle and square.
- Edwin A. Abbott, Flatland: A Romance of Many Dimensions (1884) — a story told by a square, for older readers.