%% Do not edit this file unless you know what you are doing.
\documentclass[twoside]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{graphics}



\begin{document}


\title{Integer solutions of the Pythagorean equation}

\maketitle



\textbf{Problem.}  Obtain all the solutions of
$$
      X^{2} + Y^{2} = Z^{2}
\eqno (1)
$$
 in positive integers.

\textbf{Phil}  As you know, in a right triangle, if the length of its two legs are $X$ and
$Y$, and if the length of its hypotenuse is $Z$, then the theorem of Pythagoras states that
the above equation (1) holds.  Here we are interesed in only the whole number solutions of
the equation. \\

By dividing both sides  of (1) by $Z$, we obtain
$$
     (X/Z)^{2} + (Y/Z)^{2} = 1
$$
Therefore
$$ 
     x^{2} + y^{2} = 1,
\eqno (2)
$$
where $x = X/Z$  and  $y = Y/Z$.\\
 
The equation (2) is a familiar equation that represents a unit circle.  If we obtain a solution
of (2) in rational numbers, then the corresponding solution of (1) is easily obtained:  If $x =
a/c$, $y = b/c$ are a rational solution of (2) expressed with a common denominator $c$,
then $X = ka, Y = kb, Z = kc$ for any integer $k$ is a whole number solution of (1). 

One way to obtain all the solutions of (2) is to obtain a parametric equation of (2).  For
example
\begin{eqnarray*}
     x &=& \mathrm{cos}\theta ,\\
     y &=& \mathrm{sin}\theta .
\end{eqnarray*}
is such a parametric equation.  By substituting an arbitrary number for $\theta $, we obtain a
solution of (2).  However $\mathrm{cos}\theta $ and \mathrm{sin\theta } are generally not
rational numbers. \\

Another parametric equation of (1) is
\begin{eqnarray*}
     x &=&u,\\
     y &=& \sqrt{1-u^{2}},
\end{eqnarray*}
where we can choose a rational value of $u$, but $y$ becomes generally an irrational
number. \\ 

\textbf{Phil}  Now, here is a magic wand.  First, any number $0 < x < 1$ can be
expressed by $x = (1-u)/(1+u)$, $0 < u < 1$.  We have an equation
$(1 + u)^{2} - (1 - u)^{2} = 4u$ for every $u$.  Therefore,
$$
     1 - x^{2} = \frac{(1+u)^{2} - (1-u)^{2}}{(1+u)^{2}} = \frac{4u}{(1+u)^{2}}\;  .
$$
Therefore, we obtain a parametric expression:
\begin{eqnarray*}
     x &=& \frac{1-u}{1+u}\\
     y &=& \frac{2\sqrt{u}}{1+u}
\end{eqnarray*}
for $0  < u <1$.  Still, $\sqrt{u}$ is irrational in general.  Therefore, we introduce a new
parameter $v = \sqrt{u}$.  Then
$$  
\begin{array}{lll}
     x &=& \frac{1-v^{2}}{1+v^{2}}\; ,\\
     y &=& \frac{2v}{1+v^{2}}\; ,
\end{array}
\eqno (3)
$$
for $0 < v < 1$.

If $v$ is a rational number such that $0 < v < 1$, then $v = q/p$, where $p$ and $q$ are
relatively prime positive integers such that $p > q$.  And
\begin{eqnarray*}
     x &=& \frac{p^{2}-q^{2}}{p^{2}+q^{2}}\; ,\\
     y &=& \frac{2pq}{p^{2}+q^{2}}\; .
\end{eqnarray*}
Therefore, all the solution of (1) in positive integers are represented by
$$
     X = k(p^{2} - q^{2}), \quad Y=2kpq, \quad Z = k(p^{2} + q^{2}).
$$
by relatively prime positive integers such that $p > q$.\\

\textbf{Jessica}  Wow! Let me get some examples.  Letting $p = 2$ and $q = 1$, we get
$X = 3k$, $Y = 4k$, $Z = 5k$, which I already know.  Letting $p = 3$ and $q = 2$, we
get $X=5k$,   $Y = 12k$,  $Z =13k$.\\

\textbf{Stephan}  I think one thing remains to be solved yet.   Can we obtain all positive
rational solutions of (2) from (3) by assigning positive rational numbers to $v$ such that $0
< v <1$?\\

\textbf{Phil}  Yes, that is crucial.  How do you prove that claim?\\

\textbf{Jessica}  Let me see.  That claim can be in other words stated that the range of the
function $v \mapsto (x,y)$  defined by (3) on the set 
$$
\{ v \mid \mbox{$v$ is rational and $0 < v <1$} \}
\eqno (4)
$$
is the set
$$
\{ (x,y) \mid x^{2} + y^{2} = 1, \; \mbox{$x$ and $y$ are positive and rational}\} .
\eqno (5)
$$\\
Let (x, y) be a point in the set (5).  From the first equation of (3) we have 
$v^{2} = (1-x)/(1+x)$.   Substituting this for $v^{2}$ in the second equation of (3), we
obtain $v = y/(1+x))$.  Let's substitute this $v$ for $v$ in the right side of the first
equation of (3) and use the equation $x^{2} + y^{2} = 1$.   Now, the right side becomes
$x$.   Similarly, if we substitute this $v$ for $v$ in the right side of the second equation of
(3) and use the equation $x^{2} + y^{2}= 1$, then the right side becomes $y$.  Therefore,
we proved the claim.    


\end{document}