Can $(q,p)$ and $(p-q,p)$ be legs of a Pythagorean Triple

arithmeticelementary-number-theorypythagorean triples

I'm searching to prove that there's no (or to find an example of) $p$ and $q$ coprimes, and $n,m$ integers such that:

$q^2 + p^2 = n^2$

$(p-q)^2 + p^2 = m^2$

I conjecture that this case is impossible. Do you have any idea of how to prove or disprove it ?

So far:

I was only able to prove that in this case $p$ must be even: since there's at least one number that is even in a pythagorean triple, it must be $p$, else there'll be a contradiction with the parity of $q$ and $p-q$.

Also, (thanks to Mark Bennet), one of $p$ and $q$ (this a general property for pythagorean triples) must be a multiple of $3$. Suppose $q$ is a multiple of $3$, then $p$ is not (there are coprimes). Then $p-q$ is a multiple of three minus a non-multiple of three, meaning $p-q$ is a non-one. But this leads to a contradiction, because one of $p-q$ or $p$ must be a multiple of $3$. This means that $q$ can't be a multiple of $3$ (which was our assumption), which implies that $p$ is.

All of this leads to $p = 6p'$ with $p'$ an integer, and also that $q \equiv 1 \pmod 6$ or $q \equiv 5 \pmod 6$.

Special cases: note that in general if a value of $q$ is impossible, then the value $p-q$ is impossible too.

  • $q = p$ (or $q = 0$) is impossible, because in the first case $p^2 + p^2 = 2p^2$ which can't be a perfect square. This implies that $q^2 + p^2 > p^2 \iff q^2 + p^2 \geq (p+1)^2 \iff q^2 \geq 2p+1$.
  • $q = 1$ is impossible, because $1$ can't be coprime with $p$.
  • $q = 2$ is impossible because there's no pythagorean triple with a $2$ in it.
  • $q = 3$ is impossible because it only appears in the triple $(3,4,5)$ (for $a > 5, a^2 – (a-1)^2 = 2a – 1 > 9 = 3^2$) and $p-q = 2$ can't be in a pythagorean triple.
  • $q = 5$ ?
  • $q = 7$ ?
  • $q = 11$ ?
  • $q = 13$ ?

We can also make tests for $p$. Thanks to Misha Lavrov, there's no solution for all $p < 10^7$!

Inequalities:

Because $p = 0$ is not interesting (this will implies that $q$ and $p$ aren't coprimes) we have:
$q^2 + p^2 > q^2 \iff q^2 + p^2 \geq (q+1)^2 \iff p^2 \geq 2q+1 \iff q \leq \frac{p^2 – 1}{2}$, which gives an upper bound. This also gives us the lower bound $q \geq \sqrt{2p+1}$ and we have the same for $p$.

Applying it to $p-q$ we get: $(p-q)^2 \geq 2p+1 \iff p^2 – 2pq + q^2 \geq 2p+1$ And then: $q^2 – 2pq + p^2 – 2p – 1 \geq 0 \iff p^2 – 2p(q+1) + q^2 – 1 \geq 0$.

  • We can solve for $q$, $\Delta = 4p^2 – 4(p^2 – 2p – 1) = 4(2p+1)$, and we have the two roots of the polynomial $x_1 = p – \sqrt{2p+1}$ and $x_2 = p + \sqrt{2p+1}$, meaning (if $p \geq -\frac{1}{2}$) we have $q \leq p – \sqrt{2p+1}$ or $q \geq p + \sqrt{2p+1}$.

  • And we can solve for $p$, $\Delta = 4(q+1)^2 – 4(q^2 – 1) = 4q^2 + 4q + 4 – 4q^2 – 4 = 4q$. We have the two roots of the polynomial $x_1 = q+1-\sqrt{q}$ and $x_2 = q+1 + \sqrt{p}$, meaning (if $q \geq 0$) we have $p \leq q+1-\sqrt{q}$ or $p \geq q+1+\sqrt{q}$.

I think other inequalities should be useful, perhaps we can make ones with the fact that $p$ is a multiple of $6$.

If we need some information about pythagorean triples.

Best Answer

This solution unfortunately came out quite a bit longer than I expected (certainly not as easy as checking Sage), but it is entirely elementary and self contained. I'm sure there is a significantly shorter proof, but the idea is just to bash the equation using the $pqrs$ lemma and the parametrization for primitive Pythagorean triples.

As you have shown, $p$ must be even. Therefore by the parametrization of Pythagorean triples, there exist natural numbers $a,b,c,d$ such that

$q = a^2 - b^2, p = 2ab, n=a^2+b^2$

$q-p = c^2 - d^2, p = 2cd, m =c^2+d^2$

Equivalently, we are given four integers $a,b,c,d$ such that $\gcd(a,b)=\gcd(c,d)=1, ab=cd, a^2-b^2=c^2-d^2+2cd$

The $pqrs$ lemma states that given four positive integers $a,b,c,d$ such that $\gcd(a,b)=\gcd(c,d)=1, ab=cd$, there exist 4 pairwise coprime positive integers $p,q,r,s$ such that $a=pq, b=rs, c=pr, d=qs$. (The proof is simple: define $p=\gcd(a,c), q=\gcd(a,d)...$).

Using it here (this is a slight abuse of notation, as these $p,q,r,s$ are not related to the original $p,q$ but whatever), we get the equation

$p^2q^2 - r^2s^2 = p^2r^2 - q^2s^2 +2pqrs$

$p^2(q^2-r^2) - 2pqrs +s^2(q^2-r^2)=0$

Excluding the case $q=r=1$ (which you can easily check does not lead to a solution), this is a quadratic equation in $p$. For a quadratic equation to have a solution in integers, the discriminant must be a square, therefore $s^2(q^2r^2-(q^2-r^2)^2)$ is a square. Equivalently (as obviously $s \neq 0$),

$(r^2 + rq - q^2)(q^2 + rq - r^2)$ is a square. Notice that this is a product of two coprime integers (their $\gcd$ must divide their sum, which is $2rq$, but they are each coprime to $2, r, q$), so since their product is a square, each of them individually must be a square.

$r^2 + rq - q^2 = e^2$

$q^2+ qr - r^2 = f^2$

We will assume without loss of generality that $r > q$.

Adding and subtracting we get the equivalent equations

$2qr = e^2 + f^2$

$2(r^2 - q^2) = e^2 - f^2$

Notice from the first equation that $e,f$ must both be odd, and then looking $\mod 4$ we find that $q,r$ must both be odd as well. Using this, we define the four positive integers $x = \frac{e+f}{2}, y= \frac{e-f}{2}, z = \frac{q+r}{2}, t = \frac{q-r}{2}$, and we can rewrite our equation in these terms:

$z^2 - t^2 = x^2 + y^2$

$2tz = xy$

One of $x,y$ must be even, say $x = 2x'$. Then $x'y = tz$, and again using the $pqrs$ lemma we get four positive pairwise coprime integers $p', q', r', s'$ such that $x' = p'q', y = r's', z = p'r', t = q's'$, and the first equation can be written as

$p'^2 r'^2 - q'^2 s'^2 = 4p'^2 q'^2 + r'^2 s'^2$

$p'^2 (r'^2 - 4q'^2) = s'^2(q'^2 + r'^2)$

Therefore $(q'^2 + r'^2)(r'^2 - 4q'^2)$ is a nonzero square. We will show using the method of infinite descent that this cannot happen. Notice that $\gcd(r'^2 - 4q'^2, r'^2 + q'^2) | 5q'^2$, but they are both clearly coprime to $q'$ so $\gcd(r'^2 - 4q'^2, r'^2 + q'^2) | 5$.

Case 1: the gcd is equal to 1. In this case,

$p'^2 = q'^2 + r'^2, r'^2 = s'^2 + (2q'^2)^2$

A computation modulo 8 shows that r' must be odd, so these are two primitive Pythagorean triples. Using the parametrization we get numbers $x',y',z',t'$ such that $r' = z'^2 - t'^2, q' = 2t'z', p' = t'^2 + z'^2$ and $r' = x'^2 + y'^2, 2q' = 2x'y', s' = x'^2 - y'^2$

In other words we have found numbers $x',y',z',t'$ such that

$2t'z' = x'y'$

$z'^2 - t'^2 = x'^2 + y'^2$

Which is exactly what the original $x,y,z,t$ satisfied! So we can simply replicate the process we used to generate a smaller pair $q', r'$ such that $(q'^2 + r'^2)(r'^2 - 4q'^2)$ is a nonzero square. This means that what must eventually occur is

Case 2: the gcd is equal to 5.

Therefore there exist $x,y$ such that $q'^2 + r'^2 = 5x^2, (r'-2q')(r'+2q')=5y^2$.

Denoting $k = \gcd(r'-2q', r'+2q')$, we have two cases.

Case 2a) $r'-2q' = 5k\cdot \alpha^2, r' + 2q' = k \cdot \beta^2$ where $y=k\alpha \beta$, and $\alpha, \beta$ are coprime.

Then $r' = k\cdot \frac{5 \alpha^2 + \beta^2}{2}, q' = k\cdot \frac{\beta^2 - 5 \alpha^2}{4}$. Substituting this information into our equation we get that

$r'^2 + q'^2 = (\frac{k}{4})^2 \cdot (125 \alpha^4 + 30 \alpha^2 \beta^2 + 5 \beta^4) = 5x^2$

$\beta^4 + 6\alpha^2 \beta^2 + 25\alpha^4 = (\frac{4x}{k})^2$

$(\beta^2 + 3\alpha^2)^2 + (4\alpha^2)^2 = (\frac{4x}{k})^2$

Now, if both $\alpha, \beta$ are odd then we get $(\frac{\beta^2 + 3\alpha^2}{4})^2 + (\alpha^2)^2 = (\frac{x}{k})^2$, which is a Pythagorean triple with 2 odd numbers, which is impossible. Therefore, exactly one of $\alpha, \beta$ is even so $\beta^2 + 3\alpha^2$ is odd and $(\beta^2 + 3\alpha^2)^2 + (4\alpha^2)^2 = (\frac{4x}{k})^2$ is a primitive Pythagorean triple. One final use of the parametrization give us two positive integers $m,n$ such that

$4\alpha^2 = 2mn, \beta^2 + 3\alpha^2 = m^2 - n^2$

$2\alpha^2 = mn$, so one of $m,n$ is a square and the other twice a square.

Case 2a)i. $m = 2u^2, n = v^2, \alpha = uv$. Substituting, we get

$\beta^2 = 4u^4 - 3u^2v^2 - v^4 = (4u^2 - v^2)(u^2 + v^2)$, so we managed to create an even smaller pair $u,v$ which fits equation what we wanted from $q', r'$. As we cannot infinitely descend in this way we must eventually arrive at

Case 2b)ii. $m = u^2, n = 2v^2, \alpha = uv$. Substituting, we get

$\beta^2 = u^4 - 3u^2v^2 - 4v^4 = (u^2-v^2)(u^2 + 4v^2) = (u-v)(u+v)(u^2 + 4v^2)$

$\gcd(u^2 - v^2, u^2 + 4v^2)|5$. If the $\gcd$ is one they are both squares and we get $v = gh, u = g^2 - h^2$ from the second square and $(g^2 - gh - h^2)(g^2 + gh - h^2)$ is a square. We can use the same techniques to eventually arrive at a smaller pair $q', r'$.

If the $\gcd$ is five then we have another case which is similar (unfortunately I do not have time to write this up).


EDIT: I was a bit lazy here, it turns out that the $\gcd$ cannot be $5$: looking $\mod 4$ using the fact that $u^2 - v^2$ is 5 times a square we find that $v$ is even and $u$ is odd, but then $u^2 + 4v^2 \equiv 1 (\mod 8)$ which is not 5 times a square.


Case 2b) where $r'-2q' = k\cdot \alpha^2, r' + 2q' = 5k \cdot \beta^2$ where $y=k\alpha \beta$, and $\alpha, \beta$ are coprime is completely identical to Case 2a).

SUMMARY

We showed that to prove the problem it is sufficient to show that there do not exist a pair of coprime positive integers $q', r'$ such that $(q'^2 + r'^2)(q'^2 - 4r'^2)$ is a nonzero square. Then, we showed that given any such pair we can find a smaller pair of coprime positive integers such that the relevant product is a square. However, we cannot descend forever, which means that no such pair $q', r'$ exists, which proves the question.