# Solving $rX_1^2+sY_1^2+tZ_1^2=rX_2^2+sY_2^2+tZ_2^2$ completely in integers

Given pairwise relatively prime integers $r,s,t$, I’m looking for a complete solution (i.e., integer parameterization or similar) for the Diophantine equation $$rX_1^2+sY_1^2+tZ_1^2=rX_2^2+sY_2^2+tZ_2^2. \tag{\bigstar}$$ I know I can collect terms on one side and apply the Bachet-Cauchy-Bezout parameterization in linear terms… but I was hoping this wheel had already been solved.

EDIT/CLARIFICATION:

Using the classical Bachet-Cauchy-Bezout complete linear solution, we can solve the equation $$r(x_1^2-x_2^2)+s(y_1^2-y_2^2)+t(z_1^2-z_2^2)=0,$$ to obtain three linear equations of the form $$sc_1+t(-b_1)+(x_2-x_1)(x_2+x_1)=0,$$ where $a_1,b_1,c_1$ are arbitrary integers. Applying the complete solution again to each of the three new equations leads to three solutions of the form \begin{align} x_1 &= \frac{(sb_2-ta_2)^2+(sc_1-tb_1)}{2(sb_2-ta_2)} &&\text{and}& x_2 &= \frac{(sb_2-ta_2)^2-(sc_1-tb_1)}{2(sb_2-ta_2)}, \end{align} where the $a_i,b_i,c_i$ are all arbitrary integers. Once equated and solved, the result would ostensibly be the complete integer parameterization of $(\bigstar)$.

$U = X_1^2 - X_2^2$, $V = Y_1^2 - Y_2^2$, $W = Z_1^2 - Z_2^2$ can be any solution of $r U + s V + t W = 0$ such that none is congruent to $2 \mod 4$. Then for any factorization $U = A B$ with $A \equiv B \mod 2$ you take $X_1 = (A+B)/2$, $X_2 = (A-B)/2$ etc.

For help: $$\left( {{r}_{4}^{2}}s+{{r}_{3}^{2}}n+{{r}_{1}^{2}}m+{{r}_{2}^{2}}k\right) \,\left( s\,{{t}^{2}}+n\,{{p}^{2}}+{{h}^{2}}m+{{b}^{2}}k\right) =$$ $${{\left( {{r}_{4}}st+{{r}_{3}}np+{{r}_{1}}hm+{{r}_{2}}bk\right) }^{2}}+ns\,{{\left( {{r}_{3}}t-{{r}_{4}}p\right) }^{2}}+ks\,{{\left( {{r}_{2}}t-{{r}_{4}}b\right) }^{2}}+$$ $$ms\,{{\left( {{r}_{1}}t-{{r}_{4}}h\right) }^{2}}+kn\,{{\left( {{r}_{2}}p-{{r}_{3}}b\right) }^{2}}+mn\,{{\left( {{r}_{1}}p-{{r}_{3}}h\right) }^{2}}+{{\left( {{r}_{2}}h-{{r}_{1}}b\right) }^{2}}km$$ Result: $$n\,{{\left( {{r}_{3}}t+{{r}_{1}}hm+{{r}_{2}}bk\right) }^{2}}+k\,{{\left( {{r}_{2}}t-{{r}_{3}}bn\right) }^{2}}+m\,{{\left( {{r}_{1}}t-{{r}_{3}}hn\right) }^{2}}=$$ $$n\,{{\left( {{r}_{3}}t-{{r}_{1}}hm-{{r}_{2}}bk\right) }^{2}}+k\,{{\left( {{r}_{2}}t+{{r}_{3}}bn\right) }^{2}}+m\,{{\left( {{r}_{1}}t+{{r}_{3}}hn\right) }^{2}}$$

• Oh! That might be helpful… Thanks! May 17, 2016 at 15:10

For the equation.

$$rX_1^2+sY_1^2+tZ_1^2=rX_2^2+sY_2^2+tZ_2^2$$

You can write the solution in this form.

$$X_1=r(e-k)^2+s(n-p)(n+p-2k)+t(j-u)(j+u-2k)$$

$$X_2=r(e-k)^2-s(n-p)(n+p-2e)-t(j-u)(j+u-2e)$$

$$Y_1=s(n-p)^2+r(e-k)(e+k-2p)+t(j-u)(j+u-2p)$$

$$Y_2=s(n-p)^2-r(e-k)(e+k-2n)-t(j-u)(j+u-2n)$$

$$Z_1=t(j-u)^2+r(e-k)(e+k-2u)+s(n-p)(n+p-2u)$$

$$Z_2=t(j-u)^2-r(e-k)(e+k-2j)-s(n-p)(n+p-2j)$$

Such a record is better because allows to solve the symmetrical equation with any number of summands. It is only necessary to increase the number of parameters.