* See too my Sierpinski Arrowhead Curve Evolution project: https://scratch.mit.edu/projects/198712752/

A Pythagoras Tree is a fractal (or repeated design).

If we started the design at any smaller branch/square and zoomed in, the whole pattern would be just the same (except for my colors).

The Pythagoras Tree starts with a square.

Then two smaller squares are balanced on "top" of the square.

Then two even smaller squares are balanced on top of each of these squares. etc. etc.

* Note that for each new pair of squares one square leans left (or anticlockwise) and one leans right (or clockwise). The "top side" for the next two squares is chosen differently depending on whether the parent square leans left or right.

The tree is called a Pythagoras Tree because of the right angle triangles between each three squares.

The triangles are also isosceles with two 45 degree angles.

If the length of a side of the bigger square is 1, then the lengths of the sides of the two smaller squares is 1 / sqrt(2).

To check Pythagoras, let us square the sides of the triangle:

Square of hypotenuse = 1 ^ 2 = 1 ("1 ^ 2" means 1 squared)

Squares of sides: (1 / sqrt(2)) ^ 2 + (1 / sqrt(2)) ^ 2 = 1/2 + 1/2 = 1

So the square of the hypotenuse equals the sum of the square of the other two sides.

If you want to understand the code, look at the following project first.

Here, the squares that make up the Pythagoras Tree are drawn completely rather than growing to full size, the squares are unfilled and a single colour: https://scratch.mit.edu/projects/198977079/

See also a different Pythagoras Tree project using recursion and stamping: https://scratch.mit.edu/projects/132939322/

https://en.wikipedia.org/wiki/Pythagoras_tree_(fractal)