Finding Pythagorean triple where the squares of sides are weighted Suppose $a, b, c \in \mathbb{Z}_{>0}$. The following is a variation of a Pythagorean triple, but with weighted squares:
$$a^2 + 3 b^2 = 4 c^2$$
Can I find something like Euclid's formula that can generate all solutions for this formula? I'm not sure how to approach this problem.
 A: After discovering Find all integers satisfying $m^2=n_1^2+n_1n_2+n_2^2$, the paper Abdelalim, S., & Dyani, H. (2014). The Solution of the Diophantine Equation x2+ 3y2= z2. International Journal of Algebra, 8(15), 729–732. gives an easy answer:
Theorem 2.1 Let $E : x^2 + 3 y^2 = z^2$ diophantine equation and $(x, y, z) \in \mathbb{Z}^3$ with $x \wedge y = 1$, $y$ is even and $x z \wedge 3 = 1$. Then the following properties are equivalent:

*

*$(x, y, z)$ is the solution of $E$.

*$| z | = 3 y_1^2 + y_2^2, | x | = 3 y_1^2 - y_2^2, | y | = 2 y_1 y_2$ with $y_1 \wedge y_2 = 1$.

Theorem 2.2 Let $E : x^2 + 3 y^2 = z^2$ diophantine equation and $(x, y, z) \in \mathbb{Z}^3$ with $x \wedge y = 1$, $y$ is odd and $x z \wedge 3 = 1$. Then the following properties are equivalent:

*

*$(x, y, z)$ is the solution of $E$.

*$| z | = \frac{3 y_1^2 + y_2^2}{2}, | x | = \frac{3 y_1^2 - y_2^2}{2},
  | y | = y_1 y_2$ with $y_1 \wedge y_2 = 1$.

Scaling the above primitive solutions $(x, y, z)$, and in our case restricting to $2 \mid z$, gives all solutions.

The following is a method that is less explicit, as it requires dividing by a $\gcd$.
Thanks to Daniel Hast's comment, I arrived at the following:
Finding such $(a, b)$ is equivalent to finding a single rational point on the ellipse $x^2 + 3 y^2 = 4$, then finding all rational lines through it. A rational point is $(1, 1)$, and a rational line through that is $t y = s x - s + t$ where $\gcd (s, t) = 1$. The other intersection with the ellipse is at:
$$ (x, y) = \left( \frac{3 s^2 - 6 s t - t^2}{3 s^2 + t^2}, - \frac{3 s^2 + 2 s t - t^2}{3 s^2 + t^2} \right) $$
So:
$$ \begin{array}{rll}
 \left( \frac{3 s^2 - 6 s t - t^2}{3 s^2 + t^2} \right)^2 + 3 \left(
 \frac{3 s^2 + 2 s t - t^2}{3 s^2 + t^2} \right)^2 & = & 4\\
 (3 s^2 - 6 s t - t^2)^2 + 3 (3 s^2 + 2 s t - t^2)^2 & = & 4 (3 s^2 +
 t^2)^2\\
 4 (3 s^2 + t^2)^2 - 3 (3 s^2 + 2 s t - t^2)^2 & = & (3 s^2 - 6 s t -
 t^2)^2
\end{array} $$
Note that the numerator and denominators of $x, y$ can be scaled while the
rational point stays the same. Let $d
= \gcd (3 s^2 + t^2, 3 s^2 + 2 s t - t^2)$. For $k \in \mathbb{Z}$, our
solutions are then:
$$ a = \frac{k}{d} \cdot (3 s^2 + 2 s t - t^2) \quad b = \frac{k}{d} \cdot (3 s^2 + t^2) $$
A: As I said in the comment, one needs to verify that no other solutions exist but the found ones. I do not have the time now to verify this (or possibly I might not able to do that anyway), but I want to share my modified pair of Euclid's formula for your case:
$a = 2(m^2 - 3n^2)$
$b = 4mn$
$c = m^2 + 3n^2$
or
$a = 2(3m^2 - n^2)$
$b = 4mn$
$c = 3m^2 + n^2$

Update:
Addressing the comment below: a trivial solution is when
$a = b = c$

Update 2:
Further addressing the comment about $(a, b, c) = (1, 1, 1)$:
if $(a, b, c)$ is a solution of $a^2 + 3 b^2 = 4 c^2$ and all elements in the triplet are even, then dividing all of them by 2 is also a solution, i.e. with
$a = 2a'$
$b = 2b'$
$c = 2c'$
we have
$(2a')^2 + 3(2b')^2 = 4(2c')^2$
$4a'^2 + 3*4b'^2 = 4*4c'^2$
$a'^2 + 3b'^2 = 4c'^2$
so we get the original statement, just with $(a', b', c')$ which therefore is a solution triplet, and this reduction can continue until one element becomes odd.
(And this can be done with any common divisors of all elements, until arriving to a $gcd$ of 1. And with the same logic, if a triplet is a solution, multiplying all elements with the same number is also a solution - so only coprime triplets we should be looking for, but I leave this condition out.)
Now if we set $m = n$ in my second triplet definition above we get
$a = 2(3m^2 - n^2) = 4m^2$
$b = 4mn = 4m^2$
$c = 3m^2 + n^2 = 4m^2$
i.e. we have $a = b = c$. Now setting $m = 1$ we get a solution triplet of $(4, 4, 4)$, and based on the above $(2, 2, 2)$ and $(1, 1, 1)$ are also solutions.
I still can not verify what solution triplets this system is not covering.

Update 3:
In case in any doubt that the solutions so far do not cover all solutions, I pedantically collected and compared them.
First of all, in individ's answer the two systems are equivalent, by substituting $(p + s)$ for $p$ in the second system. The second system as it is now is equivalent with the OP's result with the method of finding rational points on the ellipse (though now it is incorrectly shown, as $a$ and $b$ in the question correspond to a factors of $1$ and $3$, respectively, so $a = \frac{k}{d} \cdot (3 s^2 - 6 s t - t^2)$ and $b = \frac{k}{d} \cdot (3 s^2 + 2 s t - t^2)$ and $c = \frac{k}{d} \cdot (3 s^2 + t^2)$) with the reduction/extension factor of $\frac{k}{d}$ added.
My second system's definiton of $c$ is similar, while $a$ and $b$ are not:
$a = 2(3m^2 - n^2)$
$b = 4mn$
$c = 3m^2 + n^2$
With this system one solution triplet is $(94, 16, 49)$, whose elements are relative primes.
Using $k = d = 1$ with the other answers' system, we see that if we wanted to get the triplet $(94, 16, 49)$, we can use the same values $(m, n)$ that generated the last element as the definition is the same, and these are those values: $(s, t) \in \{(4, 1), (-4, 1), (-4, -1), (4, -1)\}$. Calculating $a$'s and $b$'s for that system we get the following values for each $(s, t)$:
\begin{array}{c|c|c|c|c}
{} & {(4, 1)} & {(-4, 1)}
& {(-4, -1)} & {(4, -1)}\\\hline
a & 23 & 71 & 23 & 71 \\\hline
b & 55 & 39 & 55 & 39
\end{array}
As we see, the $(94, 16, 49)$ triplet can not be generated by any $(s, t)$ that gives $49$ as the last element. I wanted to prove that even if we do not set $k = d = 1$ that system can not generate this triplet when I recognised that the answers are lacking the absoulte value in the definitions, however that is valid as all are squared and that might add otherwise not producible triplets to the soution set. I stop the investigation at this point. The problem with those answers is at the moment, that with a lack of proof/theorem which shows how to find all solutions, all identities leaves one with "good luck finding that or a counterexample".
Finally, the paper linked by the OP's answer can generate both $(94, 16, 49)$ and $(71, 39, 49)$, but also lacks the previously mentioned proof/theorem of full coverage, as I commented so.
A: Given Euclid's formula $ \quad A=m^2-k^2,\quad B=2mk,\quad C=m^2+k^2\quad$ we can adapt it to yours where
$$(2mk)^2=3B^2\implies 2mk=\sqrt{3}B\implies B=\frac{2mk}{\sqrt{3}}$$
$$(m^2+k^2)^2=4C^2\implies (m^2+k^2)=2C\implies C=\frac{m^2+k^2}{2}$$
None of the  $B$-values or $C$-values will be integers for primitive triples and $B$ will not even be rational unless $A=B=C=1$. That triple cannot be generated by the formula using integers $(m,k)$.
A: For the Diophantine equation in general form.
$$aX^2+bY^2=(a+b)Z^2$$
You can record the parameterization of solutions.
$$X=bp^2-(a+b)s^2$$
$$Y=bp^2+2(a+b)ps+(a+b)s^2$$
$$Z=b(p+s)^2+as^2$$
Or in the form that is given in another answer...
$$X=bp^2-2bps-as^2$$
$$Y=bp^2+2aps-as^2$$
$$Z=bp^2+as^2$$
