Solution (source code)

= Solution

There is a necessary ordering qualification: the printed formula requires the even leg to be called $b$. The primitive <Pythagorean triple> $(a,b,c)=(4,3,5)$ satisfies the printed hypotheses but cannot have $b=2nm$. Thus the intended assertion is true \b[after interchanging the two legs if necessary]. We prove that version, including the parity condition on the parameters.

A primitive <Pythagorean triple> has pairwise <coprime> sides: a prime dividing any two also divides the third. The two legs cannot both be odd, since their squares would sum to $2\pmod4$, and cannot both be even. Call the odd leg $a$ and the even leg $b$; then $c$ is odd. The positive integers
$$
u=\frac{c+a}{2},\qquad v=\frac{c-a}{2}
$$
satisfy $uv=(b/2)^2$ and are <coprime>, since a common divisor divides both $c$ and $a$. A product of <coprime> positive <integers> is a square only when both factors are squares, by their <prime factorizations>. Write $u=n^2$, $v=m^2$. Then $n>m>0$, $\gcd(n,m)=1$, and
$$
\boxed{a=n^2-m^2,\qquad b=2nm,\qquad c=n^2+m^2.}
$$
Furthermore $n,m$ have opposite parity, since $c$ is odd. Conversely these coprimality and parity conditions give a primitive triple: the square identity follows by expansion, and a common odd prime divisor of its legs would divide both $n,m$, while the odd leg excludes a common factor two. This is the <primitive Pythagorean parametrization>.