If you've had high school geometry, you know about the Pythagorean Theorem. It states that the sum of the squares of the sides adjacent to the right angle in a right triangle is equal to the square of the side opposite the right angle, often written $$a^2 + b^2 = c^2$$. Pythagorean triples are solutions to this equation where $$a$$, $$b$$, and $$c$$ are all positive integers. We explicitly exclude solutions where $$a$$ or $$b$$ is zero. (For example, if $$a = 0$$, then $$b = c$$, and any positive integer will work for $$b$$. Not very interesting.) Suppose we want to find a method for determining all the solutions for a given $$a$$. So, for example, if $$a = 27$$, are there there any solutions where $$b$$ and $$c$$ are positive integers? If so, what are they? And can we be sure we've found all of them?

Let's begin by recasting the problem like this:

\begin{align} c & = b + m \\ a^2 + b^2 & = (b + m)^2 \\ a^2 & = m(2b + m) \end{align}

Clearly $$m$$ must be a factor of $$a^2$$. One approach to solving the problem, therefore, would be to find all the factors of $$a^2$$ and see which (if any) lead to a solution. In our example, $$27^2 = 729$$ has factors $$1, 3, 9, 27, 81, 243,$$ and $$729$$. This leads to the following family of potential solutions:

\begin{align} m &= 1:& 729 &= 1\cdot(2b + 1),& b &= 364,& c &= 365 \\ m &= 3:& 729 &= 3\cdot(2b + 3),& b &= 120,& c &= 123 \\ m &= 9:& 729 &= 9\cdot(2b + 9),& b &= 36,& c &= 45 \\ m &= 27:& 729 &= 27\cdot(2b + 27),& b &= 0,& c &= 27 \\ m &= 81:& 729 &= 81\cdot(2b + 81),& b &= -36,& c &= -45 \\ m &= 243:& 729 &= 243\cdot(2b + 243),& b &= -120,& c &= -123 \\ m &= 729:& 729 &= 729\cdot{2b + 729},& b &= -364,& c &= -365 \end{align}

Some of the potential solutions do not yield positive integers for $$b$$. In fact only the first three do. It looks as if we can ignore factors where $$m \ge a$$. Let's see if we can formalize this intuition.

First, if $$m = a$$, then clearly $$b = 0$$, so we can ignore factors where $$m = a$$. Second, since $$a^2 = m(2b + m)$$, we know that $$m > a$$ must mean $$2b + m < a$$. Therefore, $$2b < a - m$$ However, since $$m > a$$, $$a - m < 0$$, so $$2b < 0$$, which can only be true if $$b < 0$$. So if $$m > a$$, then $$b < 0$$. Since we are only interested in positive integer solutions, we can ignore factors $$m$$ of $$a^2$$ where $$m \ge a$$.

Let's try another example. Let's let $$a = 105$$. Then $$a^2 = 11,025$$, which has $$27$$ factors of which there are $$13$$ less than $$105$$: $$1, 3, 5, 7, 9, 15, 21, 25, 35, 45, 49, 63, 75$$. This leads to $$13$$ solutions:

\begin{align} m &= 1:& 11,025 &= 1\cdot(2b + 1),& b &= 5,512,& c &= 5,513 \\ m &= 3:& 11,025 &= 3\cdot(2b + 3),& b &= 1,836,& c &= 1,839 \\ m &= 5:& 11,025 &= 5\cdot(2b + 5),& b &= 1,100,& c &= 1,105 \\ m &= 7:& 11,025 &= 7\cdot(2b + 7),& b &= 784,& c &= 791 \\ m &= 9:& 11,025 &= 9\cdot(2b + 9),& b &= 608,& c &= 617 \\ m &= 15:& 11,025 &= 15\cdot(2b + 15),& b &= 360,& c &= 375 \\ m &= 21:& 11,025 &= 21\cdot(2b + 21),& b &= 252,& c &= 273 \\ m &= 25:& 11,025 &= 25\cdot(2b + 25),& b &= 208,& c &= 233 \\ m &= 35:& 11,025 &= 35\cdot(2b + 35),& b &= 140,& c &= 175 \\ m &= 45:& 11,025 &= 45\cdot(2b + 45),& b &= 100,& c &= 145 \\ m &= 49:& 11,025 &= 49\cdot(2b + 49),& b &= 88,& c &= 137 \\ m &= 63:& 11,025 &= 63\cdot(2b + 63),& b &= 56,& c &= 119 \\ m &= 75:& 11,025 &= 75\cdot(2b + 75),& b &= 36,& c &= 111 \end{align}

That seemed to go pretty well. Let's make another trial. Lets choose $$a = 10$$, $$a^2 = 100$$. There are 9 factors, of which 4 are less than 10: 1, 2, 4, 5. Let's see what happens if we try them.

\begin{align} m &= 1,& 100 &= 1\cdot(2b + 1),& b &= 49\frac 1 2,& c &= 50\frac 1 2 \\ m &= 2,& 100 &= 2\cdot(2b + 1),& b &= 24,& c &= 26 \\ m &= 4,& 100 &= 4\cdot(2b + 1),& b &= 10\frac 1 2,& c &= 14\frac 1 2 \\ m &= 5,& 100 &= 5\cdot(2b + 1),& b &= 7\frac 1 2,& c &= 12\frac 1 2 \end{align}

Only one of these solutions satisfies the requirement that all the numbers be positive integers. To see why, let's consider what happens if $$a$$ is even. If $$a$$ is even, then $$m(2b + m)$$ must also be even. However, whenever $$m$$ is odd, the expression $$m(2b + m)$$ must also be odd. Therefore $$m$$ odd can never lead to a solution for $$a$$ even; $$m$$ must also be even. What about the case above where $$m = 4$$? Let's consider the case where $$a = {2^n}p$$ and $$p$$ is odd. Then $${2^{2n}}p^2 = m(2b + m)$$ Clearly, if $$m = 2^{2n}$$, then $$p = 2b + 2^{2n}$$. However, this contradicts the stipulation that $$p$$ must be odd. Similar reasoning applies if $$p = qr$$ and $$m = 2^{2n}q$$. Therefore, $$m = 2^{2n}$$ cannot lead to a solution. In summary, for $$a$$ even, there are no integer solutions when $$m$$ is odd or when $$m$$ contains all the $$2$$s in $$a^2$$.

Let's take a look at one more example. Suppose $$a = 360$$, $$a^2 = 129,600$$. There are $$105$$ factors of $$129,600$$ of which $$52$$ are less than $$360$$. We can count the factors by looking at the prime factorization of $$129,600$$. Let's start with the prime factorization of $$360$$.

$$360 = 2^{3}\cdot3^{2}\cdot5^{1}$$

Squaring it gives a prime factorization for $$129,600$$ of:

$$129,600 = 2^{6}\cdot3^{4}\cdot5^{2}$$

Counting $$0$$ as an exponent, we get $$7 \cdot 5 \cdot 3 = 105$$ total factors of $$129,600$$. Of those $$5 \cdot 3 = 15$$ are odd. Another $$15$$ contain the maximum power of $$2$$. Also just less than half, $$52$$, are less than $$360$$. Here is a table that shows which factors lead to solutions. All in all, there are $$37$$ values for $$m$$ that lead to a solution.

20

21

22

23

24

25

26

30 ∙ 5 0

1

2

4

8

16

32

64

31 ∙ 5 0

3

6

12

24

48

96

192

32 ∙ 5 0

9

18

36

72

144

288

≥ 360

33 ∙ 5 0

27

54

108

216

≥ 360

≥ 360

≥ 360

34 ∙ 5 0

81

162

324

≥ 360

≥ 360

≥ 360

≥ 360

30 ∙ 5 1

5

10

20

40

80

160

320

31 ∙ 5 1

15

30

60

120

240

≥ 360

≥ 360

32 ∙ 5 1

45

90

180

≥ 360

≥ 360

≥ 360

≥ 360

33 ∙ 5 1

135

270

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

34 ∙ 5 1

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

30 ∙ 5 2

25

50

100

200

≥ 360

≥ 360

≥ 360

31 ∙ 5 2

75

150

300

≥ 360

≥ 360

≥ 360

≥ 360

32 ∙ 5 2

225

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

33 ∙ 5 2

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

34 ∙ 5 2

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

≥ 360

I leave it to the reader to find the solutions.