<s>[INST] Prove that $\frac{a-c}{k}=\frac{d+b}{n}$, where $N=a^2+b^2=c^2+d^2$ and $k=\gcd(a-c,d-b)$, $n=\gcd(a+c, d+b)$ Let $N$ be odd and $N = a^2 + b^2 = c^2 + d^2$, where $a, b, c, d \in \mathbb{N}$ and WLOG let $a, c$ be odd, $b, d$ be even, $a > c$, and $b < d$. Prove that $\frac{a-c}{k}=\frac{d+b}{n}$.
I first began the proof my showing that $k$ and $n$ are positive integers.
Let $k= \gcd(a -c, d-b)$ and $n= \gcd(a + c, d + b)$. If $a$ and $c$ are both odd, then $a\pm c$ is even. Similarly, if $d$ and $b$ are both even, then $b\pm d$ is also even. Thus, $k$ and $n$ are also both even.
Now I wish to show that  $\frac{a-c}{k}=\frac{d+b}{n}$.
I first tried to use the fact that $N = a^2 + b^2 = c^2 + d^2$.
$$
\begin{align*}
a^2 + b^2 &= c^2 + d^2\\
a^2 -c^2 &= d^2-b^2\\
(a+c)(a-c)&=(d+b)(d-b)\\
\end{align*}
$$
This seems like I'm getting close but I can't quite see how to finish it. Any hints are appreciated.
 [/INST] We have that
$$k = \gcd(a - c, d - b) \; \; \to \; \; a - c = ke, \; d - b = kf, \; \gcd(e, f) = 1 \tag{1}\label{eq1A}$$
$$n = \gcd(a + c, d + b) \; \; \to \; \; a + c = ng, \; d + b = nh, \; \gcd(g, h) = 1 \tag{2}\label{eq2A}$$
Using \eqref{eq1A} and \eqref{eq2A} with your factorization gives
$$\begin{equation}\begin{aligned}
(a + c)(a - c) & = (d + b)(d - b) \\
(ng)(ke) & = (nh)(kf) \\
ge & = hf
\end{aligned}\end{equation}\tag{3}\label{eq3A}$$
With \eqref{eq1A} giving $\gcd(e,f) = 1$, then \eqref{eq3A} shows that
$$f \mid g \; \; \to \; \; g = sf, \; s \ge 1 \tag{4}\label{eq4A}$$
Similarly, since $\gcd(g,h) = 1$ from \eqref{eq2A}, then
$$h \mid e \; \to \; e = th, \; t \ge 1 \tag{5}\label{eq5A}$$
Thus, \eqref{eq3A} becomes
$$(sf)(th) = hf \; \; \to \; \; st = 1 \; \; \to \; \; s = t = 1 \tag{6}\label{eq6A}$$
Therefore, using \eqref{eq1A}, \eqref{eq2A}, \eqref{eq5A} and \eqref{eq6A}, we have that
$$e = h \; \; \to \; \; \frac{a - c}{k} = \frac{d + b}{n} \tag{7}\label{eq7A}$$
</s>