Solutions for $a^2+b^2+c^2=d^2$

I have to find an infinite set for $a,b,c,d$ such that $a^2+b^2+c^2=d^2$ and $a,b,c,d\in\mathbb N$

I have found one possible set which is $x,2x,2x,3x$ and $x\in\mathbb N$

But I want another infinite sets and how to reach them because I have found my solution by hit and trial .


There is a parametrization of all primitive soutions, $\gcd(a,b,c,d)=1.$ Take any four integers $m,n,p,q$ with $\gcd(m,n,p,q)=1$ and $m+n+p+q$ odd. Those are the only rules. Then $$ a = m^2 + n^2 - p^2 - q^2, $$ $$ b = 2 (mq+np), $$ $$ c = 2(nq -mp), $$ $$ d = m^2 + n^2 + p^2 + q^2 $$ satisfy $$ a^2 + b^2 + c^2 = d^2. $$ This is simply quaternion multiplication. It seems likely that the formula was known to Euler, who wrote out the multiplication formula for sums of four squares, which amounts to quaternion multiplication. However, people mostly mention this item as due to the number theorist V. A. Lebesgue in the mid 1800's. Apparently the first correct proof that this gives all primitive solutions was Dickson in 1920, so I am not sure what Lebesgue did.

gp-pari

? a = m^2 + n^2 - p^2 - q^2
%6 = m^2 + (n^2 + (-p^2 - q^2))
? b = 2 *( m * q + n * p)
%7 = 2*q*m + 2*p*n
? c = 2 * ( n * q - m * p)
%8 = -2*p*m + 2*q*n
? d = m^2 + n^2 + p^2 + q^2
%9 = m^2 + (n^2 + (p^2 + q^2))
? a^2 + b^2 + c^2 - d^2
%10 = 0
? 

I'll give one obvious example that I found, and that is


If $$p^2+q^2=2rs\tag1$$ Then$$(p+q)^2+(p-q)^2+(r-s)^2=(r+s)^2\tag2$$


For example, if $(p,q,r,s)=(4,2,5,2)$, then$$6^2+2^2+3^2=7^2\tag3$$


Interestingly enough, Euler did the same work for these sums of squares and he gave an explicit formula. $$(m^2+n^2-p^2-q^2)^2+4(mq+np)^2+4(nq-mp)^2=(m^2+n^2+p^2+q^2)^2\tag4$$ For arbitrary $m,n,p,q\in\mathbb{Z}$.


Neater solution. (not obvious where I got formula from)

Note that: $(b^2-a^2)^2+(2ab)^2+(2cd)^2-(c^2+d^2)^2=(a^2+b^2+c^2-d^2)(a^2+b^2-c^2+d^2)$.

So if you have a solution $(a,b,c,d)$ to $a^2+b^2+c^2-d^2=0$ then another solution is:

$$\bigg(b^2-a^2,2ab,2cd,c^2+d^2\bigg)$$

Applying this to your solution $(1,2,2,3)$ gives $(3,4,12,13)$.

Note the order of terms could be juggled around for further applications of this. The only requirement is that $b>a$.

$(3,4,12,13)$ becomes $(24,12,313)$.

$(3,12,4,13)$ becomes $(35,72,104,185)$.

$(4,12,3,13)$ becomes $(128,96,78,178)$.

Ugly Solution. (more obvious where formula comes from)

Pythagoras's theorem is a related problem only involving three terms: $a^2+b^2=c^2$. It has a fundamental solution of $x^2-y^2, 2xy, x^2+y^2$. We can built upon this.

If we tackle your problem $a^2+b^2+c^2=d^2$ then we can start with $a^2+b^2=(x^2-y^2)^2, c=2xy, d=x^2+y^2$. Note that solving $a^2+b^2=(x^2-y^2)^2$ is another case of Pythagoras: $a=k^2-l^2, b=2kl, x^2-y^2=k^2+l^2$. Note that $x^2-y^2=k^2+l^2$ is the same as your original equation to which you have a solution so we can build another from there: $x=3,k=2,l=1,y=2$ (Note we need $k>l$).

So with $k=2,l=1,y=2,x=3$ then we get $a=3,b=4,c=12,d=13$ giving $3^2+4^2+12^2=13^2$.

So in general if you have a solution $(a,b,c,d)$ (with $a<b$) you can form a new solution: $(b^2-a^2,2ab,2cd,c^2+d^2)$.


It is well known that the identity $(2n)^2+(n^2-1)^2=(n^2+1)^2$ produces a class of Pythagorean Triples. We can apply the same algorithm twice by replacing $n\to n^2+1$, as $$\color{Green}{(4n)^2+(2(n^2-1))^2+((n^2+1)^2-1)^2=((n^2+1)^2+1)^2}\,\,\,\,\forall n\in\Bbb{N}.$$ In fact this solution has an interesting property which does not holds for others :)
Also there is another similar identity which looks rather simple, $$\color{red}{n^2+(n+1)^2+(n^2+n)^2=(n^2+n+1)^2}\,\,\,\,\forall n\in\Bbb{N}.$$