Suppose we want to solve the following Diophantine equation

$$ 3a^2 + b^2 = c^2 $$

for all triples of nonnegative integers $(a, b, c)$ where $\gcd(a, b, c) = 1$ and $a \le b$. Given the solution $(0, 1, 1)$, one can use the method mentioned on Wolfram Mathworld to generate many more solutions using pairs of integers $(u, v)$:

\begin{align} A &= 2uv \\ B &= 3u^2 - v^2 \\ C &= 3u^2 + v^2 \\ \end{align} These $A, B, C$ are not necessarily coprime or nonnegative, so we produce $(a, b, c)$ as follows: $$ g = \gcd(A, B, C) \qquad (a,b,c) = \left(\frac{|A|}g, \frac{|B|}g, \frac{|C|}g\right) $$

That much is easy. However, we can go further.

After performing brute force calculations, I am convinced that there is in fact a one-to-one correspondence between:

  • the desired solutions $(a, b, c)$ as previously described,
  • and coprime pairs $(u, v)$ of nonnegative integers, $0 <= u <= v$.

It is easy to prove that every $(u, v)$ admits an $(a, b, c)$, as I have already demonstrated above.

But how can one prove the converse? Or more effectively: Given $(a, b, c)$, how do we solve for $(u, v)$?


As coming from an identity, in this case $$3(2uv)^2+(3u^2-v^2)^2=(3u^2+v^2)^2$$ the given parameterization gives all the integer solutions of the equation $3a^3+b^2=c^2$. If $(a,b,c)$ is an integer solution the system involving the corresponding parameters $(u.v)$ easily gives the solution $$u=\sqrt{\frac{c+b}{6}}\\v=\sqrt{\frac{c-b}{2}}$$ so the parameters are not necessarily rational which is not matter of rejection. Above it has been say that the identity gives ALL the solutions but it is not said that the parameters should be necessarily rational. For example $(u,v)=(2\sqrt3,3\sqrt3)$ gives $(A,B,C)=(9\cdot4,9\cdot1,9\cdot7)$ corresponding to the solution in coprimes $(a,b,c)=(4,1,7)$

  • $\begingroup$ Interesting. This does seem like a workable starting point. More to the point from your example (as we want to obtain uv from abc), $(a, b, c) = (4, 1, 7)$ leads to $(u, v) = (2/\sqrt(3), \sqrt(3))$, which can be uniformly multiplied by $\sqrt(3)$ to get integer $(u, v) = (2, 3)$. In order to prove that there always exists such a uniform scale factor which eliminates all square roots, one must prove a series of equivalences of the powers of prime factors in $(c-b)$ and $(c+b)$ modulo 2, which seems doable by equating $(c - a)(c + a) = 3b^2$. $\endgroup$
    – Exp HP
    Feb 20 '20 at 18:34
  • $\begingroup$ Success! Not only was I able to prove that this uniform scale factor always exists, but I was able to go all the way and prove the one-to-one correspondence. That part wasn't so simple! (I'm working on a self-answer that shares these details) $\endgroup$
    – Exp HP
    Feb 23 '20 at 16:18
  • $\begingroup$ @Exp HP.-Godspeed! Better wishes. $\endgroup$
    – Piquito
    Feb 25 '20 at 16:02

This answer extends the selected answer by finding an explicit form for the inverse mapping from $(a, b, c) \to (u, v)$. $\newcommand{\getAbc}{\mathtt{GetAbc}}$ $\newcommand{\getUv}{\mathtt{GetUv}}$ $\newcommand{\abcSet}{\mathbf{A}}$ $\newcommand{\uvSet}{\mathbf{U}}$

Finding the inverse mapping

First, let $\abcSet$ and $\uvSet$ name the sets of $(a, b, c)$ triples and $(u, v)$ pairs, respectively, each subject to the conditions already prescribed in the question (namely: all are nonnegative, mutually coprime integers, $u \ge v$, and $a \le b$). Consider the steps outlined in the question to be the definition of a function $\getAbc : \uvSet \to \abcSet$. We now use @Piquito's answer to help define a function $\getUv : \abcSet \to \uvSet$.

Beginning from a known $(a, b, c) \in \abcSet$, we define $U, V \in \mathbb R$:

$$ (U,~ V) = \left(\sqrt{\frac{c + b}{6}},~ \sqrt{\frac{c - b}{2}} \right). $$

Notice that $(U, V)$ may be irrational. It will be proven shortly, but for now, let it be stated without proof that it is always possible to "cancel out" the irrational parts of $(U, V)$ through multiplication by a common factor (which can be freely chosen to produce coprime integers). This is to say, there exists a unique $\sigma \in \mathbb R~ (\sigma > 0)$ such that $(u, v) \equiv (\sigma U, \sigma V) \in \uvSet$. With this understood, then $\getUv((a, b, c)) = (u, v)$.

Finding $\sigma$ explicitly

Now, we demonstrate that this $\sigma$ exists by finding it explicitly. Begin by defining quantities for the sum and difference, and rewrite the Diophantine equation in terms of them:

$$ (P,~ M) \equiv (c + b,~ c - b),\qquad PM = 3a^2. $$

Notice that $M$ is nonnegative (the Diophantine equation implies that $c \ge b$) and $P$ is positive ($(b, c) \ne (0, 0)$ as they must be coprime). The rewritten equation will be our primary tool for finding $\sigma$, as it tells us that any prime factor of $PM$ must appear to an even power (except for 3, which must have an odd power). Eliminate the greatest common divisor of these variables:

$$ (p,~ m) \equiv (P/h,~ M/h), \qquad h \equiv \gcd(P,~ M) > 0. $$

Decompose these reduced variables into square and squarefree parts: $\newcommand{\squarePart}[1]{s_{#1}}$ $\newcommand{\freePart}[1]{f_{#1}}$

$$ (p,~ m) = (\squarePart{p}^2 \freePart{p},~ \squarePart{m}^2 \freePart{m}). \qquad \text{($\freePart{p},\freePart{m}$ squarefree)} $$

These decompositions are unique (briefly handwaving the edge case at $0$). Because $\freePart{p}$ and $\freePart{m}$ are coprime, $\freePart{p}\freePart{m}$ is also squarefree, and so if we plug these forms back into the rewritten Diophantine equation, we find:

$$ (h\squarePart{p}\squarePart{m})^2\freePart{p}\freePart{m} = 3a^2 \quad \Longrightarrow \quad \freePart{p}\freePart{m} = 3. $$

(Note: The "implies" relationship suggested by the arrow above only applies when $a \ne 0$. However, for the unique case where this is not true, $(a, b, c) = (0, 1, 1)$, the decomposition of $m = 0$ is degenerate and we are free to write it as $m = 0^2 \cdot 3$ so that the latter equation still holds. In this case, $h=2$ and $(\freePart{p}, \freePart{m}) = (1, 3)$.)

Plugging these forms into $(U, V)$ and then applying the $\freePart{p}\freePart{m} = 3$ relation yields:

$$ (U,~ V) = \left( \squarePart{p} \sqrt{\frac{h}{6}\freePart{p}} ,~ \squarePart{m} \sqrt{\frac{h}{2}\freePart{m}} \right) = \left( \squarePart{p} \sqrt{\frac{h}{2}\frac{1}{\freePart{m}}} ,~ \squarePart{m} \sqrt{\frac{h}{2}\freePart{m}} \right) $$

The explicit form of $\sigma$ (and the resulting final values of $(u, v)$) can now be easily found to be:

$$ \sigma = \sqrt{\frac{2 \freePart{m}}{h}}, \qquad (u,~ v) = (\sigma U,~ \sigma V) = (\squarePart{p},~ \squarePart{m}\freePart{m}). $$

Validating the result

One can easily verify that $(u, v)$ are coprime, as they are factors of $(p, m)$ respectively, which were also coprime. They are also clearly nonnegative. All that remains is to show that $u \ge v$. We find that

\begin{align} \squarePart{p} \ge \squarePart{m}\freePart{m} \quad&\text{if and only if}\quad \squarePart{p}^2 \ge \squarePart{m}^2\freePart{m}^2 \\ \quad&\text{if and only if}\quad h \squarePart{p}^2 \freePart{p} \ge h \squarePart{m}^2\freePart{m}^2\freePart{p} \\ \quad&\text{if and only if}\quad P \ge 3M & \text{(using $\freePart{p}\freePart{m} = 3$)} \\ \quad&\text{if and only if}\quad 2b \ge c \\ \end{align}

This expression can be proven from the Diophantine equation and our conditions on $a$ and $b$:

\begin{align} 3a^2 + b^2 & = c^2 \\ 3b^2 + b^2 & \ge c^2 & \text{(using $b \ge a$)} \\ 4b^2 & \ge c^2 \\ 2b & \ge c \end{align}

Thus $(u, v) \in \uvSet$, which was to be shown.

Proving one-to-one correspondence

In my original question, I mentioned how I wanted to prove that a one-to-one correspondence exists. This part is not difficult, so here's the abridged version: To show that $\getUv \circ \getAbc$ is the identity function on $\uvSet$, begin computing $\getUv\!\left(\left(\frac{2uv}{g},~ \frac{3u^2 - v^2}{g},~ \frac{3u^2+v^2}{g}\right)\right)$ and you will find that

$$ (U,~ V) = \left(u g^{-1/2},~ v g^{-1 / 2}\right), $$

from which it is clear that the output will be $(u, v)$.

Likewise, to show that $\getAbc \circ \getUv$ is the identity function on $\abcSet$, begin computing $\getAbc\!\left(\left(\squarePart{p},~ \squarePart{m}\freePart{m}\right)\right)$ and you will find that

$$ \left(B,~ C\right) = \left(\frac{6}{h\freePart{p}}b,~ \frac{6}{h\freePart{p}}c\right), $$

from which it is clear that the output will be $(a, b, c)$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.