The General Solution of Pythagorean Triples and Its Generalizations
In an earlier post, The Geometry of Numbers and the Numbers of Geometry: A Brief Exploration of Hypercomplex Numbers, we discussed quaternions. Quaternions arose from generalizing to higher dimensions a particular property of complex numbers: $|(a+bi)(c+di)|=|a+bi|\times|c+di|$. Why is this property so cherished? Readers may already be familiar with some examples where this property of complex numbers is exploited—some geometric, some physical—and it brings remarkable convenience to problems involving norms/moduli. This post introduces its application to finding the general integer solution of ternary quadratic homogeneous indeterminate equations. This example likewise reveals the wondrous nature of this property of complex numbers, and makes it hard not to sympathize with Hamilton, who spent ten years of effort trying to generalize it to higher dimensions.
The Pythagorean Triple Problem
Readers probably already know that Pythagorean triples, i.e., all the natural-number solutions of
$$x^2+y^2=z^2$$
are given by the formula
$$x=a^2-b^2,\quad y=2ab,\quad z=a^2+b^2$$more
Let's set aside the proof of sufficiency for now, and instead think about how to derive this general solution. In a similar vein, we can pose analogous questions, such as finding the natural-number solutions of equations like $x^2+2y^2=z^2$ and $x^2+xy+y^2=z^2$. These equations share a common feature: they are ternary, quadratic, homogeneous, indeterminate equations. There is a similar, general technique for deriving their solutions—one that uses the modulus property of complex numbers mentioned at the start of this post.
First consider the problem of the general solution for Pythagorean triples. We just need to notice that
$$(a^2+b^2)^2=|a+bi|^4=|(a^2-b^2)+2abi|^2=(a^2-b^2)^2+(2ab)^2$$
Marvelous, isn't it? The derivation flows effortlessly once we bring in complex numbers—this is the modulus property of complex numbers at work!
What if we want to consider the general solution of
$$x^2+n\cdot y^2=z^2,\quad n\in\mathbb{N}$$
There are two approaches. One is to directly transform the Pythagorean-triple solution above; readers are encouraged to try this themselves. Alternatively, we can directly exploit the property of complex numbers:
$$\begin{aligned}(a^2+n b^2)^2=&|a+b\sqrt{n}i|^4=|a^2-n b^2+2ab\sqrt{n}i|^2\\ =&(a^2-n b^2)^2+n\cdot (2ab)^2\end{aligned}$$
Perhaps the reader will go on to ask about the general solution of $m\cdot x^2+n\cdot y^2=z^2,\quad m,n\in\mathbb{N}$. Unfortunately, the above method no longer works. In fact, for general m, n, the corresponding indeterminate equation does not necessarily admit a general solution.
An Even More Elegant Example
Now let's consider the natural-number solutions of
$$z^2=x^2+xy+y^2$$
To derive the general solution, one could complete the square to reduce this to a problem of type $x^2+n\cdot y^2=z^2$, thereby converting it into a Pythagorean-triple problem. But this kind of "roundabout" approach is clearly not as direct or elegant as the technique below!
Complex numbers can be viewed as a two-dimensional vector space over the real numbers, with basis $1$ and $i$. But since it's a finite-dimensional vector space, there's no requirement that we take $1$ and $i$ as the basis. We can switch to a different basis, namely $1$ and $\omega$, where $\omega=\frac{1+\sqrt{3}i}{2}$, so that every complex number can also be uniquely written as
$$a+b\omega$$
If $a,b$ are both integers, such numbers are called Eisenstein integers. For the basis element $\omega$, which is one of the complex roots of the cubic equation $x^3+1=0$, we have the formula
$$\omega^2-\omega+1=0$$
We can compute
$$|a+b\omega|^2=a^2+ab+b^2$$
so that
$$\begin{aligned}(a+b\omega)^2=&a^2+b^2\omega^2+2ab\omega\\ =&a^2-b^2(-\omega+1)+2ab\omega\\ =&a^2-b^2+(2ab+b^2)\omega \end{aligned}$$
and hence
$$\begin{aligned}&(a^2+ab+b^2)^2=|a+b\omega|^4\\ =&|a^2-b^2+(2ab+b^2)\omega|^2\\ =&(a^2-b^2)^2+(a^2-b^2)(2ab+b^2)+(2ab+b^2)^2\end{aligned}$$
This gives us, quite elegantly, the general solution
$$x=a^2-b^2,\quad y=2ab+b^2,\quad z=a^2+ab+b^2$$
The same technique can be used to solve for the natural-number solutions of
$$z^2=x^2+(2\alpha)xy+(\alpha^2+\beta^2)y^2$$
one only needs to take $1$ and $\alpha+\beta i$ as the complex basis.
The Math Research and Development Forum
I learned this elegant technique four years ago from a discussion thread on the Math R&D Forum (数学研发论坛), and I remember being struck by how ingenious it was the moment I saw it. After understanding it back then, I had wanted to write it up and share it on the blog, but for various reasons I never got around to it, and eventually forgot all about it. Recently, a friend on the forum asked a similar question again, which reminded me to pick this up and share it with everyone.
The Math R&D Forum was probably the first math forum I ever encountered after getting online—around the same time I also came across other math forums like Xilu, but it seems this is the only one that has survived to this day. I first learned about the Math R&D Forum because of HugeCalc, a fast high-precision big-number computation tool developed by forum administrator Guo. Right when I registered on the forum, it happened to be migrating from the Xilu forum platform to 5d6d, and there weren't many users yet—I suppose I count as one of the earliest members. The forum was home to a group of highly skilled people, experts in mathematics, computer science, and various other fields—number theorists, analysts, programmers, and more. I learned a great deal there, especially about number theory. That thread, for instance, is where I learned about Eisenstein integers and concepts like integer rings. Later, when it became truly unsustainable to keep running on 5d6d, the forum broke off on its own, got its own server, and exported all the old resources. Indeed, the various mathematical discussion threads on the Math R&D Forum remain some of the most valuable Chinese-language mathematical resources on the internet.
Translated automatically with claude-sonnet-5; all equations are reproduced verbatim from the source. Copyright remains with the original author.