<s>[INST] Number of integer solutions of $a^2+b^2=10c^2$ Find the number of integer solutions of the equation $a^2+b^2=10c^2$.
I can only get by inspection that $a=3m, b=m,c=m$ satisfies for any $m \in Z$.
Is there a formal logic to find all possible solutions? Any hint?
Also i tried taking $a=p^2-q^2$, $b=2pq$ and $10c^2=(p^2+q^2)^2$
which gives $$\frac{p^2+q^2}{c}=\sqrt{10}$$ which is invalid, since a rational can never be an irrational.
 [/INST] $$\color{magenta}{a=3p^2-2pq-3q^2, \quad b=-p^2-6pq+q^2, \quad c=p^2+q^2}$$
or, same thing
$$\color{green}{a=3x^2-2xy-3y^2, \quad b=-x^2-6xy+y^2, \quad c=x^2+y^2}$$
When $p,q$ are coprime, the primes that can still divide $\gcd(a,b,c)$  are $2$ and $5.$  The proof of all (primitive, integral) solutions is just showig that these don't matter.
When $x,y$ are both odd, all three of $a,b,c$ are divisible by $2,$  and we need to worry about whether half the triple is represented by the given parametrization. Well
taking
$$ p = \frac{x-y}{2} \; , \; \; q = \frac{x+y}{2} \; , \; \;  $$
$$  3 p^2 - 2pq -3q^2 = \frac{1}{2} \left( -x^2 - 6 xy + y^2 \right) $$
$$  - p^2 - 6pq +q^2 = \frac{-1}{2} \left( 3x^2 - 2 xy -3 y^2 \right) $$
$$   p^2  +q^2 = \frac{1}{2} \left( x^2 + y^2 \right) $$
$5$ is the other possibility . This happens when $$2x+y \equiv x - 2y \equiv 0 \pmod 5.$$
Taking
$$ p = \frac{2x+y}{5} \; , \; \; q = \frac{x-2y}{5} \; , \; \;  $$
$$  3 p^2 - 2pq -3q^2 = \frac{1}{5} \left( 3x^2 - 2 xy -3 y^2 \right) $$
$$  - p^2 - 6pq +q^2 = \frac{1}{5} \left( -x^2 - 6 xy + y^2 \right) $$
$$   p^2  +q^2 = \frac{1}{5} \left( x^2 + y^2 \right) $$
$$  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc     \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc $$
The example I like to show is solving
$$ 2(x^2 + y^2 + z^2) - 113(yz + zx + xy)=0,  $$ four "recipes,"
$$
\left(
\begin{array}{r}
x \\
y \\
z
\end{array}
\right) =
\left(
\begin{array}{r}
37 u^2 + 51 uv + 8 v^2 \\
8 u^2 -35 uv -6 v^2 \\
-6 u^2 +  23 uv + 37 v^2
\end{array}
\right)
$$
$$
\left(
\begin{array}{r}
x \\
y \\
z
\end{array}
\right) =
\left(
\begin{array}{r}
32 u^2 + 61 uv + 18 v^2 \\
18 u^2 -25 uv -11 v^2 \\
-11 u^2 +  3 uv + 32 v^2
\end{array}
\right)
$$
$$
\left(
\begin{array}{r}
x \\
y \\
z
\end{array}
\right) =
\left(
\begin{array}{r}
38 u^2 + 45 uv + 4 v^2 \\
4 u^2 -37 uv -3 v^2 \\
-3 u^2 +  31 uv + 38 v^2
\end{array}
\right)
$$
$$
\left(
\begin{array}{r}
x \\
y \\
z
\end{array}
\right) =
\left(
\begin{array}{r}
29 u^2 + 63 uv + 22 v^2 \\
22 u^2 -19 uv -12 v^2 \\
-12 u^2 -5 uv + 29 v^2
\end{array}
\right)
$$
For all four recipes,
$$ x^2 + y^2 + z^2 = 1469 \left( u^2 + uv + v^2  \right)^2  $$
$$  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc     \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc \bigcirc  \bigcirc $$
</s>