# Diophantine quartic equation in four variables

Using Brahmagupta's formula for the area of a cyclic quadrilateral (which generalizes Heron's formula for area of a triangle), we can get a Diophantine equation in positive integer unknowns $w,x,y,z$:

$$wxyz = (w+x+y+z)^2$$

I'll provide the derivation below as a Community Wiki.

Cases from rectangles give us (up to permutations of unknowns) two solutions:

$$w = x = y = z = 4$$

$$w = x = 3 ; y = z = 6$$

What are all the positive integer solutions of this equation?

• I'm not sure your condition on ordered quadruples, $w < x+y+z,$ implies my Hurwitz condition, $xyz \geq 2(w+x+y+z)$ which is incredibly restrictive, on purpose. You really need to check; there may be more solutions to your polygon inequalities than the "fundamental solutions" I already found. Hard to be sure either way. Commented Jan 11, 2014 at 1:43
• For positive solutions of the equation, $w \le x+y+z$ is equivalent to $xyz \ge 2(w+x+y+z)$. At any rate it's worth posting a new Question so we can cleanly bring out your fundamental cases in their geometric interpretation. Commented Jan 11, 2014 at 4:21

The equation,

$$wxyz=(w+x+y+z)^2\tag{1}$$

can be solved as a quadratic in $z$,

$$(w + x + y)^2 + \big(2(w + x + y) - w x y\big) z + z^2=0\tag{2}$$

Its discriminant is $wxy(wxy-4\big(w+x+y)\big)$ and must be made a square. It can be shown an initial solution $a,x,y$ can generate an infinite more. Define,

$$axy(axy-4\big(a+x+y)\big)=c^2\tag{3}$$

$$a^2xy(xy-4) =d\tag{4}$$

then a family of solutions to (2) can be given as,

$$w =\frac{a(p-cq)^2}{p^2-dq^2}\tag{5}$$

$$z =-(w+x+y)+\frac{1}{2}\left(wxy\pm\frac{(p-cq)(cp-dq)}{p^2-dq^2}\right)\tag{6}$$

for arbitrary $p,q$. If we want integers, then one can solve the Pell equation $p^2-dq^2=1$. Some examples are,

$$w,x,y = 4,\;4,\;4(p-q)^2;\;\;z=4(p+q)^2\;\text{or}\;\;4(3p-5q)^2,\;\;\text{where}\;p^2-3q^2=1\tag{7}$$

or,

$$w,x,y = 3,\;3,\;6(p-q)^2;\;\;z=6(p+q)^2\;\text{or}\;\;24(p-2q)^2,\;\;\text{where}\;p^2-5q^2=1\tag{8}$$

and so on.

Your problem meets the requirements that cause the Markov numbers to occur in a tree. Your equation is $$w^2 + x^2 + y^2 + z^2 = -2(wx+wy+wz+xy+xz+yz) + wxyz.$$ The critical thing is that each variable occurs only to the first power on the right hand side. That is, each term on the right hand side is squarefree as far as the variables are concerned. What happens next is probably known to most users of this site as Vieta Jumping.

Suppose i have a solution with all integer values. I would like to keep $x,y,z$ the same and "jump" $w.$ Well, $$w^2 + (2x+2y+2z - xyz ) w + (x+y+z)^2 = 0.$$ The sum of the two solutions to this equation in $w$ is $xyz - 2x-2y-2z.$ So we get a new value for $w,$ call it $$w' = xyz - 2x-2y-2z - w.$$ That is, given a solution $(w,x,y,z),$ we get a new solution with $$(xyz - 2x-2y-2z - w, x,y,z).$$ If we jump $w$ again, we get back to where we were. The other jumps are $$(w,wyz - 2w-2y-2z - x, y,z),$$ $$(w,x, wxz - 2w-2x-2z - y, z),$$ $$(w,x,y, wxy - 2w-2x-2y - z).$$

What this means is that any solution is connected to an infinite number of solutions. After that things become difficult. In the generalization by Hurwitz, the solutions (for any fixed dimension) are arranged into one or more trees. For dimension three, Markov, there is just the one tree. It requires proof to be sure that the entire set of solutions splits into a forest. For aspects of Markov-Hurwitz, see https://mathoverflow.net/questions/84927/conjecture-on-markov-hurwitz-diophantine-equation

This is kind of interesting. I will try to see what can be done in the way of "fundamental solutions" as in the methods of Hurwitz.

Here are some solutions with positive but small entries, required in descending order.. It is possible to have the gcd of the four variables to be one. Note that jumping the first position in $(4,4,4,4)$ is $(36,4,4,4).$ Jumping the first position in $(10,10,9,1)$ is $(40,10,9,1).$ Jumping the third position in $(10,10,9,1)$ is $(10,10,49,1),$ which can then be ordered into $(49,10,10,1)$ if desired.

Alright, did over allowing negative entries, but still descending in absolute value. It would appear that these, and solutions with one or more entries equal to zero, need to be considered together to get anything sensible. This can be done, though, and was done for the Apollonian Gasket problem. It turns out I forgot to put some absolute values in the program. Better below. I ruled out solutions with any entry $0,$ far too numerous.

2  2  -1  -1
4  4  4  4
6  3  -2  -1
6  6  3  3
8  5  5  2
9  -2  -2  1
10  10  9  1
12  4  -3  -1
12  6  4  2
15  10  3  2
16  4  -2  -2
16  12  -3  -1
18  5  5  2
18  9  8  1
20  5  -4  -1
21  14  6  1
24  6  3  3
25  9  -2  -2
30  5  -3  -2
30  6  -5  -1
30  24  5  1
32  -9  2  -1
32  -6  -3  1
36  4  4  4
36  16  -2  -2
40  10  9  1
40  15  3  2
42  7  -6  -1
45  8  5  2
45  20  -4  -1
48  6  -4  -2
49  -6  -3  2
49  10  10  1
49  25  -2  -2
54  6  -3  -3
54  12  4  2
54  30  5  1
56  8  -7  -1
56  21  6  1
64  36  -2  -2
70  7  -5  -2
72  9  -8  -1
75  -12  -4  1
75  6  6  3
80  45  -4  -1
81  18  8  1
81  49  -2  -2
84  7  -4  -3
90  10  -9  -1
96  8  -6  -2
96  30  -5  -1
98  18  9  1
100  12  6  2
100  64  -2  -2


Got it, simple observations. If there are no zero entries, there must be an even number of negative entries. Alright, if $(w,x,y,z)$ is a solution, so is $(-w,-x,-y,-z).$ If we have a solution with positive entries, a jump cannot result in zero, as the sum of the entries is still positive. A jump cannot result in a negative entry, as that would be an odd number (one) of negative entries. So, in fact, it is reasonable to consider positive entries.

A Hurwitz fundamental solution is then one for which jumping any entry increases that entry. As we may take the variables in decreasing order, this means that an (ordered) fundamental solution is one with $$w \geq x \geq y \geq z \geq 1, \; \; \; xyz \geq 2(w+x+y+z).$$

The first few are

w  x  y  z     xyz  2(w+x+y+z)
4  4  4  4      64     32
6  6  3  3      52     36
8  5  5  2      50     40
10  10  9  1    90     60
12  6  4  2     48     48   WOW
15  10  3  2    60     60   WOW
18  9  8  1     72     72   WOW
21  14  6  1    84     84   WOW
30  24  5  1   120    120   WOW


where I put WOW to indicate equality. But that just means jumping the largest value keeps it the same, jumping the other variables still changes things. So, the questions become: (A) do the orbits of these solutions under jumping stay distinct, in which case we have a genuine forest? (B) is the number of fundamental solutions finite? (B) is false for Apollonian problem...

EDIIITTTTT: question (B) turns out to be true, and the nine fundamental solutions displayed are all of them. See the answer at Inequality with four positive integers looking for upper bound by user leshik.

See if I can get this across: any positive integer solution can be reduced to a fundamental solution by jumping (the largest current entry) and re-ordering. Don't know yet: can it be reduced to more than one fundamental solution by different choices? This is question (A) above.

Oh, my first impression is that $\gcd(w,x,y,z)$ does not change by jumping, so that separates some trees at any rate. Your first two examples have gcd 4 and 3 respectively.

First three levels in one out of the nine trees:

                                    2499245, 3481, 30, 24
3481,30,24,5         515094, 3481, 30, 5
410670, 3481, 24, 5

434281, 605, 30, 24
30,24,5,1       605,30,24,1           16854, 605, 30, 1
13230, 605, 24, 1

7921, 54, 30, 5
54,30,5,1             1445, 54, 30, 1
120, 54, 5, 1


Derivation of Diophantine Equation

Suppose integers $a,b,c,d \gt 0$ are the side lengths of a cyclic quadrilateral whose area and perimeter are equal. Let $s = (a+b+c+d)/2$ be the semiperimeter, so that by Brahmagupta's formula for area of a cyclic quadrilateral:

$$2s = \sqrt{(s-a)(s-b)(s-c)(s-d)}$$

A priori it is not evident that $s$ is an integer, although clearly $2s=a+b+c+d$ is. Squaring both sides and multiplying by $2^4$ gives:

$$64s^2 = (2s-2a)(2s-2b)(2s-2c)(2s-2d)$$

The product on the right side must have an even factor, since the left hand side is even. If any two factors are added, e.g.

$$(2s-2a)+(2s-2b) = (-a+b+c+d)+(a-b+c+d) = 2(c+d)$$

the result is even, so that all four factors have the same parity. All four factors are (positive) even integers, and this implies $s$ is an integer.

Letting $w=s-a,x=s-b,y=s-c,z=s-d$, and noting $w+x+y+z=4s-2s=2s$, our first equation becomes $w+x+y+z = \sqrt{wxyz}$. Thus:

$$wxyz = (w+x+y+z)^2$$

where each unknown is a positive integer.

Which solutions are realized by requisite cyclic quadrilaterals?

Conversely, suppose this equation has a positive integer solution $w,x,y,z$. Will there be corresponding integer side lengths $a,b,c,d$ of a cyclic quadrilateral with area equal to perimeter?

First we observe that $w+x+y+z$ must be even. If that sum were odd, at least one of $w,x,y,z$ would be even, and their product would also be even. Then (from the equation) the sum $w+x+y+z$ would be even as well.

Setting $w+x+y+z = 2s$ for some integer $s \gt 0$, we can define integers:

$$a = s-w, b = s-x, c = s-y, d = s-z$$

and note that $a+b+c+d = 4s - (w+x+y+z) = 2s$. Moreover they satisfy the polygon inequality requirements:

$$a \lt b+c+d,\ b \lt a+c+d,\ c \lt a+b+d,\ d \lt a+b+c$$

because (for instance) $-a+b+c+d = 2s-2a = 2w \gt 0$ implies $a \lt b+c+d$.

If only we knew these were positive integers, then we could realize $a,b,c,d$ as side lengths of a cyclic quadrilateral having (from the equation) area = perimeter. In an appealling bit of symmetry:

Prop. $a,b,c,d$ are positive if and only if $w,x,y,z$ satisfy the polygon inequalities $w \lt x+y+z,\ x \lt w+y+z,\ y \lt w+x+z,\ z \lt w+x+y$.

However this is not always so. Several of the "fundamental" solutions listed by Will Jagy satisfy instead $w = x+y+z$, so that $a = s-w = (-w+x+y+z)/2 = 0$, and these might be interpreted as "degenerate quadrilaterals" (triangles).

Consideration of the infinite families exhibited by Tito Piezas III shows as Pell equation pairs $(p,q)$ tend to infinity, inevitably one of the quadruple entries will dominate the sum of the others.

For example: taking $(p,q)=(9,4)$ satisfying $p^2 - 5q^2 = 1$ in Tito's second listed family, we get this solution:

$$w = 6*(p+q)^2, x = 6*(p-q)^2, y = z = 3$$

where $w = 1014 \gt 156 = x+y+z$. As $(p,q)$ increase, so will the excess of $w$ over $x+y+z$.

Thanks to Will Jagy's formulation of the condition for Hurwitz fundamental solutions:

$$w \ge x \ge y \ge z,\; xyz \le 2(w+x+y+z)$$

there are only finitely many cyclic quadrilaterals with integer sides having area = perimeter. Up to permutation of the unknowns (equivalent to permuting the side lengths $a,b,c,d$ since $s$ is invariant), these fundamental solutions are exactly the ones that satisfy the polygon inequality.

The nine such solutions include five cases of "degenerate" quadrilaterals, where $w=x+y+z$ and thus $a = s-w = 0$, in the same sense that Heron's Rule for triangles is a limiting case of Brahmagupta's formula for area of cyclic quadrilateral:

    (w,x,y,z)=(30,24,5,1)   (a,b,c,d)=(0,6,25,29)  triangle area = 60
(w,x,y,z)=(21,14,6,1)   (a,b,c,d)=(0,7,15,20)  triangle area = 42
(w,x,y,z)=(18,9,8,1)    (a,b,c,d)=(0,9,10,17)  triangle area = 36
(w,x,y,z)=(15,10,3,2)   (a,b,c,d)=(0,5,12,13)  triangle area = 30
(w,x,y,z)=(12,6,4,2)    (a,b,c,d)=(0,6,8,10)   triangle area = 24


Note that the last two solutions are Pythagorean (right triangles).

That leaves four solutions that give "nondegenerate" cyclic quadrilaterals:

    (w,x,y,z)=(10,10,9,1)  (a,b,c,d)=(5,5,6,14)  cyc. quad. area = 30
(w,x,y,z)=(8,5,5,2)    (a,b,c,d)=(2,5,5,8)   cyc. quad. area = 20
(w,x,y,z)=(6,6,3,3)    (a,b,c,d)=(3,3,6,6)   cyc. quad. area = 18
(w,x,y,z)=(4,4,4,4)    (a,b,c,d)=(4,4,4,4)   cyc. quad. area = 16


Each of these has at least a pair of equal sides, so one way to permute the sides will give trapezoids or rectangles. However permuting the sides can also give cyclic quadrilaterals that are not trapezoidal or rectangular. With the exception of the final case (square), each solution gives us two noncongruent quadrilaterals that have the given side lengths.

Also note the "self-dual" property of the last three cases, in that (a,b,c,d) is a permutation of (w,x,y,z).

• Since it appears this is your real interest, when $w \geq x \geq y \geq z \geq 1,$ require also that $$w < x + y + z$$ along with $$(w + x + y + z)^2 = wxyz.$$ It is incredibly deflating to give a really full answer and then find there was a missing hypothesis. I suggest you ask a separate question. Beginning of one tree posted as separate answer. Commented Jan 10, 2014 at 19:09
• @WillJagy: I posed the question asking about solutions to the equation, and it really adds to my interest that it has these finite number of families of solutions, within which only finitely many are realized as quadrilaterals. I'm not fully clear about how the split between quadrilaterals/triangles/neither-of-those works out, but I'm pretty sure your work, and Tito's, suffice to tell "the whole story". Commented Jan 10, 2014 at 19:16

Using the answer by coffeemath at Diophantine quartic equation in four variables, part deux it is now easy to show that the nine seeming trees really are trees and are disjoint, which is the same behavior as in the Hurwitz-Markov problem. This is Hilfsatz 2, on page 190 in the 1907 article by Hurwitz. A genuine translation is a bit beyond me, but i think i will write a paraphrase in Latex and put that in the binder with the original article.

Anyway, for this problem: given a quadruple $(w,x,y,z),$ the sum $w+x+y+z$ decreases, or stays the same, while jumping $w$ if $xyz - 2 x - 2 y - 2 z - w \leq w,$ or $xyz \leq 2 (w+x+y+z).$ From the answer by coffemath, we know that this is equivalent to $w \geq x+y+z.$

Can there be a second entry for which jumping either decreases the entry or keeps it the same? Call it $x.$ The condition is $x \geq w+y+z.$

So, given both, and adding, we find $$w + x \geq x + y + z + w + y + z = w + x + 2 y + 2 z,$$ or $$0 \geq 2y + 2z.$$ This contradicts the positivity of the variables.

As a result, any solution descends to only one root, one fundamental solution. It is not possible to ascend from one root, jump up a few times, and descend to some other root. Similarly, within a single orbit, it is not possible to have a cycle; it is not possible to ascend from some point(quadruple), reach some point of maximum height, where the height is defined to be $H = w + x + y + z,$ and descend back down some other way.

The solutions to $$(w+x+y+z)^2 = wxyz$$ are arranged in nine disjoint (rooted) trees, making what is called a forest. Really.