# 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 .

• @NickLiu $0\notin\mathbb{N}$ Jan 8, 2017 at 15:52
• Yes @Nick Liu c should be natural Jan 8, 2017 at 15:52
• Given a positive integer $N$ there is an integral solution of $X^2 + Y^2 + Z^2 = N$ as long as $N$ is not of the form $4^\alpha(8\beta - 1)$. Since no perfect square is of that form, then you can choose $d\in \mathbb{N}$ and $a,b,c$ the solution of $X^2 + Y^2 + Z^2 = d^2$. Some of the values might be $0$ tho. Jan 8, 2017 at 15:57
• $$a=2pk$$ $$b=2sk$$ $$c=p^2+s^2-k^2$$ $$d=p^2+s^2+k^2$$ Jan 8, 2017 at 15:57
• Possible duplicate of this.
– user170039
Jan 8, 2017 at 17:14

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
?

• @IanMiller "But I want another infinite sets and how to reach them because I have found my solution by hit and trial ." This question gives a recipe for finding infinitely many disjoint infinite families of solutions which form a partition of the full set of solutions. Jan 8, 2017 at 16:45
• @IanMiller for every $(m, n, p, q)$ you get a solution $(a, b, c, d)$ using the parametrization in the answer. Note that when $p = n = 0$, we have the usual parametrization for primitive Pythagorean triples Jan 8, 2017 at 16:54
• Sorry. I typoed when I was trying it. Very sorry. Removing my stupid comments. Jan 8, 2017 at 17:09

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}.$$

As you noticed, given a solution you can multiply it by any natural greater than $1$ to get another solution, so we can concentrate on solutions that do not have a common divisor. You can just keep finding solutions by hand. A more systematic approach is to write $a^2+b^2=d^2-c^2=(d+c)(d-c)$ The two terms on the right are either both odd or both even. You can just choose $a,b$ with one odd and one even and $a \gt b$, then factor $a^2+b^2$. So $a=4,b=1$ gives $d+c=17, d-c=1$ and you can solve the equations to get $d=9,c=8$ and a new solution is $4,1,8,9$. You can always use the factor with $1$ giving $a,b,\frac 12(a^2+b^2-1),\frac12(a^2+b^2+1)$ as a fundamental solution whenever $a,b$ are of opposite parity. If $a^2+b^2$ is not prime or the square of a prime there will be other solutions. So for $a=8, b=1$ we have $a^2+b^2=65=5 \cdot 13$, and we find $8,1,4,9$ as a solution.So $a=4,b=1$ gives $d+c=17, d-c=1$ and you can solve the equations to get $d=9,c=8$. Unfortunately here it give a permutation of the solution we already have. If we choose $a=9,b=2$ we get $a^2+b^2=85=5 \cdot 17$ and find the solution $9,2,6,11$ as well as $9,2,42,43$

• Impressed with the last two lines Jan 8, 2017 at 16:00
• But d will be fractional if a & b are of opposite parity@rossmilikan Jan 8, 2017 at 16:02
• @AtulMishra: I missed the $\pm1$ that makes them integral. Still working a bit. Jan 8, 2017 at 16:13