# Where is my error in trying to find Pythagorean triples with matching areas?

I'm trying to craft a formula for finding matching areas in Pythagorean triples the way I have done with matching sides and matching perimeters and matching area:perimeter ratios. For example:

$$f(10,3)=(91,60,109)$$ and $$f(14,1)=(195,28,197)$$ have the same area $$2730.$$

I thought I had solved the $$area$$ equation using the $$cubic$$ formula but, when I plug in $$m=10$$, I do not get $$3$$ and, when I plug in $$m=14$$, I do not get $$1$$ in a spreadsheet or in Wolfram Alpha. Here is my attempt at solving the area equation for $$n$$ in terms of $$D$$ (the area), and $$m$$.

$$A=m^2-n^2\quad B=2mn\implies D(area)=\frac{AB}{2}=\frac {2m^3 n-2mn^3}{2}=m^3 n-mn^3$$

$$\text{In standard form }\\ mn^3+0n^2-m^3n+D=0\qquad a=m\quad b=0\quad c=-m^3\quad d=D$$

\begin{align*} n&=\sqrt[3]{\biggl(\frac{-b^3}{27a^3 }+\frac{bc}{6a^2}-\frac{d}{2a}\biggr)+\sqrt{\biggl(\frac{-b^3}{27a^3}+\frac{bc}{6a^2}-\frac{d}{2a}\biggr)^2+\biggl(\frac{c}{3a}-\frac{b^2}{9a^2}\biggr)^3}}\\ &+\sqrt[3]{\biggl(\frac{-b^3}{27a^3 }+\frac{bc}{6a^2}-\frac{d}{2a}\biggr)-\sqrt{\biggl(\frac{-b^3}{27a^3}+\frac{bc}{6a^2}-\frac{d}{2a}\biggr)^2+\biggl(\frac{c}{3a}-\frac{b^2}{9a^2}\biggr)^3}}\\ &-\frac{b}{3a} \end{align*}

$$=\sqrt[3]{\biggl(-\frac{d}{2a}\biggr)+\sqrt{\biggl(-\frac{d}{2a}\biggr)^2+\biggl(\frac{c}{3a}\biggr)^3}}\\+\sqrt[3]{\biggl(-\frac{d}{2a}\biggr)-\sqrt{\biggl(-\frac{d}{2a}\biggr)^2+\biggl(\frac{c}{3a}\biggr)^3}}$$

$$=\sqrt[3]{\biggl(-\frac{D}{2m}\biggr)+\sqrt{\biggl(-\frac{D}{2m}\biggr)^2+\biggl(\frac{-m^3}{3m}\biggr)^3}}\\ +\sqrt[3]{\biggl(-\frac{D}{2m}\biggr)-\sqrt{\biggl(-\frac{D}{2m}\biggr)^2+\biggl(\frac{-m^3}{3m}\biggr)^3}}$$

Oddly, inputs $$2730,3\rightarrow -10$$ and $$2730,1\rightarrow -14$$ as though I had solve for $$m$$ instead of $$n$$... and changing the sign of $$D$$ changed the sign of the result. I tried individual components in a spreadsheet and found negatives under the square roots.

Finally, I tried the simplest triple $$f(2,1)=(3,4,5)$$ and, as expected, when $$D=\frac{3*4}{2}=6, m=1\rightarrow n=-2.$$ I tried my hand at De Moivre's Theorem because of the real and imaginary components under the cube roots but I got lost.

Did I make a mistake in in my identification of $$a,b,c,d$$ or in my algebra? Or, can someone show me how to use De Moivre's Theorem to yield $$n=1$$ when $$D=6$$ and $$m=2$$?

Oddly, when I solved this for a more complex formula that I came up with to generate $$sets$$ that are, themselves, a subset of triples where $$GCD(A,B,C)$$ is an odd square (a subset that includes all primitives and reduces clutter), I got it to work except for the smallest triangles of sets $$7$$ and above where there were square roots of negatives. My generator uses $$(n,k)$$ as though they were $$(2m-1+n,n)$$. This formula generates a non-trivial triple for every $$n,k\in\mathbb{N}$$. For the above exercise: $$f(1,1)=(3,4,5)\quad f(4,3)=(91,60,109)\quad f(7,1)=(195,28,197)$$.

$$A=(2n-1)^2+2(2n-1)k\\ B=2(2n-1)k+2k^2\\ C=(2n-1)^2+2(2n-1)k+2k^2$$ and the formula that usually works ($$6,1\rightarrow 1\quad 2730,4\rightarrow 3\quad 2730,7\rightarrow$$#NUM) is:

$$k=\sqrt[3]{(\frac{D}{8(2n-1)}+\sqrt{\frac{D^2}{64(2n-1)^2 }-\frac{(2n-1)^6}{1728}}}\\ +\sqrt[3]{(\frac{D}{8(2n-1)}-\sqrt{\frac{D^2}{64(2n-1)^2 }-\frac{(2n-1)^6}{1728}}}-\frac{(2n-1)}{2}$$

I suppose, what I'm looking for is 1) my error, 2)how to use de Moivre's $$n^{th}$$ root theorem to deal with imaginaries in this context, or 3) how to find the limits of the search (as I have done with my other formulae) when I input $$n$$ instead of $$m$$.

• The cubic formula usually requires complex numbers at intermediate stages. This is always true if there are multiple real roots. Jul 9 '19 at 18:39
• @eyeballfrog If intermediate imaginaries are the problem, do you think de Moivre's theorem might help? Jul 14 '19 at 23:16
• This is not directly related to your problem, but I just want to say that your question is related to a stronger version of congruent number problem (which is open). See en.wikipedia.org/wiki/Congruent_number. In particular, after some scaling what you want is to find elliptic curves of the form $y^2 = x^3 - n^2x$ of positive rank. Jul 20 '19 at 20:04
• Note that the $m^2-n^2, 2mn$ formulas don't give you every Pythagorean triple, e.g., you can't get the triple $(9,12,15)$ from those formulas. Jul 25 '19 at 0:11
• @poetasis: "A puzzling cubic equation" unnecessarily drains the title of important context. Perhaps "Pythagorean triples with matching areas: How to deal with the resulting cubic formula?"
– Blue
Jul 25 '19 at 0:20

I notice that the equation is of the following form (I replaced $$n$$ by $$x$$):

$$x^3 - m^2 x + \frac{D}{m} = 0$$

Please see the following reference for the trigonometric solution. This is applicable to your case since the coefficient of $$x$$ is negative. This means your equation has three real roots.

Trigonometric solution for three real roots

In summary:

Let

$$p = -m^2$$

$$q = \frac{D}{m}$$

$$a = \frac{-p}{3}$$

$$b = \frac{q}{2}$$

$$C(p, q) = 2 \sqrt{a} \cos\left(\frac{1}{3} \arccos \left(\frac{-b}{a} \sqrt{\frac{1}{a}}\right)\right)$$

Then the three roots are given by

$$t_0 = C(p, q)$$

$$t_1 = C(p, -q) - C(p, q)$$

$$t_2 = -C(p, -q)$$

I checked that the method works for both of your examples.

Let me include the output of a program I wrote:

For (6, 2)

p:-4.0

q:3.0

$$t_0$$: 1.3027756377319946

$$t_1$$: 1.0000000000000002

$$t_2$$: -2.302775637731995

For (2730, 10)

p:-100.0

q:273.0

$$t_0$$: 8.156603957913985

$$t_1$$: 2.9999999999999982

$$t_2$$: -11.156603957913983

For (2730, 14)

p:-196.0

q:195.0

$$t_0$$: 13.47318861248212

$$t_1$$: 1.0

$$t_2$$: -14.47318861248212

• I carefully tried your equation for $C(p,q)$ and for $D=6, m=2$, I get $1.302775638\quad (2730,10)\rightarrow 8.156603958\quad (2730,14)\rightarrow 13.47318861$. None of these results are even nearly correct. Jul 25 '19 at 17:02
• I have included the output of my program in the answer. Please check. Note that in each case, there are three roots, not one.
– PTDS
Jul 25 '19 at 20:49
• I will try again using $t_1$ instead of $t_0$. It seems harder than it should be but thanks for the extra work in showing it to me. Jul 26 '19 at 1:04
• Everything works. I've found $1,2,\text{ and }3$ triples with the same area up to values of $1722654$. It's curious but, must be true, no more than $3$ Pythagorean triples can have the same area since the cubic equation can have no more than $3$ roots. Thank you again. Aug 1 '19 at 17:46
• I cannot thank you enough for the solution you provided for my cubic equation. Now I am attempting a quintic here, here, and a couple of other places I can't remember. There seems to be little help. Could you email me poetasis@gmail.com and answer a few more questions about your cubic solution to give me insights into the quintic? Jan 24 '20 at 19:30

Pythagorean triples can in fact be generated by the formula $$f(m,n) = (m^2-n^2,2mn,m^2+n^2)$$. Note that is essential that $$m > n > 0$$. The area is $$D = D_{m,n} = \dfrac{(m^2-n^2)2mn}{2} = m^3n - mn^3$$.

What you do is to express $$n$$ in terms of $$m$$ and $$D$$ as a (real) solution of the cubic equation $$x^3 - m^2x = -\frac{D}{m}$$ for which a solution formula is well-known (see for example my answer to Is there really analytic solution to cubic equation?). Here the discriminant is $$R= (-\frac{D}{m})^2/4 + (-m^2)^3/27 = D^2/4m^2 - m^6/27$$.

Only if $$R > 0$$ you get a unique real solution which is given in the last line of your computation (plus two non-real complex conjugate solutions).

For $$R < 0$$ you get three distinct solutions of the cubic equation, but these involve complex numbers and the last line of your computation is not well-defined unless you specify which of the three possible cubic roots has to be taken in each of the two summands. See once more Is there really analytic solution to cubic equation? where you will find that the three real solutions $$x_i$$ are given as $$2\text{Re}(w_i)$$ where the $$w_i$$ are the three complex cubic roots of $$-\frac{D}{2m}+ \sqrt{R}$$.

Unfortunately, you do not apply this correctly because you mix up $$m$$ and $$n$$. For example, consider $$f(10,3) = (61,60,109)$$. Here you have $$m = 10$$ and $$n=3$$. Now insert $$m=10$$ and $$D = 2730$$ and you will see that $$R < 0$$. By the way, the cubic equation is based on the assumption that $$m > n > 0$$, thus inserting $$m=3$$ and $$D = 2730$$ has anyway nothing to do with your problem. But formally $$f(3,-10) = (-91,-60,109)$$ which explains why you get $$n = -10$$ by the cubic equation. More generally, if $$m > n > 0$$ and $$f(m,n) = (a,b,c)$$, then $$f(n,-m) = (-a,-b,c)$$ and $$D_{m,n} = D_{n,-m}$$.

Therefore I would recommend to express $$m$$ via $$n$$ and $$D$$ which leads to $$x^3 -n^2x = \frac{D}{n}$$ Here you have $$R = (\frac{D}{n})^2/4 + (-n^2)^3/27 = D^2/4n^2 - n^6/27$$ which is certainly bigger than $$D^2/4m^2 - m^6/27$$ (recall $$m > n > 0$$) and gives you a better chance to get $$R > 0$$.

In fact, if you insert $$n=3$$ and $$D = 2730$$, then you will see that $$R > 0$$. Here your formula produces the solution $$x = 10$$. However, if you use your solution formula you have to do something additional to show that the solution is exactly $$10$$. A calculator produces the value $$10$$, but it could be a non-integer real number very close to $$10$$. Thus you must insert $$x = 10$$ into the cubic equation to verify.

An example for $$R < 0$$ is $$f(8,7) = (15, 112,113)$$ with $$D = 840$$. We get $$x^3 - 49x = 120$$ Solutions are $$x = 8, -3,-5$$.

When does $$R < 0$$ occur? We know that $$m$$ is a solution of $$x^3 - n^2x - D/n = 0$$. Dividing the degree $$3$$ polynomial by $$x-m$$ produces $$x^2 + mx + (m^2-n^2)$$ and the other two solutions of the cubic equation must be solutions of the quadratic equation $$x^2 + mx + (m^2-n^2) = 0$$ i.e. are $$x_{1,2} = -\frac{m}{2} \pm \sqrt{\frac{m^2}{4} - (m^2-n^2)} = -\frac{m}{2} \pm \sqrt{n^2 -\frac{3}{4}m^2}$$ Thus, precisely when $$n > \sqrt{\frac{3}{4}}m$$ we get three distinct real solutions of our cubic equation (note also that then $$x_{1,2} < 0$$) which is equivalent to $$R < 0$$. You will easily see that precisely when $$m \ge 8$$ there are integers $$n$$ such that $$m > n > \sqrt{\frac{3}{4}}m$$.

By the way, this also shows that $$R = 0$$ cannot occur. This is equivalent to $$n = \sqrt{\frac{3}{4}}m$$ which impossible for integers $$m,n$$.

Edited:

Although the above considerations contain all relevant informations, I focused on the case that we are given $$D, n$$. The reason was that this gives a better chance for $$R > 0$$. Now let us focus on the case that $$D, m$$ are given.

We know that $$n$$ can be determined as a solution of $$x^3 - m^2x = -\frac{D}{m}$$ which has $$R = D^2/4m^2 - m^6/27$$.

When does $$R < 0$$ occur? We know that $$n$$ is a solution of $$x^3 - m^2x + D/m = 0$$. Dividing the degree $$3$$ polynomial by $$x-n$$ produces $$x^2 + mx + (n^2-m^2)$$ and the other two solutions of the cubic equation must be solutions of the quadratic equation $$x^2 + mx + (n^2-m^2) = 0$$ i.e. are $$x_{1,2} = -\frac{m}{2} \pm \sqrt{\frac{m^2}{4} - (n^2-m^2)} = -\frac{m}{2} \pm \sqrt{\frac{5}{4}m^2 - n^2}$$ Since $$m > n > 0$$, we always get three distinct real solutions $$\xi_i$$ of our cubic equation which is equivalent to $$R < 0$$. Not knowing $$n$$, these can best be expressed as $$\xi_i = 2\text{Re}(w_i)$$ where the $$w_i$$ are the three complex cubic roots of the non-real complex number $$-\frac{D}{2m}+ \sqrt{R} = -\frac{D}{2m}+ i\sqrt{-R}$$.

You also see that $$-\frac{m}{2} - \sqrt{\frac{5}{4}m^2 - n^2} < 0 < -\frac{m}{2} + \sqrt{\frac{5}{4}m^2 - n^2} < m$$, that is, the only geometrically relevant solution is the biggest of $$\xi_1,\xi_2,\xi_3$$.

• I haven't studied your answer completely but your last statement is a concern. I can already insert $m=3, D=-2730$ and get $n=10$. I want to insert $m=10, D=2730$ and get $n=3$. Or, for the simplest case $(3,4,5)$, I would like to insert $m=2, D=6$ and get $n=1$. I work nights and it's bedtime for me now but I will study your answer more tomorrow. Thanks. Jul 22 '19 at 17:37
• Note that the point is that you have the cubic equations $n^3 - m^2n = -\frac{D}{m}$ for $n$ and $m^3 -n^2m = \frac{D}{n}$ for $m$. In both cases it is essential that $m > n >0$, otherwise you get $D = mn^3 - m^3n$ which yields different cubic equations. Jul 22 '19 at 21:31
• I wouldn't have thought that $\frac{D}{m}$etc. made a difference but I'll study it more over the next few days because some things are starting to sink in. However, I still need to find how how $x^2-m^2x+\frac{D}{m}=0$ is easier to solve. Jul 23 '19 at 18:55
• When I follow your steps, I get the same equation in a different form $$=\sqrt[3]{\biggl(-\frac{\frac{D}{m}}{2}\biggr)+\sqrt{\biggl(-\frac{\frac{D}{m}}{2}\biggr)^2+\biggl(\frac{-m^2}{3}\biggr)^3}}+\sqrt[3]{\biggl(-\frac{\frac{D}{m}}{2}\biggr)-\sqrt{\biggl(-\frac{\frac{D}{m}}{2}\biggr)^2+\biggl(\frac{-m^2}{3}\biggr)^3}}$$ and $D,m=6,2\rightarrow -0.673593058$ Jul 25 '19 at 15:13
• I seems you tried to find solutions of $x^3 - m^2x = -D/m$ which is $x^3 - 4x = -3$ in that case (and not of $x^3 - n^2x = D/n$ which is $x^3 -x = 6$). Your cubic equation has $R < 0$ (and the other has $R > 0$). But then your formula involves two cubic roots (of complex numbers) which cannot be chosen indepently. I do not understand how you got $-0.673593058$. Insert it and you will see it is no solution. Jul 25 '19 at 15:48