[step:Verify that Euclid's formulas give a primitive Pythagorean triple]
Conversely, let $m,n \in \mathbb N$ satisfy $m>n$, $\gcd(m,n)=1$, and suppose $m,n$ have opposite parity. Define $x,y,z \in \mathbb N$ by
\begin{align*}
x := m^2-n^2,
\qquad
y := 2mn,
\qquad
z := m^2+n^2.
\end{align*}
Since $m>n$, $x>0$, and all three numbers are positive integers. Also $y$ is even. Direct expansion gives
\begin{align*}
x^2+y^2
&=
(m^2-n^2)^2+(2mn)^2 \\
&=
m^4-2m^2n^2+n^4+4m^2n^2 \\
&=
m^4+2m^2n^2+n^4 \\
&=
(m^2+n^2)^2 \\
&=
z^2.
\end{align*}
It remains to prove primitivity. Let $d:=\gcd(x,y,z)$. Since $m$ and $n$ have opposite parity, $m^2-n^2$ and $m^2+n^2$ are odd, while $2mn$ is even. Thus $2\nmid d$.
Now let $p$ be an odd prime divisor of $d$. Then $p$ divides $y=2mn$, and since $p$ is odd, $p$ divides $mn$. Hence $p$ divides $m$ or $p$ divides $n$. If $p$ divides $m$, then from $p\mid z=m^2+n^2$ we get $p\mid n^2$, so $p\mid n$, contradicting $\gcd(m,n)=1$. If $p$ divides $n$, then from $p\mid z=m^2+n^2$ we get $p\mid m^2$, so $p\mid m$, again contradicting $\gcd(m,n)=1$. Therefore no odd prime divides $d$. Since neither $2$ nor any odd prime divides $d$, we have $d=1$.
Thus $(x,y,z)$ is a primitive Pythagorean triple with $y$ even. This completes both directions of the theorem.
[/step]