# Difference between hypotenuse and larger leg in a Pythagorean triple

I've been number crunching irreducible Pythagorean triples and this pattern came up: the difference between the hypotenuse and the larger leg seems to always be n² or 2n² for some integer n. Moreover, every integer of the form n² or 2n² is the difference between hypotenuse and the larger leg for some irreducible Pythagorean triple. Is there a simple proof for that?

There is a result listed on Wikipedia that looks kinda, sorta related: that the area of a Pythagorean triangle can not be the square or twice the square of a natural number.

EDIT: Actually, the statements are correct only for odd n² (but also by any 2n² as stated) as John Omielan demonstrated below.

• Are you aware of the formula $(p^2-q^2, 2pq, p^2+q^2)$ where $p,q$ are coprime and have opposite parity? Jul 5, 2021 at 2:20
• By the way, what is an example of an irreducible Pythagorean triple in which the difference between the hypotenuse and larger leg is $2^2$? Jul 5, 2021 at 2:41
• @DavidK The difference of 4 is impossible as proved in the answers below. Jul 7, 2021 at 6:11
• Yes, that was a hint that the $n^2$ differences would occur only for odd $n.$ Jul 7, 2021 at 11:45

As explained in Pythagorean triple, for integers $$m \gt n \gt 0$$, Euclid's formula of

$$a = m^2 - n^2, \; \; b = 2mn, \; \; c = m^2 + n^2 \tag{1}\label{eq1A}$$

generates all primitive (i.e., irreducible) Pythagorean triples, specifically

Every primitive triple arises (after the exchange of $$a$$ and $$b$$, if $$a$$ is even) from a unique pair of coprime numbers $$m$$, $$n$$, one of which is even.

Note \eqref{eq1A} results in

$$c - a = (m^2 + n^2) - (m^2 - n^2) = 2n^2 \tag{2}\label{eq2A}$$

$$c - b = (m^2 + n^2) - 2mn = (m - n)^2 \tag{3}\label{eq3A}$$

Regarding your second part, to help avoid confusion with $$n$$ above, let's call the values $$k^2$$ and $$2k^2$$ instead. With the first one, it uses \eqref{eq3A} so $$k = m - n$$. However, since one of $$m$$ and $$n$$ is even and the other is odd, their difference is odd, so only odd $$k$$ will work. For any such $$k$$, set $$n = k + 1$$ and $$m = 2k + 1$$ (note $$m$$ and $$n$$ are coprime, with $$n$$ even) to get

$$m^2 - n^2 = (4k^2 + 4k + 1) - (k^2 + 2k + 1) = 3k^2 + 2k \tag{4}\label{eq4A}$$

$$2mn = 2(2k + 1)(k + 1) = 2(2k^2 + 3k + 1) = 4k^2 + 6k + 2 \tag{5}\label{eq5A}$$

This shows $$2mn \gt m^2 - n^2$$, so $$2mn$$ is the longer leg. Thus, the difference would result in \eqref{eq3A}.

For the $$2k^2$$ case, choose $$n = k$$ and $$m = 3k + 1$$ (note $$m$$ and $$n$$ are coprime, with one of them even). Therefore,

$$m^2 - n^2 = (9k^2 + 6k + 1) - k^2 = 8k^2 + 6k + 1 \tag{6}\label{eq6A}$$

$$2mn = 2(3k + 1)k = 6k^2 + 2k \tag{7}\label{eq7A}$$

This means $$m^2 - n^2 \gt 2mn$$, so $$m^2 - n^2$$ is the longer leg. Thus, the difference would result in \eqref{eq2A}.

• +1: (also) to your answer, as presenting a more complete answer to the question than my answer did. Jul 4, 2021 at 21:15
• @user2661923 Thanks for the response & upvote. I was about to press the Post button with just the first part answered, similar to your answer, when I happened to look at the question again to notice it had a second part as well. So I also missed that part initially. Jul 4, 2021 at 21:25
• You also proved my statement is wrong. Not all squares can be the "personality" (I'm calling [c - larger leg] that) of a primitive Pythagorean triple. The double of any square can and is, though. Jul 4, 2021 at 22:14
• Also, the statement applies to both c-a and c-b regardless of which is the "personality" (i.e., the largest). Jul 4, 2021 at 22:17

Counter example is $$(9, 12, 15)$$.

Edit
In addition to overlooking the 2nd part of the OP's question, as indicated in my 2nd edit (below), I also overlooked that in the first part of the OP's question, he is (also) specifically focusing on irreducible Pythagorean triplets.

I've been number crunching irreducible Pythagorean triples

However, if the pythagorean triplet is presumed irreducible, then the problem is completely resolved by this article which indicates that the product will either have form

$$[(m^2 + n^2) - (m^2 - n^2)] = 2n^2$$

or will have form

$$[(m^2 + n^2) - (2mn)] = (m - n)^2.$$

Edit
After reading John Omielan's answer, and then re-reading the question, I realized that my answer is incomplete. However, there is no point in my trying to complete my answer, since John Omielan's answer covers the exact same ground.

We have $$a^2+b^2=c^2$$, hence $$(c-b)(c+b)=a^2$$. Since the triple is irreducible, the GCD of $$c-b$$ and $$c+b$$ is at most $$2$$: any divisor of both $$c-b$$ and $$c+b$$ would also have to be a divisor of $$(c+b)-(c-b)=2b$$, and $$GCD(c-b, b)=GCD(c+b,b)=GCD(b,c)=1$$. So we can say the following about $$c-b$$ and $$c+b$$:

• The product of these two numbers is a square. That is, the power of each prime factor of their product is even.
• The two numbers do not share any prime factors apart from, possibly, $$2$$.

This means that, with a possible exception of $$2$$, every prime factor's power of both $$c-b$$ and $$c+b$$ is even. If the numbers are odd (their GCD is 1), the same holds for $$2$$ (its power is $$0$$), so each of them is a perfect square. If the numbers are even (their GCD is 2), divide both by $$2$$ first, and then similarly conclude that $$(c-b)/2$$ as well as $$(c+b)/2$$ is a square.

As for the second part of the question, just find any solution to either $$c-b=n^2$$ or $$c-b=2n^2$$ for an arbitrary $$n$$. In particular, the triples $$(n^2+2n, 2n+2, n^2+2n+2)$$ and $$(2n^2+2n, 2n+1, 2n^2+2n+1)$$ respectively satisfy the condition.

Note though that for even $$n$$ there are no irreducible triples with $$c-b=n^2$$: since $$c+b$$ has to be a square of the same parity, both $$c-b$$ and $$c+b$$ are divisible by $$4$$, then $$2b=(c+b)-(c-b)$$ and $$2c=(c+b)+(c-b)$$ are divisible by $$4$$, which means $$b$$, $$c$$, and consequently $$a$$ are all even.

If we replace the usual $$(m,n)$$ of Euclid's formula with $$(2n-1+k,k)$$, we get \begin{align*} A=(2n-1)^2+ & 2(2n-1)k \\ B= \qquad\quad\quad & 2(2n-1)k+ 2k^2\\ C=(2n-1)^2+ & 2(2n-1)k+ 2k^2\\ \end{align*} which produces the mostly-primitve table of Pythagorean triples below. Notice that half of all triples have $$A>B$$ and half have $$B>A$$.

$$\begin{array}{c|c|c|c|c|c|} n & k=1 & k=2 & k=3 & k=4 & k=5 \\ \hline Set_1 & 3,4,5 & 5,12,13& 7,24,25& 9,40,41& 11,60,61 \\ \hline Set_2 & 15,8,17 & 21,20,29 &27,36,45 &33,56,65 & 39,80,89 \\ \hline Set_3 & 35,12,37 & 45,28,53 &55,48,73 &65,72,97 & 75,100,125 \\ \hline Set_{4} &63,16,65 &77,36,85 &91,60,109 &105,88,137 &119,120,169 \\ \hline Set_{5} &99,20,101 &117,44,125 &135,72,153 &153,104,185 &171,140,221 \\ \hline Set_{6} &43,24,145 &165,52,173 &187,84,205 &209,120,241 &231,160,281 \\ \hline \end{array}$$

From the formula we can see that $$\quad C-A=2k^2\quad$$ and that $$\quad C-B=(2n-1)^2.\quad$$ The first case it is twice the square of any natural number and the second is an odd number squared.