Ideas in the Night

Tag Archives: Pythagorean Theorem

Many, many years ago I came up with an idea about a fractal that would be based on right triangles and squares. People that had less mathematical experience than I, didn’t take me seriously, when I told about my idea. They thought that this was just some kind of nonsense.

I didn’t visualize my idea and forgot the whole thing… Later, after many years when I started to read e-books about fractals, I found sophisticated ideas how to make nice colored Pythagorean fractal trees. I think I’ve been dealing with wrong people in the past… 🙂

This article discusses only about simplest possible Pythagorean fractal tree, most symmetrical version of it.

We start with a right triangle with two 45 degrees angles and one 90 degrees angle and visually speaking turn the triangle so that hypotenuse is at the bottom:

right triangle


Next we draw squares against the sides of the triangle so that the length of the side of the square is the length of the side of the triangle:

squares and triangle
Next we imagine new right triangles to the farthest side of the ”branch” squares and do the same process as earlier: We draw squares to all the sides of the triangles.

This process is continued infinitely and we have a fractal! …that looks like a tree.pytree

The length of the new hypotenuse c‘ = cos(45°) * c, where c is the length of the hypotenuse of previous iteration loop’s right triangle(s).

When generating the tree, I recommend using Java with JavaFX package or using JavaScript, because with those one can use the following methods:

  • beginPath
  • translate
  • rotate
  • save
  • restore

These methods make it quite easy to generate a fractal tree. When drawing the tree into screen, only the squares are drawn.

The e-book below discusses lots of fractal programming and has also an example codes in JavaScript generating these kinds of trees (also colored):


Let’s have some fun with the Pythagorean theorem, we’ll deduce the general equation of circle in R2 with the Pythagorean theorem.

The Pythagorean theorem states that right triangle’s sum of squares of the other sides equal to the square of the hypotenuse: a2 + b2 = c2.

The definition of the (analytical) circle: The set of the points that’s distance from a given point P is constant r.

In the picture below is drawn to plane to arbitrary a position a circle, that’s center is P = (x0, y0). Inside the circle is drawn a right triangle that’s other side’s end point is (x, y‘) and the other’s endpoint is (x‘, y).



Now the horizontal side’s length is |xx0| and vertical sides’s length is |yy0| and hypotenuse again is r, when according to Pythagorean theorem

(|xx0|)2 + (|y – y0|)2 = r2
<=> (xx0)2 + (y – y0)2 = r2

Because square is positive, the absolute values can be removed and what’s remaining is the familiar general equation of circle.

The simplest case is the circle where the center is at origin.

Then the length of sides of the right triangle are

|x – 0| = |x| and |y – 0| = |y|

and the hypotenuse is again r, when according to Pythagorean theorem

x2 + y2 = r2

I don’t know how ”official” way to deduce the equation of circle this is, but at least this gives the result… 🙂

There is story behind all this that began in the beginning of the year 1999…