# Is there an existing theory of Pythagorean triples for numbers of the form $p+q\sqrt r$ rather than integers?

Before Christmas I was teaching a class about surds. They were able to simplify, add, multiply etc.

To give them one application of this, I wanted to give them some triangles that they would have to identify as right-angled or not.

I wanted to avoid obvious multiples of usual integer Pythagorean triples, so I used a brute force search of surds of the form $p+q\sqrt2$ to find a few like this:

$T_1: a=1+\sqrt2$, $b=1+\sqrt2$, $c=2+\sqrt2$

$T_2: a=2+\sqrt2$, $b=2+\sqrt2$, $c=2+2\sqrt2$

$T_3: a=1+2\sqrt2$, $b=1+2\sqrt2$, $c=4+\sqrt2$

$T_4: a=2+2\sqrt2$, $b=2+2\sqrt2$, $c=4+2\sqrt2$

$T_5: a=4+\sqrt2$, $b=4+\sqrt2$, $c=2+4\sqrt2$

$T_6: a=1+2\sqrt2$, $b=4+2\sqrt2$, $c=5+2\sqrt2$

$T_7: a=4+\sqrt2$, $b=4+4\sqrt2$, $c=4+5\sqrt2$

$T_8: a=2+\sqrt2$, $b=4+4\sqrt2$, $c=6+3\sqrt2$

It turns out that $T_1, T_2, T_3, T_4, T_5$ are all multiples of each other - some more obvious than others.

$T_6$ and $T_7$ are also multiples of each other.

This raises a number of questions for me:

1) Has work on this kind of thing already been done? Is there a good reference work on this topic?

2) What do we call these kinds of numbers? They aren't integers, but they aren't "Gaussian integers" because those take the form $x+yi$, whereas I want the form to be $p+q\sqrt r$

3) Is there a standard way to identify the primitive triples?

4) Instead of a brute force approach I know I can use the usual Euclid's formula to generate them, too, but then what are a "good" set of values to start with - and will I achieve all primitives using that method?

5) I have also read of a set of transformations that will generate all primitive triples starting from $(3,4,5)$ - can I use that set of transformations starting from ...?

• A pythagorean tripple can be written on the form $( a =2uv, b = u^2 - v^2, c = u^2 + v^2)$. Taking $u=A+B\sqrt{r}$ and $v=C+D\sqrt{r}$ with $A,B,C,D$ integers gives a tripple with all $a,b,c$ on the form $p + q\sqrt{r}$. – Winther Dec 28 '16 at 7:58
• @Winther this ought to be an answer. Better than the link-only answer we have now – Brevan Ellefsen Dec 28 '16 at 13:32
• @BrevanEllefsen As I see it the question is more of a reference request and from the last sentence it seems OP already knows this or a similar way of generating such numbers so I think it's best to just leave it as a comment. – Winther Dec 28 '16 at 16:18
• @Winther Thanks, for this comment. I am aware of this process. To provide the set of all primitive triples, we must choose pairs of integers $(u,v)$ where $u$ is odd, $v$ is even and $u$ and $v$ are coprime. How would I choose $A, B, C, D$ efficiently to create the set of all primitive triples in my system? – tomi Dec 29 '16 at 2:32

## 3 Answers

Here are some partial answers:

The first paper says:

The primitive Pythagorean triples in $\mathbb Z[\sqrt{-1}]$ are parametrised by $(\frac{a^2+b^2}{2},\frac{a^2-b^2}{2i},ab)$, where $a,b \in \mathbb Z(\sqrt{-1})$ are relatively prime, with positive odd real parts.

• Can you summarize? These links are behind paywalls if you want to download them. – Oscar Lanzi Dec 28 '16 at 11:01
• @OscarLanzi, the first paper is freely available. I've fixed the link. – lhf Dec 28 '16 at 11:05
• @lhf Thanks for thge first article, but I'm wanting something different to the Gaussian integers. I can't access the second article. – tomi Dec 29 '16 at 2:26

One of the simplest cases is the algebraic integers having the form $a+b\sqrt{-2}$, with $a,b$ each ordinary integers. As many readers know this is a unique factorization domain. It's also a parity defined domain. We can define the even/odd parity of $a+b\sqrt{-2}$ as that of just $a$. The reader can verify that this definition fits with the expected relations:

(odd)+(odd) = (even)+(even) = (even)

(odd)+(even) = (even)+(odd) = (odd)

(odd)x(odd) = (odd)

(odd)x(even) = (even)x(odd) = (even)x(even) = (even)

The domain also contains one even prime, $\pm \sqrt{-2}$, which is a common factor of all even elements.

We can argue the same way as we do for ordinary integers. A primitive triple $(x, y, z)$ must contain two odd and one even elements, so we are sure that the hypotenuse $z$ and at least one leg $x$ have opposite parity. Since $(z+x)(z-x)=y^2$ is the product of two odd factors that must be relatively prime, we have

$z+x =m^2$

$z-x = n^2$

with $m, n$ odd and relatively prime. Then we have the formulation that applies to ordinary integers as well:

$x = (m^2-n^2)/2$

$y = mn$

$z = (m^2+n^2)/2$.

For example, we may take $m = 1, n = 1+\sqrt{-2}$ to get $(x, y, z)=(1-\sqrt{-2}, 1+\sqrt{-2}, \sqrt{-2})$.
Unlike ordinary integers, this domain allows an even primitive hypoteneuse, but this has no impact on the analysis.

Interestingly, we cannot apply this method to all quadratic UFDs because we cannot generally define parity. Try it for algebraic integers having the form $a+b \sqrt{-3}$.

• Interesting. What is "UFD"? – tomi Dec 30 '16 at 7:14
• Unique Factorization Domain. – i9Fn Dec 30 '16 at 9:21

If you take something like $X = x+y\sqrt n$ and $Y = a + b\sqrt n$, then $(X+iY)^2$ will give you a pythagorean triplet.