# Find all Pythagorean triples $x^2+y^2=z^2$ where $x=21$

Consider the following theorem:

If $$(x,y,z)$$ are the lengths of a Primitive Pythagorean triangle, then $$x = r^2-s^2$$ $$y = 2rs$$ $$z = r^2+z^2$$ where $$\gcd(r,s) = 1$$ and $$r,s$$ are of opposite parity.

According to the previous theorem,My try is the following:

since $$x = r^2-s^2$$, $$x$$ is difference of two squares implying that $$x \equiv 0 \pmod 4$$. But $$x=21 \not \equiv 0 \pmod 4$$. Hence, there are no triangles having such $$x$$.

Is that right?

• I don't understand your argument at all. It is simply not true that the difference of two squares is always $\equiv 0 \pmod 4$.
– lulu
Dec 15, 2018 at 0:10
• It was understandable before, but it is wrong. There are primitive triples with $21$. $(21,20,29)$, say
– lulu
Dec 15, 2018 at 0:18
• The hint I wrote out in an earlier comment is close to a complete solution. You should be able to follow it to list all the triples with $21$.
– lulu
Dec 15, 2018 at 0:20
• Squares are either $0 \text{ mod } 4$ or $1 \text{ mod } 4$, and hence there is at least one square which is $1 \text{ mod } 4$ and another which is $0 \text{ mod } 4$, whose difference will be $1 \text{ mod } 4$. Dec 15, 2018 at 0:20
• @MagedSaeed Do not mind for misakes, that's the way we learn a lot! Your question was fine and properly posted. Bye
– user
Dec 15, 2018 at 0:33

Recall that

$$3^2+4^2=5^2 \implies (3\cdot 7)^2+(4\cdot 7)^2=(5\cdot 7)^2$$

and note that

$$(21, 220, 221)$$

is a primitive triple.

Your criterion doesn't works because the remainder of squares $$\pmod 4$$ are $$0,1$$ therefore we can't comclude that

$$z^2-y^2\equiv 0 \pmod 4$$

What we need to solve is

$$21^2=441=3^2\cdot 7^2=(z+y)(z-y)$$

that is we need to try with

• $$z-y=1 \quad z+y=441\implies (x,y,z)=(21,200,221)$$
• $$z-y=3 \quad z+y=147\implies (x,y,z)=(21,72,75)$$
• $$z-y=7 \quad z+y=63\implies (x,y,z)=(21,28,35)$$
• $$z-y=9 \quad z+y=49\implies (x,y,z)=(21,20,29)$$
• My method works if the question asks for primitive triangle. Right? Dec 15, 2018 at 0:10
• @MagedSaeed Note that also $(21, 220, 221)$ is a primitive triple.
– user
Dec 15, 2018 at 0:13
• Can you find a general form of the solutions please. Refer to the question title. Dec 15, 2018 at 0:18
• @MagedSaeed Your criterion doesn't work since we can have $z\equiv 1 \pmod 4$ and $y\equiv 0 \pmod 4$.
– user
Dec 15, 2018 at 0:20
• @MagedSaeed I've added something more! You are welcome, Thanks Bye
– user
Dec 15, 2018 at 0:31

We have $$21=x=k(m^2-n^2),\, y=2kmn,\, z=k(m^2+n^2)$$ where $$m,n, k \in \Bbb N$$ with $$\gcd (m,n)=1$$ and $$m,n$$ not both odd.

So $$(m^2-n^2,k)\in \{(1,21),(3,7),(7,3),(21,1)\}.$$ Now $$m^2-n^2=1$$ is impossible, so $$(m,n,k)\in \{(2,1,7), (4,3,3),(11,10,1),(5,2,1)\},$$ giving $$(x,y,z)\in \{ (21,28,35), (21,72, 75),(21,220, 221),(21, 20, 29)\}.$$ We have $$m\leq 11$$ because if $$m\geq 12$$ then $$x\geq m^2-n^2\geq m^2-(m-1)^2=2m-1\geq 23>21...$$ There are 2 solutions $$(11,10)$$ and $$(5,2)$$ to $$m^2-n^2=21.$$

Since $$A$$ may be any odd number $$\ge3$$ and we can find one or more triples for any odd leg $$A\ge 3$$ using a function of $$(m,A).$$ We know that $$A=m^2-n^2\implies n=\sqrt{m^2-A}.$$ $$\text{We can let }n=\sqrt{m^2-A}\text{ where }\lceil\sqrt{A}\space\rceil\le m\le \frac{A+1}{2}$$

$$\text{Note: }n\in \mathbb{R}\implies \sqrt{A}\lt m\land n

$$\text{For A=21}\quad m_{min}=\lceil\sqrt{21}\space\rceil=5\qquad \qquad m_{max}\frac{22}{2}=11$$

Testing for $$5\le m\le 11$$, we find $$\mathbf{integers}$$ for $$(m,n)=(5,2)\text{ and }(11,10)$$

$$f(5,2)=(21,20,29)\qquad f(11,10)=(21,220,221$$ But $$21=3*7$$

$$\text{For A=3}\quad m_{min}=\lceil\sqrt{3}\space\rceil=2\quad m_{max}=\frac{4}{2}=2\quad \quad 7f(2,1)=7(3,4,5)=21,28,35$$

$$\text{For A=7}\quad m_{min}=\lceil\sqrt{7}\space\rceil=3\quad m_{max}=\frac{8}{2}=4\quad \quad 3f(4,3)=3(7,24,25)=21,72,75$$

• Why was my answer downvoted? I gave a clear procedure for producing all triples for a given side $A$ and came up with the same $4$ triples as other answers. I would like for someone to check my answer and tell me if it is flawed or, as I believe, if it is useful. Jun 17, 2019 at 19:22