A Pythagorean quadruple is a tuple of integers a, b, c and d, such that d > 0 and $a^2 + b^2 + c^2 = d^2$, and is often denoted $(a,b,c,d)$. Geometrically, a Pythagorean quadruple $(a,b,c,d)$ defines a cuboid with integer side lengths |a|, |b|, and |c|, whose space diagonal has integer length d. Pythagorean quadruples are thus also called Pythagorean Boxes.[1]

The set of all primitive Pythagorean quadruples, i.e., those for which gcd(a,b,c) = 1 where gcd denotes the greatest common divisor, and for which without loss of generality a is odd, is parametrized by,[2][3][4]

$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,\,$

where m, n, p, q are non-negative integers and gcd(m, n, p, q) = 1 and m + n + p + q ≡ 1 (mod 2). Thus, all primitive Pythagorean quadruples are characterized by the Lebesgue 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 a, b and c do not appear in all possible orders) can be generated from two positive integers a and b as follows:

If $a$ and $b$ have different parity, let p be any factor of $a^2 + b^2$ such that $p^2 < a^2 + b^2$. Then $c = (a^2 + b^2 - p^2)/(2p)$ and $d = (a^2 + b^2 + p^2)/(2p)$. Note that $p = {d - c}$.

A similar method exists[5] for generating all Pythagorean quadruples for which $a, b$ are both even. Let l = a / 2 and m = b / 2 and let n be a factor of $l^2+m^2$ such that $n^2 Then $c=\frac{l^2+m^2-n^2}{n}$ and $d=\frac{l^2+m^2+n^2}{n}.$ This method generates all Pythagorean quadruples exactly once each when l and m run through all pairs of natural numbers and n runs through all permissible values for each pair.

No such method exists if both a and b 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 abcd is 12.[6] The quadruple with the minimal product is (1, 2, 2, 3).

## Relationship with quaternions and rational orthogonal matrices

A primitive Pythagorean quadruple $(a,b,c,d)$ parametrized by $(m,n,p,q)$ corresponds to the first column of the matrix representation $E(\alpha)$ of conjugation $\alpha(\cdot)\overline{\alpha}$ by the Hurwitz quaternion $\alpha = m + ni + pj + qk$ restricted to the subspace of $\mathbb{H}$ spanned by $i, j, k$, which is given by

$E(\alpha) = \begin{pmatrix} m^2+n^2-p^2-q^2&2np-2mq &2mp+2nq \\ 2mq+2np &m^2-n^2+p^2-q^2&2pq-2mn \\ 2nq-2mp &2mn+2pq &m^2-n^2-p^2+q^2\\ \end{pmatrix},$

where the columns are pairwise orthogonal and each has norm d. Furthermore, we have $\frac{1}{d}E(\alpha)$ $\in \text{SO}(3, \mathbb{Q})$, and, in fact, all 3 × 3 orthogonal matrices with rational coefficients arise in this manner.[7]

## Pythagorean quadruples with small norm

(1,2,2,3), (2,3,6,7), (1,4,8,9), (4,4,7,9), (2,6,9,11), (6,6,7,11), (3,4,12,13), (2,5,14,15), (2, 10, 11, 15), (1,12,12,17), (8,9,12,17), (1,6,18,19), (6,6,17,19), (6,10,15,19), (4,5,20,21), (4,8,19,21), (4,13,16,21), (8,11,16,21), (3,6,22,23), (3,14,18,23), (6,13,18,23), (9, 12, 20, 25), (12, 15, 16, 25), (2,7,26,27), (2,10,25,27), (2,14,23,27), (7,14,22,27), (10,10,23,27), (3,16,24,29), (11,12,24,29), (12,16,21,29)

4. ^ R. Spira, The diophantine equation $x^2 + y^2 + z^2 = m^2$, Amer. Math. Monthly Vol. 69 (1962), No. 5, 360–365.