# deriving the formulas for Pythagorean triples

A Pythagorean triple is a triple $(a,b.c)$ of positive integers for which $a^2+b^2=c^2$;it is called primitive if the $\gcd(a,b.c)=1$.

1. Consider a complex number $z=q+pi$, where $q>p$ are positive integers. prove that $(q^2-p^2,2pq,q^2+p^2)$ is a Pythagorean triple, and whether it is primitive?

2. prove that every primitive triple $(a,b,c)$ is of this type.

• Did you try to plug $(q^2-p^2,2pq,q^2+p^2)$ into the equation and see if the equality holds or not? At least that is what expected from you to do it on your own. Also, please tell us what grade you're studying this for homework because I can give you different answers based on your math background. Sep 17, 2013 at 8:41
• Yes，this is what I mean Sep 17, 2013 at 8:43
• Your assumption that $q>p$ is not sufficient. Set $p=4$ and $q=6$, it's clear that $6>4$. then $(20,48,52)$ will be such a pair as in your question but $\gcd(20,48,52)=4$. You need to assume $\gcd(p,q)=1$ or suppose that $p,q$ are prime to prove $\gcd(q^2-p^2,2pq,q^2+p^2)=1$. Sep 17, 2013 at 8:51
• See math.stackexchange.com/questions/423196/… for a derivation of the formulas for Pythagorean triples. Sep 17, 2013 at 8:55
• I am a college student ,and I am a freshmen. If you can give me different answers, I am glad to know about it.The most important thing is that how to solve the No.2 question. Thank you. Sep 17, 2013 at 9:00

The first one is quite easy. It's obvious that $(q^2-p^2,2pq,q^2+p^2)$ is a Pythagorean triple because:

$(q^2-p^2)^2+(2pq)^2=(q^2+p^2)^2 \iff q^4 + p^4 - 2p^2q^2 + 4p^2q^2=q^4+p^4+2p^2q^2$

as I said in the comments, the condition that $q>p$ is not sufficient. I believe the following conditions are sufficient to prove $\gcd(q^2-p^2,2pq,q^2+p^2)=1$:

1. $\gcd(p,q)=1$

2. $p$ and $q$ must have different parities. In other words, one of them must be odd and the other one must be even.

To prove that part, notice that if we set $d=\gcd(q^2-p^2,2pq,q^2+p^2)$ and suppose $d>1$ then there must be a prime number $m$ such that $m \mid d$ by prime factorization theorem. Remember that $m$ is a prime number and we use all theorems about prime numbers for $m$.

Now, since $m \mid d$ then $m \mid q^2-p^2$ and $m \mid q^2+p^2$. so, we have:

$m \mid (q^2-p^2)+(q^2+p^2)=2q^2$ and $m \mid (q^2+p^2)-(q^2-p^2)=2p^2$.

If $m \neq 2$ then since $\gcd(m,2)=1$ we can see that:

$m \mid 2q^2 \implies m \mid q^2 \implies m \mid q$

$m \mid 2p^2 \implies m \mid p^2 \implies m \mid p$.

That means $m \mid \gcd(p,q)$, but by our hypothesis, $\gcd(p,q)=1$ therefore $m \mid 1$ and since $m$ has been assumed to be a prime number that is a contradiction.

To check that the case where $m=2$ doesn't happen notice that $p$ and $q$ have different parities. So, one of them is even and the other one is odd. In this case $q-p$ and $p+q$ will be odd and their product $(q-p)(p+q)=q^2-p^2$ will be odd as well.Therefore $2 \not\mid q^2-p^2$ and hence $d \neq 2$.

To prove the second one, what I have in mind is a geometric argument which is based on the fact that all Pythagorean triples actually come from the rational parametrization of the unit circle. I have talked about this before on another question, I'll try to find it. The fact that all Pythagorean triples are obtained by this way is actually is equivalent to the surjectivity of the map which is obtained from parametrization. I can't think of any better reasons for now, but I'll edit my post to give a good proof of the second statement.

• Also, notice that the second condition I have mentioned is necessary. Because if $p$ and $q$ both have the same parity, then $p^2-q^2$ and $p^2+q^2$ both will be even, and since $2pq$ is also clearly even, then $2 \mid \gcd(q^2-p^2,2pq,p^2+q^2)$. Also, note that if we didn't have $\gcd(p,q)=1$, I couldn't reach a contradiction in my proof. See for example the case where $p=4$ and $q=6$ that I posted under your question as a comment. Sep 17, 2013 at 9:55
• Check this: math.stackexchange.com/questions/461527/… Sep 17, 2013 at 10:05