The Pythagoras tree is a fractal made of squares. Start with one square, stand a right triangle on its top side, build a square on each of the triangle's two shorter sides, and repeat on every new square forever. Each step is the familiar picture of the Pythagorean theorem. The Dutch mathematics teacher Albert E. Bosman invented it in 1942.
A fractal is a shape that contains smaller copies of itself: zoom in on any branch of the tree and you find a whole tree. Because every branch is built with the theorem a2 + b2 = c2, the tree also has a surprising property that you can prove in one line.
How the Pythagoras tree is built
Look at the classic diagram of the Pythagorean theorem, with a square on each side of a right triangle, and turn it upside down. The square on the hypotenuse becomes a trunk, and the squares on the two legs become branches.
- Draw a square. This is the trunk, level 0.
- Add a right triangle on top. Its hypotenuse is the top side of the square, and its right angle points up.
- Build a square on each leg of the triangle, facing outward. These two squares are level 1.
- Repeat steps 2 and 3 on the top side of every new square, using the same shape of triangle each time.
In the classic, symmetric tree the triangle is a 45-45-90 triangle. Its legs are 1/√2 ≈ 0.707 times its hypotenuse, so each new square has a side about 70.7% of its parent's. After two levels the squares are exactly half the trunk's width, and they stand upright again, parallel to the trunk.
Watch the Pythagoras tree grow
Each level doubles the number of squares. The animation below grows the symmetric tree level by level, from the trunk up to level 8, which alone has 256 squares.
| Level | Squares | Side of each | Area of each | Total area |
|---|---|---|---|---|
| 0 | 1 | 1 | 1 | 1 |
| 1 | 2 | ≈ 0.7071 | 1/2 | 1 |
| 2 | 4 | 0.5 | 1/4 | 1 |
| 3 | 8 | ≈ 0.3536 | 1/8 | 1 |
| 4 | 16 | 0.25 | 1/16 | 1 |
| 8 | 256 | 0.0625 | 1/256 | 1 |
| n | 2n | (1/√2)n | 1/2n | 1 |
The table assumes a trunk of side 1; sides are rounded to four decimal places. Levels 0 through n contain 2n + 1 − 1 squares, so the nine levels in the animation hold 29 − 1 = 511. The squares shrink quickly but never vanish, and the tree keeps branching forever.
Two things happen as the tree grows. First, branches start to collide. At level 4, two squares on either side of the center line meet edge to edge, and from level 5 on, new squares overlap squares that are already there. Second, the tree stays in a fixed region: a computer calculation of the corners shows that with a trunk of side 1, the complete infinite tree fits inside a rectangle 6 units wide and 4 units tall, trunk included.
Why every level has the same area
The last column of the table is always 1. That is no accident of the 45° angle; it is the Pythagorean theorem at work, and it holds for every Pythagoras tree. Take any square in the tree, with side c. The right triangle on top of it has hypotenuse c and legs a and b, and the two child squares have areas a2 and b2. By the theorem,
a2 + b2 = c2So every square passes on exactly its own area to its two children. Apply this to every square in level n at once: level n + 1 has the same total area as level n. By induction, every level has the same total area as the trunk.
For the symmetric tree you can see it directly: level n has 2n squares of area 1/2n each. For a general tree with angle θ at the left end of the triangle, the children have sides ccosθ and csinθ, and c2cos2θ + c2sin2θ = c2 because cos2θ + sin2θ = 1, which is the Pythagorean identity.
A puzzleIf every level has area 1, then levels 0 to n together have area n + 1, which grows without limit. Yet the whole tree fits in a 6-by-4 rectangle of area 24. The resolution is the overlapping: from level 5 on, squares sit on top of one another, so adding up their areas counts some regions many times.
The same idea, keeping the areas but changing the shapes, is what the page on the Pythagorean theorem for other shapes explores: semicircles or equilateral triangles on the sides of a right triangle obey the same rule.
Lopsided trees: other angles
Nothing forces the triangle to be isosceles. Any right triangle works, and different angles give trees with very different personalities. With angle θ at the left end, the left child has side cosθ times its parent's and the right child sinθ times. The bigger child is always on the same side, so the tree leans and curls toward it.
- 3-4-5 angles (θ ≈ 36.87°): the children have sides 4 over 5 and 3 over 5 of their parent and areas 16 over 25 and 9 over 25, which add up to 1, the 3-4-5 triangle in fractal form.
- 30-60-90 angles (θ = 30°): the children have sides √3 over 2 ≈ 0.866 and 1 over 2 of their parent and areas 3 over 4 and 1 over 4. See the 30-60-90 triangle.
- Smaller angles make the big child almost as large as its parent and the small child tiny, so the tree becomes one long curling spiral with small side shoots, a little like the spiral of Theodorus.
Whatever the angle, the area rule still holds: every level of every Pythagoras tree has the same total area as the trunk.
How to draw or code a Pythagoras tree
By hand, a ruler, a set square and a compass are enough for the first four or five levels of the symmetric tree; after that the squares get too small. With a computer you can go much deeper. The whole tree is one short recursive function: a function that draws a square and then calls itself twice, once for each child. Here it is in pseudo-code, using coordinates in which y points up:
function tree(P, Q, levels):
# P, Q = bottom-left and bottom-right corners of a square
if levels == 0: return
v = Q - P # the bottom side, as a vector
n = (-v.y, v.x) # v turned 90° counterclockwise
S = P + n # top-left corner
R = Q + n # top-right corner
draw polygon P, Q, R, S
T = S + cos(θ) * (cos(θ) * v + sin(θ) * n) # apex of the triangle
tree(S, T, levels - 1) # square on the left leg
tree(T, R, levels - 1) # square on the right leg
θ = 45°
tree((0, 0), (1, 0), 9) # trunk plus 8 levels: 511 squares
The apex T is the right-angle corner of the triangle: it lies at distance cosθ times the side length from S, at angle θ above the top side. On a screen, where y usually points down, either flip the drawing or use n = (vy, −vx) instead. Every tree on this page was drawn with this function, with θ = 45°, 36.87° or 30°.
Try thisChange one line at a time: alternate the angle between levels, color each level differently, or stop drawing a branch when its square gets smaller than a pixel. Coding the tree is a good first project in recursion, and the computing and games page shows other ways programmers use the theorem.
Frequently asked questions
Who invented the Pythagoras tree?
Albert E. Bosman, a Dutch mathematics teacher, in 1942. It is named after Pythagoras because each branch repeats the standard diagram of the Pythagorean theorem: squares on the three sides of a right triangle.
What is the area of each level of a Pythagoras tree?
Exactly the area of the trunk, at every level. Each square's two children have areas a2 and b2, which add up to the parent's area c2 by the Pythagorean theorem, so no level ever gains or loses area.
How many squares are in a Pythagoras tree?
Level n has 2n squares, and the trunk plus n levels have 2n + 1 − 1 altogether. The mathematical fractal has infinitely many levels, so infinitely many squares.
How big is the Pythagoras tree?
For the symmetric tree with a trunk of side 1, the complete infinite tree fits in a rectangle 6 units wide and 4 units tall. It never grows beyond that, even though it has infinitely many branches.
Does the Pythagoras tree have to be symmetric?
No. Any right triangle can be used. Unequal angles make one child bigger than the other, and the tree leans and curls toward the bigger side. Every version keeps the property that each level has the same total area.
Sources and further reading
- Heinz-Otto Peitgen, Hartmut Jürgens and Dietmar Saupe, Chaos and Fractals: New Frontiers of Science (Springer, 1992), on Pythagorean trees and other self-similar figures.
- "Pythagoras tree (fractal)", Wikipedia.
Keep exploring
- LearnWhat Is the Pythagorean Theorem?What the Pythagorean theorem is: a plain-English definition, the formal statement a² + b² = c², what it means with squares, and why it needs a right angle.
- LearnThe 45-45-90 TriangleThe 45-45-90 triangle rules: why the sides are in the ratio 1 : 1 : √2, how to find a leg from the hypotenuse, the diagonal of a square, and worked examples.
- LearnThe Spiral of TheodorusThe spiral of Theodorus chains right triangles with a leg of 1 to build √2, √3, √4 … √17. How to draw it, why it stops at √17, its history and a class activity.
- LearnThe Pythagorean Theorem with Semicircles and Other ShapesEuclid VI.31 extends the Pythagorean theorem from squares to semicircles, equilateral triangles and any similar shapes. See why it works, with examples.
- TriplesThe 3-4-5 TriangleThe 3-4-5 triangle explained: its angles (36.87° and 53.13°), area, perimeter and inradius, the 3-4-5 rule for square corners, multiples and history.
- Real-life usesThe Pythagorean Theorem in Architecture and ArtHow the Pythagorean theorem shapes architecture and art: ad quadratum √2 design, A4 paper, roof rafters, screen ratios, a tiling that proves it and Islamic patterns.