# Solve in positive integers

Solve the following equations in postivie integers:

1) $x^2+3y^2=z^2$

2) $x^2+y^2=5z^2$

I have solved them using this as a reference, but I am interested in other solutions, more "elegant" ones. The equations are to be solved separate!!!

• I don't see how there can be any non-trivial solution. If you subtract the two equations, you get 2y^2 = -4z^2. There can be no solution without making y or z imaginary, so only x=y=z=0 remains. – Aganju Jan 21 '16 at 1:04
• @Aganju I expect that this is two separate questions bundled together, not a simultaneous system. – T. Bongers Jan 21 '16 at 1:05
• Sorry for the confusion, I edited it – HeatTheIce Jan 21 '16 at 1:05
• The complete primitive solution to $x^2+dy^2= z^2$ is given by $(p^2-dq^2)^2+d(2pq)^2 = (p^2+dq^2)^2$. However, the one for $x^2+y^2 = dz^2$ needs an initial solution. – Tito Piezas III Jan 21 '16 at 1:17
• @WillJagy: Ah, I stand corrected. The complete rational parameterization is $(p^2-dq^2)^2r^2+d(2pqr)^2=(p^2+dq^2)^2r^2$. I should not have dismissed the scaling factor $r$. – Tito Piezas III Jan 21 '16 at 4:16

In general, given one solution to,

$$a_1y_1^2+a_2y_2^2+\dots+ a_ny_n^2 = 0$$

then an infinite more can be found without scaling. For example,

$n=3$

$$ax_1^2+bx_2^2+cx_3^2 = (ay_1^2+by_2^2+cy_3^2)(az_1^2+bz_2^2+cz_3^2)^2$$

where,

$$x_1, x_2, x_3 = uy_1-vz_1,\; uy_2-vz_2,\; uy_3-vz_3\\ \text{and}\\ u,v = az_1^2+bz_2^2+cz_3^2,\; 2(ay_1z_1+by_2z_2+cy_3z_3)$$

If you have an initial solution $ay_1^2+by_2^2+cy_3^2 = 0$, then the identity gives you an infinite more with three free variables $z_1, z_2, z_3$.

$n=4$

$$ax_1^2+bx_2^2+cx_3^2+dx_4^2 = (ay_1^2+by_2^2+cy_3^2+dy_4^2)(az_1^2+bz_2^2+cz_3^2+dz_4^2)^2$$

where,

$$x_1, x_2, x_3, x_4 = uy_1-vz_1,\; uy_2-vz_2,\; uy_3-vz_3,\; uy_4-vz_4\\ \text{and}\\ u,v = az_1^2+bz_2^2+cz_3^2+dz_4^2,\; 2(ay_1z_1+by_2z_2+cy_3z_3+dy_4z_4)$$

Likewise, you now have four free variables $z_1, z_2, z_3, z_4$.

And so on for any $n$. I trust the pattern is easy to see?

Example:

For $x^2+y^2 = 5z^2$, we have $a,b,c = 1,1,-5$, and initial solution $y_1, y_2, y_3 = 1,2,1$. Using the formula, we get,

$$x = z_1^2 + z_2^2 - 5 z_3^2 - 2 z_1 (z_1 + 2 z_2 - 5 z_3)\\ y = 2 ( z_1^2 + z_2^2 - 5 z_3^2) - 2 z_2(z_1 + 2 z_2 - 5 z_3)\\ z = z_1^2 + z_2^2 - 5 z_3^2 - 2 z_3(z_1 + 2 z_2 - 5 z_3)$$

for three free variables $z_i$. Let, $z_2 = u + 2 v + 2 z_1,\; z_3 = v + z_1$, then $z_1$ cancels out and we recover W. Jagy's version in the other answer.

• I like the solution of yours. It is indeed one way to generate solutions to the equation I gave, but I should also have a proof that those are maybe the only solutions to it, bcs I am interested in all solutions – HeatTheIce Jan 22 '16 at 13:56
• @HeatTheIce: I'm not completely sure, but I assume the three degrees of freedom $z_1, z_2, z_3$ are enough to cover all solutions $x,y,z$ if one takes into account sign changes and the permutations $x,y$ and $y,x$. I edited to give an example. – Tito Piezas III Jan 22 '16 at 14:30

People are not careful with these. With $x^2 + 3 y^2 = z^2;$ with odd $z,$ we indeed get $$(r^2 - 3 s^2)^2 + 3(2rs)^2 = (r^2 + 3 s^2)^2.$$ This does not give primitive solutions with even $z,$ which come from $$\left( \frac{r^2 - 3 s^2}{2} \right)^2 + 3 (rs)^2 = \left( \frac{r^2 + 3 s^2}{2} \right)^2$$ with both $r,s$ odd

For $x^2 + y^2 = 5 z^2$ primitive means $z$ odd, we take $x$ to be the even one. $$(2u^2 - 2 u v - 2 v^2)^2 + (u^2 + 4 uv - v^2)^2 = 5 (u^2 + v^2)^2$$