That is quite a title to unpack. It has been a while sense I’ve done something mathematical, and this week I found something really, really cool. So, I felt like sharing.

First, a little background. Long ago, Pythagoras came up with a cool theorem that says that if you sum the squared sides of a right triangle, that is the same as the squared length of the hypotenuse. That is, .

Three values that satisfy this equation are called Pythagorean triplets. Many of us are familiar with the triplet (3,4,5). It can generate many others by multiplying all of the sides by any number. For example, we can create (6,8,10) and (9,12,15) using the multipliers 2 and 3, respectively.

While (3,4,5) is a *primitive* Pythagorean triplet, (6,8,10) and (9,12,15) are not, as they were generated by another.

### The Magic Matrices

Last week, I stumbled upon these three amazing matrices that generate primitive Pythagorean triplets. I’ve never seen such a thing before in all my years of studying math, so I was compelled to share. Here are the matrices.

Now, check out what happens when we multiply [3,4,5] by any of these matrices. I will write them down and explain how they are obtained.

, , and

What? You get other primitive triplets?!? Cool. (Notice that , and .)

To understand how to multiply matrices, you must be able to pat your head and rub your stomach at the same time. As we move across the row [3,4,5] we must go down each of the columns of U. So, when finding the first entry of we calculate . The second entry goes down the 2nd column of U, which is . The third entry is . The math is analogous for the other matrices.

### The Really, Really, Cool Part

This creates an infinite tree of primitive Pythagorean triplets. Note how the [3,4,5] triplet generated 3. Well, each of those three generate 3 in the same way, and so on, forever.

Maybe more interesting: This infinite tree is exhaustive of primitive Pythagorean triplets. That means *any* primitive Pythagorean triplet is a member of this tree.

Of course, I’ve been playing like crazy on R and generating all kinds to see what I can learn. Here was one fun fact I found in my play time. Each of these triplets represents a right triangle, and the sum of the triplet represents a perimeter. The smallest pair of primitive triangles with the same perimeter I found were (364, 627, 725) and (195, 748, 773).

### How I Found This Result

When I need a challenge, I often look to Project Euler for a really difficult problem. Problem 75 is about Singular Integer Right Triangles. This requires a lot of knowledge about Pythagorean triplets.

The article I found that gave all the results that I’ve shared was on Wolfram MathWorld.