## Thursday, 7 September 2023

### Pythagoras and Matrices,

I first learned about Barning trees in 2008.   Over the years people much brighter than I am, chipped in to tell me more.  This is a consolidation of posts since then that I hope will be readable and informative.  I find the ideas here fascinating.  Hope you enjoy

You can click on most images to expand it and make them sharper.

It’s been a good weekend for Geometry for me. Several notes from folks telling me about geometry stuff I never knew… While I’m waiting on permission from the author of one, I wanted to tell you about the other.. The graph (tree) below shows a set of Primitive Pythagorean triples… All the ones with hypotenuse less than 100. Primitive Pythagorean triples are right triangles that have all sides as integers and none of them have a common factor. What was new (to me) was that any one of them (and all the others not shown here) can be found as transformations of (4,3,5) using only three transformations. Let me make that clearer. If you think of a primitive Pythagorean triple as a point in three-space, then any other primitive Pythagorean triple is a point in three space that is just a transformation of this one… but there are only three transformations needed to get ALL of them. The tree shows which ones are generated by which ones, but you need to crank out the calculator and do some of these to see how neat it really is.

This type of graph is called a Barning-Tree because it seems to have first been discovered by F. J. M. Barning, “On Pythagorean and quasi-Pythagorean triangles and a generation process with the help of unimodular matrices, (Dutch) Math. Centrum Amsterdam Afd. Zuivere Wisk, ZW-011 (1963) 37 pp..
I later learned that It was first discovered in 1963 by Barning , and was then independently discovered by A. Hall seven years later, and seems to keep being rediscovered by different approaches.
A number of rediscoveries have occurred more recently.If you take the three matrices below, and write any of the primitive triples as a column vector, then multiplying by any of the matrices will give you another unique triple.. they never duplicate one, and they don’t leave any out (OK, I’m taking that on faith as I haven’t proven it for myself yet). I think that is kind of wild, and am totally impressed with people who can notice stuff like that.
Here are the three transformations When I was young, I found it amazing when I realized that there were an infinite number of primitive Pythagorean triples that had one leg that was one less than the hypotenuse. The idea emerges from an even simpler algebraic fact.  Every odd number is equal to the difference in the difference of the squares of two integers that differ by one.  13 for instance is the 7^2 - 6^2.  But if the original odd number is a perfect square, then we have the makings of a Pythagorean triple with one leg one less than the hypotenuse.
This is one of those "tricks" that you may have seen in popular math books, take any odd integer to serve as one leg, then square it and divide as evenly as possible to get the other leg and hypotenuse. For one leg of 7, the square is 49, and 49 can be almost evenly divided into 24 and 25, so 7, 24, 25 is a primitive triple. On the Barning tree I noticed that each of these was created by starting with P=(4,3,5) and applying the first matrix operation, AP gives (12,5,13), A2P gives (24, 7,25) and so on.
Of course, you could find right triangles that have a leg two less than the  hypotenuse.  You can see them by looking on the Barning tree branch closest to the y-axis .  Look at the smallest leg, what do you notice?  Now square the short leg.  Now add the longer leg and the hypotenuse.  Can you see the pattern?
If we wanted to have a primitive Pythagorean triangle with a short leg of 16, we need to find half its square, 164/2 = 128, so this is the sum of the longer leg and hypotenuse.  We only need find one more and one less than 64, half of 128, and we are done.

In looking at the tree, I realized that each transformation matrix preserved one arithmetic difference in the three values. AP for any point P would preserve the difference between the first leg and hypotenuse. If we let P = (20,21,29) the difference is nine, and transformations by A preserve this so that AP = (80,39, 89) and A2P gives (176,57,185).

If we wish to preserve the difference between the second and third value of the point, we transform by matrix C. Keeping P = (20,21,29) the transformation CP gives (36,77,85), and C2P gives (52, 165, 173).
Matrix B then, preserves the difference between the legs. If we take (3,4,5) and repeatedly apply the transformation B, we get (21, 20, 29); (119, 120, 169); etc.

------------------------------------------------ A while after I wrote two short blogs on Primitive Pythagorean triples  I got a nice note from H. Lee Price with a link to a paper he had written on "The Pythagorean Tree: A New Species". A couple of things I learned from it were too good to keep to myself, so here are some of the things I thought were amazing.. or read the paper for yourself to find your own favorites.
One of the clever things that I learned was a way of creating an informative 2x2 matrix for any triple that holds some interesting information. I will use the 5,12,13 triangle as an example, but any of them produce the same sorts of information. Take one leg, and write it as a ratio to the sum of the hypotenuse and other leg, then simplify. Using 5 over 12+13 gives 5/25 or 1/5. Using the other leg we get 12/18 = 2/3. One of the first amazing things is that there will always be one, and only one even number in the two fractions created. Put the numerator and denominator of the fraction with the even number in the left column of a 2x2 matrix, and the other fraction makes the right column. For the 5, 12, 13 Pythagorean triple we get: Here are several examples from Mr Price's paper:

"SO WHAT?", you ask. Well, amazingly, you can use these to quickly find the radii of the in-circle, and all three ex-circles of the triangle. If you multiply across the two rows the two products formed will give you the radius of the in-circle and also the radius of the ex-circle on the hypotenuse of the triangle. Then if you multiply the two diagonals, you get the other two ex-circles radii.

In the case of the 5,12, 13 triangle, the in-circle is found by the product of the first row, 2 x 1 =2. The three ex-circles have radii of 3, 10, and 15 units respectively.from the products of the diagonals (1 x 3=3, and 2 x 5 = 10)  and the product of the bottom row elements, 3 x 5 = 15. I had never observed until it was pointed out to me, that the radius of the ex-circle on the hypotenuse is always the sum of the radii of the in-circle and the other two ex-circles...2 + 3 + 10 = 15....
Finally, these in-circle and ex-circle relations are tied back to the Barning tree. Remember the diagram that shows that each of the Pythagorean triples produces three offspring in the tree. Mr. Price points out that in each case, the new Triangle has an in-circle that is one of the three ex-circles of the parent triangle. The 3,4,5 triangle has ex-circle radii of 2, 3 and 6 units. The off spring triangles are the 5, 12, 13 triangle with in-center radius of 2, the 8, 15, 17 triangle with in-center radius of 3, and the 20,21,29 triangle with in-center radius of 6.

Somehow, all that geometry packed into a simple matrix seems incredible. By the way, the original two fractions we used to form the matrix, they are the tangents of 1/2 each acute angle. The arctan(1/3) is appx 11.31 degrees,  half of the arctan(5/12)=22.62degrees.

*Sidenote trivia  if we let x=2/3 and y = 1/5, then x + y + xy = 1, and this seems to work with all the paired half-tangents.

The focus of Mr. Price's paper was to point out that from these 2x2 matrices, you can easily build a different tree to produce all the Primitive Pythagorean triples as well. I will return to that when time permits, and I feel I understand it well enough to do it justice. Check his Paper for a neat use of the Fibonacci sequence to produce additional trees of the 2x2 matrix for each primitive triple