Pythagorean Quadruples

Four whole numbers with a2 + b2 + c2 = d2: boxes whose edges and space diagonal are all whole numbers. Here is a complete list of the small ones, three ways to make more, and the famous unsolved problem they lead to.

By the PythagoreanTheorem.net teamUpdated 10 min read

A Pythagorean quadruple is a set of four positive whole numbers a, b, c, d with a2 + b2 + c2 = d2. Geometrically, it is a box with whole-number edges a, b and c whose space diagonal d is also a whole number. The smallest is (1, 2, 2, 3), because 1 + 4 + 4 = 9.

Quadruples are the three-dimensional cousins of Pythagorean triples such as 3-4-5. Like triples, they come in endless supply, and like triples they can be listed, generated by formulas and studied for patterns. Unlike triples, they lead straight to a question nobody has been able to answer.

From triples to quadruples

The equation a2 + b2 + c2 = d2 is the Pythagorean theorem in three dimensions. It comes from using the ordinary theorem twice. Across the floor of a box with length b and width a, the floor diagonal has length √a2 + b2. That diagonal and the vertical edge c are the legs of a second right triangle, standing upright inside the box, whose hypotenuse is the space diagonal d:

d2 = (√a2 + b2)2 + c2 = a2 + b2 + c2
√5 b = 2 a = 1 c = 2 d = 3
The box with edges 1, 2 and 2: its floor diagonal is √5, not a whole number, yet its space diagonal is exactly 3.

Notice that the floor diagonal of the 1-2-2 box is √5. A quadruple does not need any of its faces to have whole-number diagonals; only the edges and the long diagonal through the middle must be whole. When a face diagonal does happen to be whole, you get a neat shortcut, shown in the next sections. To compute the diagonal of any box, use the 3D diagonal calculator.

List of Pythagorean quadruples

A quadruple is primitive when a, b, c and d have no common factor bigger than 1. Every other quadruple is a primitive one scaled up: (2, 4, 4, 6) is (1, 2, 2, 3) doubled. The table lists every primitive quadruple with d ≤ 41, found by a computer search of all boxes in that range and sorted with a ≤ b ≤ c.

dPrimitive quadruples (a, b, c, d)
3(1, 2, 2, 3)
7(2, 3, 6, 7)
9(1, 4, 8, 9), (4, 4, 7, 9)
11(2, 6, 9, 11), (6, 6, 7, 11)
13(3, 4, 12, 13)
15(2, 5, 14, 15), (2, 10, 11, 15)
17(1, 12, 12, 17), (8, 9, 12, 17)
19(1, 6, 18, 19), (6, 6, 17, 19), (6, 10, 15, 19)
21(4, 5, 20, 21), (4, 8, 19, 21), (4, 13, 16, 21), (8, 11, 16, 21)
23(3, 6, 22, 23), (3, 14, 18, 23), (6, 13, 18, 23)
25(9, 12, 20, 25), (12, 15, 16, 25)
27(2, 7, 26, 27), (2, 10, 25, 27), (2, 14, 23, 27), (7, 14, 22, 27), (10, 10, 23, 27)
29(3, 16, 24, 29), (11, 12, 24, 29), (12, 16, 21, 29)
31(5, 6, 30, 31), (6, 14, 27, 31), (6, 21, 22, 31), (14, 18, 21, 31)
33(1, 8, 32, 33), (4, 7, 32, 33), (4, 17, 28, 33), (7, 16, 28, 33), (8, 8, 31, 33), (8, 20, 25, 33), (17, 20, 20, 33)
35(1, 18, 30, 35), (6, 10, 33, 35), (6, 17, 30, 35), (15, 18, 26, 35)
37(3, 8, 36, 37), (3, 24, 28, 37), (8, 24, 27, 37), (12, 21, 28, 37)
39(2, 19, 34, 39), (2, 26, 29, 39), (10, 14, 35, 39), (13, 14, 34, 39), (14, 22, 29, 39), (19, 22, 26, 39)
41(4, 12, 39, 41), (4, 24, 33, 41), (9, 24, 32, 41), (12, 24, 31, 41), (23, 24, 24, 41)

There are 61 of them. The first few are worth memorizing in the same way as 3-4-5: (1, 2, 2, 3), (2, 3, 6, 7), (1, 4, 8, 9) and (4, 4, 7, 9). Notice that 9 is the first diagonal with two different primitive boxes, and that many values of d, such as 5, never appear at all.

Patterns in the list

The diagonal is always odd

Every d in the table is odd, and in every row exactly one of a, b, c is odd. This is not a coincidence. Divide any square by 4: an even number squared leaves remainder 0, and an odd number squared leaves remainder 1 (for example 49 = 4 × 12 + 1). So a2 + b2 + c2 leaves remainder 0, 1, 2 or 3, depending on how many of a, b, c are odd. A square can only leave 0 or 1, so either none of them is odd, in which case d is even too and the quadruple can be halved, or exactly one is odd and d is odd. Primitive quadruples always fall in the second case.

The product is a multiple of 12

For every quadruple, abcd is a multiple of 12, and 12 is the best you can say, because 1 × 2 × 2 × 3 = 12. The factor 4 comes from the parity argument above: two of the four numbers are even. For the factor 3, note that a square leaves remainder 0 or 1 when divided by 3. If none of a, b, c is a multiple of 3, their squares each leave remainder 1, so d2 leaves remainder 1 + 1 + 1 = 3, which is the same as remainder 0, and then d must be a multiple of 3. Either way, one of the four numbers is divisible by 3.

Which diagonals are possible?

A computer check of every d up to 3,000 finds a quadruple for all of them except 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, … : exactly the powers of 2 and the numbers 5 times a power of 2. A classical theorem of number theory confirms that this is the complete list of exceptions, so, for instance, no box with whole-number edges has a space diagonal of exactly 10.

How to generate Pythagorean quadruples

Method 1: start from any two edges

Rewrite the equation as d2 − c2 = a2 + b2 and factor the left side: (d − c)(d + c) = a2 + b2. So pick any two edges a and b, and split a2 + b2 into two factors.

  1. Choose a and b and compute N = a2 + b2. Example: a = b = 4, so N = 32.
  2. Pick a divisor p of N with p2 < N, such that p and N/p are both even or both odd. Here p = 2 works, with N/p = 16.
  3. Compute the other two numbers: c = (N/p − p)/2 and d = (N/p + p)/2. Here c = (16 − 2)/2 = 7 and d = (16 + 2)/2 = 9.
  4. Check: 42 + 42 + 72 = 16 + 16 + 49 = 81 = 92.

With p = 4 the same edges give c = 2, d = 6, which is the doubled (1, 2, 2, 3). Every quadruple can be found this way, because p = d − c always divides a2 + b2.

Method 2: a one-line family

For every whole number n, the four numbers n, n + 1, n(n + 1) and n2 + n + 1 form a quadruple:

n2 + (n + 1)2 + n2(n + 1)2 = n4 + 2n3 + 3n2 + 2n + 1 = (n2 + n + 1)2

Expanding both sides confirms the identity. The first members are (1, 2, 2, 3), (2, 3, 6, 7), (3, 4, 12, 13), (4, 5, 20, 21) and (5, 6, 30, 31).

Method 3: chain two triples

If the hypotenuse of one Pythagorean triple is a leg of another, the two triples glue together into a quadruple. The 3-4-5 triangle ends in 5, and the 5-12-13 triangle starts with 5, so

32 + 42 + 122 = 52 + 122 = 132
5 13 4312 3² + 4² = 5²end face: 9 + 16 = 25 5² + 12² = 13²25 + 144 = 169 so 3² + 4² + 12² = 13²
The 3-by-4 end face has diagonal 5; that diagonal and the 12-unit edge form a 5-12-13 right triangle, whose hypotenuse is the space diagonal.

Other chains: 5-12-13 with 13-84-85 gives (5, 12, 84, 85), and 8-15-17 with 17-144-145 gives (8, 15, 144, 145). These are exactly the quadruples in which one face of the box has a whole-number diagonal.

The complete formula

Just as Euclid's formula produces every primitive triple from two numbers, there is a formula that produces every primitive quadruple from four whole numbers m, n, p, q:

a = m2 + n2 − p2 − q2,  b = 2(mq + np),  c = 2(nq − mp),  d = m2 + n2 + p2 + q2

Ignore any minus signs in the results and put the numbers in order. For example m = n = p = 1, q = 0 gives (1, 2, −2, 3), which is (1, 2, 2, 3); and m = 2, n = p = q = 1 gives (3, 6, −2, 7), which is (2, 3, 6, 7). Every primitive quadruple arises from some choice of m, n, p, q with no common factor and an odd sum (we checked this by computer for every primitive quadruple with d ≤ 101), although the formula sometimes also produces non-primitive ones. Notice that d is always a sum of four squares.

Euler bricks: when the faces are whole too

Quadruples ask for whole-number edges and a whole-number space diagonal. A different question asks for whole-number edges and whole-number diagonals on all three faces. A box like that is called an Euler brick, after Leonhard Euler, who studied them in the 18th century. The smallest, found by Paul Halcke in 1719, has edges 44, 117 and 240:

442 + 1172 = 1252,   442 + 2402 = 2442,   1172 + 2402 = 2672
267 244 125 ≈ 270.6 24011744
The smallest Euler brick. All three face diagonals are whole numbers, but the space diagonal is √73,225 ≈ 270.6.

A computer search of all boxes with edges below 1,000 finds five primitive Euler bricks: (44, 117, 240), (240, 252, 275), (140, 480, 693), (85, 132, 720) and (160, 231, 792). There are infinitely many. One 18th-century formula turns any Pythagorean triple (u, v, w) into an Euler brick with edges u |4v2 − w2|, v |4u2 − w2| and 4uvw. Feed it 3-4-5 and it returns 117, 44 and 240: the smallest brick again.

The perfect cuboid problem

Now combine the two ideas. A perfect cuboid would be an Euler brick whose space diagonal is also a whole number: a box in which all seven lengths (three edges, three face diagonals and the space diagonal) are whole. In the language of this page, it would be a Pythagorean quadruple (a, b, c, d) in which a2 + b2, a2 + c2 and b2 + c2 are all perfect squares as well.

An open problemNobody knows whether a perfect cuboid exists. Extensive computer searches have not found one, and nobody has proved that one is impossible. It is one of the oldest unsolved problems about whole numbers that a middle-school student can fully understand.

The near misses are tantalizing. The smallest Euler brick misses only on the space diagonal, ≈ 270.6. Going the other way, the box with edges 104, 153 and 672 has a whole-number space diagonal, 697, and two whole face diagonals, 185 and 680; only the third face diagonal, √1532 + 6722 ≈ 689.2, fails. Our search of every box with edges below 800 found no smaller box with that property. Each extra condition is easy on its own and the difficulty is meeting all seven at once, which is the same flavor of difficulty as in Fermat's Last Theorem: equations that look simple, with whole-number solutions that may or may not exist.

Quadruples also keep going: in four dimensions, a2 + b2 + c2 + d2 = e2 describes the diagonal of a four-dimensional box, and the same tricks work. The page on the Pythagorean theorem in higher dimensions explains why. For practice with three-dimensional diagonals, try the 3D worksheet.

Frequently asked questions

What is a Pythagorean quadruple?

Four positive whole numbers a, b, c, d with a2 + b2 + c2 = d2. They describe a rectangular box whose three edges and whose space diagonal, the line from one corner to the opposite corner through the inside, all have whole-number lengths.

What is the smallest Pythagorean quadruple?

(1, 2, 2, 3): 12 + 22 + 22 = 1 + 4 + 4 = 9 = 32. The next primitive ones are (2, 3, 6, 7), then (1, 4, 8, 9) and (4, 4, 7, 9), which share the diagonal 9.

How do you find Pythagorean quadruples?

Pick two edges a and b, choose a divisor p of a2 + b2 smaller than its square root (with p and (a2 + b2)/p both even or both odd), and set c = ((a2 + b2)/p − p)/2 and d = ((a2 + b2)/p + p)/2. Chaining two Pythagorean triples, such as 3-4-5 and 5-12-13, also works.

Is every whole number the diagonal of some quadruple?

No. The exceptions are the powers of 2 (1, 2, 4, 8, 16, …) and 5 times the powers of 2 (5, 10, 20, 40, …). Every other whole number is the space diagonal of at least one box with whole-number edges.

Does a perfect cuboid exist?

Nobody knows. A perfect cuboid would need whole-number edges, face diagonals and space diagonal. None has ever been found, despite large computer searches, and no one has proved it impossible, so the question is still open.

What is the difference between a Pythagorean quadruple and an Euler brick?

A quadruple needs the space diagonal to be whole; an Euler brick needs the three face diagonals to be whole. The smallest quadruple box, 1 by 2 by 2, has face diagonals √5, √5 and √8; the smallest Euler brick, 44 by 117 by 240, has a space diagonal of about 270.6.

Sources and further reading

  1. Richard K. Guy, Unsolved Problems in Number Theory, 3rd edition (Springer, 2004), the section on rational cuboids.
  2. Eric W. Weisstein, "Euler Brick" and "Perfect Cuboid", MathWorld.
  3. "Pythagorean quadruple", Wikipedia.

Keep exploring