Theorem: Solutions of Pythagorean Equation/Primitive

The set of all primitive Pythagorean triples is generated by:
:$\tuple {2 m n, m^2 - n^2, m^2 + n^2}$
where:
:$m, n \in \Z_{>0}$ are (strictly) positive integers
:$m \perp n$, that is, $m$ and $n$ are coprime
:$m$ and $n$ are of opposite parity
:$m > n$

Proof:
Let $\tuple {A, B, C}$ be a Pythagorean Triple:
:$A^2 + B^2 = C^2$
By the Pythagorean theorem, this equation describes the sides of a right triangle:
:400px
By the definitions of sine and cosine:
{{begin-eqn}}
{{eqn | l = \sin \theta
      | r = \frac A C
}}
{{eqn | l = \cos \theta
      | r = \frac B C
}}
{{end-eqn}}
That is,
{{begin-eqn}}
{{eqn | l = A
      | r = C \sin \theta
}}
{{eqn | l = B
      | r = C \cos \theta
}}
{{end-eqn}}
Next, we invoke Equiangular Triangles are Similar and Proportion is Equivalence Relation to write:
{{begin-eqn}}
{{eqn | l = A
      | o = \propto
      | r = B \propto C
}}
{{eqn | ll= \leadsto
      | l = C \sin \theta
      | o = \propto
      | r = C \cos \theta \propto C
      | c = from above
}}
{{eqn | ll= \leadsto
      | l = \sin \theta
      | o = \propto
      | r = \cos \theta \propto 1
      | c = dividing throughout by $C$
}}
{{end-eqn}}
We construct the following restriction of $\tan \dfrac \theta 2$.
From Shape of Tangent Function, $\tan \dfrac \theta 2: \openint 0 \pi \leftrightarrow \openint 0 {+\infty}$ is a bijection.
Restrict $\tan \dfrac \theta 2$ on this interval so that its image is the set of strictly positive rational numbers:
:$\tan \dfrac \theta 2: \tan^{-1} \sqbrk {\Q_{>0} } \cap \openint 0 \pi \leftrightarrow \Q_{>0}$
Then $\ds \tan \frac \theta 2 = \frac p q$ for some $\dfrac p q \in \Q_{>0}$, where $\dfrac p q$ is the canonical form of a rational number.
From the Double Angle Formulas:
{{begin-eqn}}
{{eqn | l = \sin \theta
      | r = 2 \sin \frac \theta 2 \cos \frac \theta 2
}}
{{eqn | l = \cos \theta
      | r = \cos^2 \frac \theta 2 - \sin^2 \frac \theta 2
}}
{{eqn | l = 2 \sin \frac \theta 2 \cos \frac \theta 2
      | o = \propto
      | r = \cos^2 \frac \theta 2 - \sin^2 \frac \theta 2 \propto 1
      | c = substituting into the above proportion
}}
{{eqn | ll= \leadsto
      | l = 2 \tan \frac \theta 2
      | o = \propto
      | r = 1 - \tan^2 \frac \theta 2 \propto \sec^2 \frac \theta 2
      | c = dividing throughout by $\cos^2 \dfrac \theta 2$
}}
{{eqn | ll= \leadsto
      | l = 2 \tan \frac \theta 2
      | o = \propto
      | r = 1 - \tan^2 \frac \theta 2 \propto 1 + \tan^2 \frac \theta 2
      | c = Difference of Squares of Secant and Tangent
}}
{{eqn | ll= \leadsto
      | l = 2 \frac p q
      | o = \propto
      | r = 1 - \paren {\frac p q}^2 \propto 1 + \paren {\frac p q}^2
}}
{{eqn | ll= \leadsto
      | l = 2 \frac p q
      | o = \propto
      | r = 1 - \frac {p^2} {q^2} \propto 1 + \frac {p^2} {q^2}
}}
{{eqn | ll= \leadsto
      | l = 2 p q
      | o = \propto
      | r = q^2 - p^2 \propto q^2 + p^2
      | c = multiplying throughout by $q^2$
}}
{{end-eqn}}
Thus these proportions describe the sides of a right triangle:
By the Pythagorean theorem, $\tuple {2 p q, q^2 - p^2, q^2 + p^2}$ is a Pythagorean triple.
That $p, q \in \Z_{>0}$ follows from $\dfrac p q \in \Q_{>0}$.
That $p \perp q$ follows from the assumption that $\dfrac p q$ was written in canonical form.
That ''every'' triple is of this form follows from the bijectivity of the tangent function as restricted above.
Recall $q^2 - p^2$ describes the side of a triangle, and so is positive.
Then $q^2 - p^2 > 0$ and therefore $q > p$.
It remains to be proven that:
:this triple is primitive
:$p$ and $q$ are of opposite parity.
{{finish}}