## 2017-10-09

### Pythagorean triplets

PS: The equations are rendered using MathJax library. Please allow JS if you can't read equations properly.

While lying semi-awake in the morning, reading the first part of Bill Habbard's "Message Contains No Recognisable Symbols", the thoughts drifted to how in a right-angled triangle we have:
$$a^2 + b^2 = c^2$$

That led me to:
\begin{align} a^2 &= c^2 - b^2 \\ &= (c + b) \cdot (c - b) \end{align}
Now, we have triplets like $(3, 4, 5)$; $(5, 12, 13)$ etc. where 2 of the values are consecutive. What if we fix $c - b = 1$; that is, the hypotenuse and one of the bases. We get to:
\begin{align} a^2 &= (c + b) \cdot 1 \\ &= ((b + 1) + b) \\ &= 2 \cdot b + 1 \end{align}
So, if I get any odd perfect square, I can always get its corresponding values to form a co-prime Pythagorean triplet (or a primitive triplet). To test it out, here is a list of first 10 such triplets:
$$(3, 4, 5) \\ (5, 12, 13) \\ (7, 24, 25) \\ (9, 40, 41) \\ (11, 60, 61) \\ (13, 84, 85) \\ (15, 112, 113) \\ (17, 144, 145) \\ (19, 180, 181) \\ (21, 220, 221)$$
Another interesting thing about these triplets is, the other two sides are the medians for our odd-square values. For eg. first odd-square is $9$. The other two sides will be around $\dfrac{9}{2} = 4.50$, which gives the other 2 sides: $4$ and $5$.

From another such triplet $(x, y, z)$, you can arrive at the immediate next one as follows: $$\left(x + 2, y + 2 \cdot (x + 1), z + 2 \cdot (x + 1) \right)$$