Solve in positive integers $x^2+3y^2=z^2$ and $x^2+y^2=5z^2$ Solve the following equations in postive integers:

*

*$x^2+3y^2=z^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!!!

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. 
