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

I’m looking for how to solve the equation $a^2+3b^2=c^2$ where $a,b,c$ are integers and $b$ is even, I’m looking for the algorithm used to solve this kind of equations, not just the solution.


Solutions Collecting From Web of "Solving $a^2+3b^2=c^2$"

The argument below is much like the argument for generating the Pythagorean triples, and the answer is structurally very similar. There is the trivial solution $(0,0,0)$.

We now will look for solutions with $a$ and $c$ relatively prime. The other solutions can then be obtained by multiplying by an integer scaling factor.

Rewrite our equation as $3b^2=c^2-a^2=(c-a)(c+a)$. Note that $a$ cannot be even. For if $a$ is even, then by relative primality $b$ is odd, and therefore $a^2+3b^2$ is of the form $4k+3$. But $c^2$ cannot be of that form.

It follows that the
gcd of $c-a$ and $c+a$ is $2$ or $1$. Since $3$ divides $(c-a)(c+a)$, we get that $3$ divides $c-a$ or $3$ divides $c+a$. By changing the sign of $a$ if necessary, we can assume that $3$ divides $c+a$.

We first deal with the case where $c-a$ and $c+a$ are both even. In that case, we have $c-a=\pm2 s^2$ and $c+a=\pm 6t^2$ for some non-negative (and relatively prime, of opposite parity) integers $s$ and $t$.
If we are looking for non-negative solutions, then solving for $c$ and $a$ we get
$c=3t^2+s^2$, $a=|3t^2-s^2|$, and therefore $b=2st$. And of course we can change signs at will.

Finally, we deal with the case $c-a$ and $c+a$ both odd. Then $c-a=s^2$ and $c+a=3t^2$ for odd $s$ and $t$. Again, solve for $c$ and $a$.

Another way to think about such problems is to convert this to
and then think about rational points (both coordinates rational) on the curve
One obvious point is $(1,0)$. Let us consider a line that passes through this point $y=m(x-1)$ with rational slope $m$. Observe that all the points of intersection of this line and the curve (given above) will be rational. To find the intersection we solve
This is equivalent to
Since one of the roots of this equation has to be $x=1$ (our trivial rational point) so the other root will be
Thus we obtain the following point as the other point of intersection:
$$\left(\frac{3m^2-1}{3m^2+1}, \, \frac{-2m}{3m^2+1}\right).$$

So if we take $a=3m^2-1, b=-2m$ and $c=3m^2+1$ (with $m \in \mathbb{Z}$) then we can obtain integer solutions to the equation $a^2+3b^2=c^2$.

More generally, if we take $m=\frac{r}{s}$ (with $r,s \in \mathbb{Z}$ and $s \neq 0$) then we can have $a=3r^2-s^2, b=-2rs$ and $c=3r^2+s^2$ as the solutions.

Here are stubborn! There is a formula framed and immediately the answer! What is the problem?

In this equation:


After substituting in the formula of the solution obtained:




And more:




And more:




$p,s$ – integers of any sign.

To obtain a primitive solutions may be necessary to divide all the numbers on common divisor.