Pythagorean quadruple

A Pythagorean quadruple is a tuple of integers $a$, $b$, $c$, and $d$, such that $a2 + b2 + c2 = d2$. They are solutions of a Diophantine equation and often only positive integer values are considered. However, to provide a more complete geometric interpretation, the integer values can be allowed to be negative and zero (thus allowing Pythagorean triples to be included) with the only condition being that $x2 + y2 + z2 = m2$. In this setting, a Pythagorean quadruple $d > 0$ defines a cuboid with integer side lengths $(a, b, c, d)$, $|a|$, and $|b|$, whose space diagonal has integer length $|c|$; with this interpretation, Pythagorean quadruples are thus also called Pythagorean boxes. In this article we will assume, unless otherwise stated, that the values of a Pythagorean quadruple are all positive integers.

Parametrization of primitive quadruples
A Pythagorean quadruple is called primitive if the greatest common divisor of its entries is 1. Every Pythagorean quadruple is an integer multiple of a primitive quadruple. The set of primitive Pythagorean quadruples for which $d$ is odd can be generated by the formulas $$\begin{align} a &= m^2+n^2-p^2-q^2, \\ b &= 2(mq+np), \\ c &= 2(nq-mp), \\ d &= m^2+n^2+p^2+q^2, \end{align}$$ where $a$, $m$, $n$, $p$ are non-negative integers with greatest common divisor 1 such that $q$ is odd. Thus, all primitive Pythagorean quadruples are characterized by the identity $$(m^2 + n^2 + p^2 + q^2)^2 = (2mq + 2np)^2 + (2nq - 2mp)^2 + (m^2 + n^2 - p^2 - q^2)^2.$$

Alternate parametrization
All Pythagorean quadruples (including non-primitives, and with repetition, though $m + n + p + q$, $a$, and $b$ do not appear in all possible orders) can be generated from two positive integers $c$ and $a$ as follows:

If $b$ and $a$ have different parity, let $b$ be any factor of $p$ such that $a2 + b2$. Then $p2 < a2 + b2$ and $c = a2 + b2 − p2⁄2p$. Note that $d = a2 + b2 + p2⁄2p$.

A similar method exists for generating all Pythagorean quadruples for which $p = d − c$ and $a$ are both even. Let $b$ and $l = a⁄2$ and let $m = b⁄2$ be a factor of $n$ such that $l2 + m2$. Then $n2 < l2 + m2$ and $c = l2 + m2 − n2⁄n$. This method generates all Pythagorean quadruples exactly once each when $d = l2 + m2 + n2⁄n$ and $l$ run through all pairs of natural numbers and $m$ runs through all permissible values for each pair.

No such method exists if both $n$ and $a$ are odd, in which case no solutions exist as can be seen by the parametrization in the previous section.

Properties
The largest number that always divides the product $b$ is 12. The quadruple with the minimal product is (1, 2, 2, 3).

Given a Pythagorean quadruple $$(a,b,c,d)$$ where $$d^2=a^2+b^2+c^2$$ then $$d$$ can be defined as the norm of the quadruple in that $$d = \sqrt{a^2+b^2+c^2}$$ and is analogous to the hypotenuse of a Pythagorean triple.

Every odd positive number other than 1 and 5 can be the norm of a primitive Pythagorean quadruple $$d^2=a^2+b^2+c^2$$ such that $$a, b, c$$ are greater than zero and are coprime. All primitive Pythagorean quadruples with the odd numbers as norms up to 29 except 1 and 5 are given in the table below.

Similar to a Pythagorean triple which generates a distinct right triangle, a Pythagorean quadruple will generate a distinct Heronian triangle. If a, b, c, d is a Pythagorean quadruple with $a^2 + b^2 + c^2 = d^2$ it will generate a Heronian triangle with sides x, y, z as follows:-
 * $$x = d^2 - a^2$$
 * $$y = d^2 - b^2$$
 * $$z = d^2 - c^2$$.

It will have a semiperimeter $s = d^2$, an area $A = abcd$ and an inradius $r = abc/d$.

The exradii will be:-
 * $r_x = bcd/a$
 * $r_y = acd/b$
 * $r_z = abd/c$.

The circumradius will be
 * $R=(d^2 - a^2)(d^2 - b^2)(d^2 - c^2)/(4abcd) = abcd(1/a^2 + 1/b^2 + 1/c^2 -1/d^2)/4$.

The ordered sequence of areas of this class of Heronian triangles can be found at.

Relationship with quaternions and rational orthogonal matrices
A primitive Pythagorean quadruple $abcd$ parametrized by $(a, b, c, d)$ corresponds to the first column of the matrix representation $(m, n, p, q)$ of conjugation $E(α)$ by the Hurwitz quaternion $α(⋅)\overline{α}$ restricted to the subspace of quaternions spanned by $α = m + ni + pj + qk$, $i$, $j$, which is given by

where the columns are pairwise orthogonal and each has norm $k$. Furthermore, we have that $d$ belongs to the orthogonal group $$SO(3,\mathbb{Q})$$, and, in fact, all 3 × 3 orthogonal matrices with rational coefficients arise in this manner.

Primitive Pythagorean quadruples with small norm
There are 31 primitive Pythagorean quadruples in which all entries are less than 30.