# lebesgue's identity

In the Lebesgue's identity $$a^2+b^2+c^2=d^2$$ where: $$a=m^2+n^2-p^2-q^2$$ $$b=2(mp+nq)$$ $$c=2(mq-np)$$ $$d=m^2+n^2+p^2+q^2$$how can we write $(m,n,p,q)$ as a function of the integers $(a,b,c,d)$? I have been trying and failing. Please help.

• I believe that you have exchanged the formula for $d$ and for $a$. There seems to be no beautiful formula. – PenasRaul Sep 6 '14 at 12:35
• @Martin-Blas Pere Pinilla, this is not Legendre's identity. – user97615 Sep 6 '14 at 15:22
• Not sure who first wrote this; do not see how you can solve your thing, or why you would want to; still, it is based on quaternion multiplication, see pdf at zakuski.math.utsa.edu/~kap/Forms/Pall_Automorphs_1940.pdf and related articles at zakuski.math.utsa.edu/~kap/forms.html – Will Jagy Sep 6 '14 at 16:01
• Perhaps even better would be to determine all of the two-square sums, e.g., \begin{align} d+a &= (m+n)^2 + (m-n)^2, \\ d-a &= (p+q)^2 + (p-q)^2, \\ d+b &= (m+p)^2 + (n+q)^2, \\ d-b &= (m-p)^2 + (n-q)^2, \\ d+c &= (m+q)^2 + (n-p)^2, \\ d-c &= (m-q)^2 + (n+p)^2, \end{align} and then use those to work out the functions. – Kieren MacMillan Sep 6 '14 at 20:43

Lebesgue's Identity is complete only if you add a scaling factor t. Hence,

\begin{align} a &= (m^2+n^2-p^2-q^2)t\\ b &= 2(mp+nq)t\\ c &= 2(mq-np)t\\ d &= (m^2+n^2+p^2+q^2)t \end{align}\tag{1}

As a function of the integers $a,b,c,d$, then the variables $m,n,p,q,t$ are simply,

\begin{align} m &= \frac{-b-c}{a-d}\\ n &= \frac{-b+c}{a-d}\\ p &= 1\\ q &= 1\\ t &= \tfrac{1}{4}(-a+d) \end{align}

If you substitute these into the eqns in $(1)$, for example,

$$(m^2+n^2-p^2-q^2)t-a = 0$$

then factor it, you get this result, hence is true if indeed $a^2+b^2+c^2 = d^2$. (Similarly for the 2nd, 3rd, 4th eqns.)

For the smallest solution,

$$1^2+2^2+2^2 = 3^2$$

we get $m,n,p,q,t = 2, 0, 1, 1,\tfrac{1}{2}$. And so on.

• Piezas, I was not expecting $p=q=1$. It looks more like a particular case. – user97615 Nov 10 '14 at 20:54
• It is the general case. You can test it by substituting $m,n,p,q,t$ into the four eqns of $(1)$. (I've done the first for you in WolframAlpha.) Two will be identically true, while the other two are so if $a^2+b^2+c^2 = d^2$. – Tito Piezas III Nov 10 '14 at 21:00
• Actually, $p,q$ are free variables (as long as there is no division by zero). To make the formulas more aesthetic, I decided to set $p=q=1$ without loss of generality. – Tito Piezas III Nov 10 '14 at 21:11
• If you like this kind of number theory, then you have to invest in Mathematica or Maple. Algebraic manipulation can be tedious without software, and life is short. :) – Tito Piezas III Nov 11 '14 at 3:56
• great idea :) I really appreciate your help. – user97615 Nov 11 '14 at 4:01

I may not understand the above answer but, it seems like there might not be an easy function to get all the possible values. Let's consider a simpler question:

In Euclid's identity $$a^2+b^2=c^2$$ where: $$a=m^2-n^2$$ $$b=2mn$$ $$c=m^2+n^2$$ how can we write $$(m,n)$$ as a function of the integers $$(a,b,c)$$?

If we are given any $$a,b,c$$ then we have basically been given a Pythagorean triple, the length of two legs and Hypoteneuse of a Pythagorean triangle. Let's consider the smallest such triangle, $$a=3,b=4,c=5$$. To find m and n, you basically need to find all $$m,n$$ so that the equations work. However, the equations will work for multiple $$m,n$$.

$$\begin{array} { | r r | c | c | c | c | c | c | } & & & & & a= & b= & c= \\ m & n & m^2 & 2mn & n^2 & m^2-n^2 & 2mn & m^2+n^2 \\ -2 & -1 & 4 & 4 & 1 & 3 & 4 & 5\\ 2 & 1 & 4 & 4 & 1 & 3 & 4 & 5\\ \end{array}$$

It appears to me that the original question is asking a similar question about Pythagorean Quadruples, and it seems like there will be a huge increase in possible values for $$m,n,p,q$$ since there are more opportunities for postives and negatives to create the same values in the final $$a,b,c,d$$. For example, consider if we are given $$a=245,b=10,c=70,d=255$$

$$\begin{array} { l } a=245=m^2+n^2-p^2-q^2 \\ b=10=2(mp+nq)\\ c=70=2(mq-np)\\ d=255=m^2+n^2+p^2+q^2\\ a^2+b^2+c^2=d^2\\ 245^2+10^2+70^2=255^2=65025\\ \end{array}$$

It appears there are at least 8 sets of valid values for m,n,p,q, found using a simple python program that just ran through all possible values of m,n,p,q between -16 and 16:

$$\begin{array} { | r r r r | c | c | r r | r r | } m & n & p & q & m^2+n^2 & p^2+q^2 & mp & nq & mq & np \\ -15 & 5 & -1 & -2 & 250 & 5 & 15 & -10 & 30 & -5 \\ -13 & -9 & 1 & -2 & 250 & 5 & -13 & 18 & 26 & -9 \\ -9 & 13 & -2 & -1 & 250 & 5 & 18 & -13 & 9 & -26 \\ -5 & -15 & 2 & -1 & 250 & 5 & -10 & 15 & 5 & -30 \\ 5 & 15 & -2 & 1 & 250 & 5 & -10 & 15 & 5 & -30 \\ 9 & -13 & 2 & 1 & 250 & 5 & 18 & -13 & 9 & -26 \\ 13 & 9 & -1 & 2 & 250 & 5 & -13 & 18 & 26 & -9 \\ 15 & -5 & 1 & 2 & 250 & 5 & 15 & -10 & 30 & -5 \\ \end{array}$$

Notice that $$250=m^2+n^2$$ is built from $$13^2+9^2$$ becoming $$169+81$$, but also $$15^2+5^2$$ becoming $$225+25$$. Then $$p^2+q^2$$ is always $$5$$, which is added or subtracted to created $$a=245$$ or $$d=255$$. Similar things happen with the terms for $$b$$, which always becomes $$2*5=10$$ and $$c$$, which always becomes $$2*35=70$$

This link seems somewhat relevant: https://mathoverflow.net/questions/29644/enumerating-ways-to-decompose-an-integer-into-the-sum-of-two-squares