# What percent of primitive Pythagorean triples have an even number as their smallest leg?

What I'm trying to ask here is, if you take a larger and larger set of consecutive primitive Pythagorean triples, what percent of that set will have an even number as their smallest leg? Ex: 8,15,17. There's a way to generate a Pythagorean triple for every odd integer, $$a^2+(\frac{a^2-1}{2})^2=(\frac{a^2-1}{2}+1)^2,$$ but Pythagorean triples that have a even number as their smallest leg are not so easy. Can anybody help/give suggestions? Thanks!

This turns out to be a reasonably complicated question. To answer a question of the form "what proportion of an infinite set", one first has to decide on an ordering of that infinite set.

The most convenient ordering on Pythagorean triples $$(a,b,c)$$ comes from the classical parametrization $$a = k(m^2-n^2), \quad b=k(2mn), \quad c=k(m^2+n^2),$$ where $$m>n>0$$ are relatively prime integers, not both odd, and $$k$$ is a positive integer. One can then count approximately how many Pythagorean triples there are with $$1\le k,m,n\le x$$, and how many of them have either $$k$$ even or $$b$$ as the smaller side. Those for which $$b$$ is the smaller side—that is, for which $$2mn < m^2-n^2$$, or $$(\frac mn)^2 - 2\frac mn-1 > 0$$—correspond to numbers $$m,n$$ with $$m>(1+\sqrt2)n$$. Out of all pairs with $$m>n>0$$, this corresponds to a proportion of $$\frac1{1+\sqrt2} = \sqrt2-1$$. Of course the even $$k$$ correspond to a proportion of $$\frac12$$. So the triples $$(k,m,n)$$ yielding an odd shorter side comprise a proportion $$\big(1-(\sqrt2-1)\big)(1-\frac12) = 1-\frac1{\sqrt2}$$, meaning that those yielding an even shorter side comprise a proportion $$\frac1{\sqrt2}$$.

There are some assumptions being swept under the rug—for example, that $$k$$ being even and $$2mn$$ being less than $$m^2-n^2$$ are asymptotically independent; and also that these proportions don't change when we restrict to relatively prime pairs $$(m,n)$$ that are not both odd. But I believe these assumptions can be verified with a lengthier argument.

So in conclusion: under this ordering, the percentage of Pythagorean triples with the shorter leg even seems to be $$\frac1{\sqrt2} \approx 70.71\%$$. (And if we restrict to primitive Pythagorean triples—those for which the three sides are relatively prime—then the $$k$$ variable disappears, and the percentage then becomes $$\sqrt2-1 \approx 41.42\%$$.)

The most natural ordering probably comes not from saying that $$k,m,n\le x$$, but rather that all three sides of the triangle are less than $$y$$, so that $$k(m^2+n^2)\le y$$. In this case, instead of the proportion of the triangle with vertices $$(0,0)$$, $$(x,0)$$, and $$(x,x)$$ that lies under the line $$m=(\sqrt2+1)n$$, I believe we should take the proportion of the circular wedge $$\{m^2+n^2\le y,\, m>n\}$$ that lies under that line—and that proportion turns out to be exactly $$\frac12$$! So under this ordering, the percentage of Pythagorean triples with the shorter leg even seems to be $$\frac34$$, and the percentage of primitive Pythagorean triples with the shorter leg even seems to be $$\frac12$$.

• Since OP's question mentions 'primitive', you should be able to just take $k=1$ here and get the $\sqrt{2}-1$ value for the probability. Commented Feb 5, 2020 at 19:51
• +1. As often occurs in probability, especially with asymptotic odds, it depends on how you define it. Commented Feb 5, 2020 at 23:55

It depends on which formula you use. The one that shows the $$trend$$ most clearly is one I discovered which generates all triples where $$GCD(A,B,C)=(2m-1)^2, m\in\mathbb{N}$$. This includes all primitives. F(n,k) produces no trivial triples and uses all natural numbers.

$$A=(2n-1)^2+2(2n-1)k\qquad B=2(2n-1)+2k^2\qquad C=(2n-1)^2+2(2n-1)k+2k^2$$

where $$n,k\in\mathbb{N}$$, where $$n$$ is a set number and $$k$$ is the member number or "count" within the set. It produces triples that look like the sample of sets shown here where side-$$B$$ is always even. Note also that, in $$Set_1$$, the values of $$A$$ include every odd integer $$>1$$. $$\begin{array}{c|c|c|c|c|c|c|} n & Triple_1 & Triple_2 & Triple_3 & Triple_4 & Triple_5 & Triple_6 \\ \hline Set_1 & 3,4,5 & 5,12,13& 7,24,25& 9,40,41& 11,60,61 & 13,84,85 \\ \hline Set_2 & 15,8,17 & 21,20,29 &27,36,45 &33,56,65 & 39,80,89 & 45,108,117 \\ \hline Set_3 & 35,12,37 & 45,28,53 &55,48,73 &65,72,97 & 75,100,125 & 85,132,157 \\ \hline Set_{4} &63,16,65 &77,36,85 &91,60,109 &105,88,137 &119,120,169 & 133,156,205 \\ \hline Set_{5} &99,20,101 &117,44,125 &135,72,153 &153,104,185 &171,140,221 & 189,180,261 \\ \hline Set_{6} &143,24,145 &165,52,173 &187,84,205 &209,120,241 &231,160,281 & 253,204,325 \\ \hline \end{array}$$ As you can see in this sample (and in the formula) side-$$B$$ may begin smaller than side-$$A$$ in $$Set_2$$ and above, but the $$k^2$$ factor always makes it outgrow side-$$A$$. Offhand, I would say that $$B much less than half the time. I suspect, if you wrote a program to test my conjecture, you would find, going through $$n$$ sets to the same depth $$k$$ in each, you would find that the percentage of $$B would decrease the higher the numbers where $$n=k$$. The number of elements where $$B per set increases with each increase set number forming a roughly $$45^\circ$$ diagonal through the sets/members but there are none in $$Set_1$$ and (not seen except for $$27,36,45$$) the percentage of non-primitives increases with set number and depth.

My guess is that, with the $$all\text{-}primitives$$ and no $$B in $$Set_1$$ coupled with a non-primitive any time $$k$$ is a $$1$$-or-more multiple of any factor of $$(2n-1)$$ in $$Set_2$$ and above, the overall percentage of primitives where $$B will hover around the low $$40s\%$$.

I did a check in a spreadsheet from $$Set_1$$ to $$Set_{20}$$ to a depth of 27 counting primitive where $$B. Here are the counts of the first $$9$$ sets:

$$C_1=0\quad C_2=2\quad C_3=3\quad C_4=5\quad C_5=4\quad C_6=7\quad C_7=9\quad C_8=5\quad C_9=13\quad$$

For these $$9$$ sets to a depth of $$9$$, there are $$\frac{48}{81}=59.26\%$$ In the $$20$$ sets to a depth $$27$$, the highest element in $$Set_{20}$$ where $$B, there are $$\frac{230}{540}=42.59\%$$. I believe the trend will converge to something near $$41\%$$ as indicated in Greg Martin's answer.

• I mean,.... bashing is one way to go about it. With a computer, it would work, but it's not a very elegant solution, don't you think? Commented Feb 12, 2020 at 22:08
• @jettae schroff I'm not recommending the approach. I'm just providing evidence in support of the estimate by Greg Martin. I don't follow all of his logic but he seems to be right, using just theory. Commented Feb 12, 2020 at 23:30