What is the solution of the equation $x^2+y^2+z^2+t^2=w^2$ in polynomials over C ("Pythagorean 5-tuples")? 


There are simple formulas describing Pythagorean n-tuples for n=3,4,6:


* n=3. The formula for solutions of $x^2+y^2=z^2$ [4]:


$x=d(p^2−q^2)$,


$y=2dpq$, 


$z=d(p^2+q^2),$


where p,q,d are arbitrary polynomials. 


* n=4. Similarly, all Pythagorean 4-tuples of polynomials are given by the identity [4, Theorem 2.2], [3, Theorem 7.1]:


$(p^2+q^2-r^2-s^2)^2+(2pr+2qs)^2+(2ps-2qr)^2=(p^2+q^2+r^2+s^2)^2$


* n=6. The following identity produces Pythagorean 6-tuples [3, Theorem 7.2]:


$(m^2-n^2)^2+(2mn)^2+(2(n\_0m\_1-m\_1n\_0+m\_3n\_2-m\_2n\_3))^2+$


$(2(n\_0m\_2-m\_2n\_0+m\_1n\_3-m\_3n\_1))^2+$


$(2(n\_0m\_3-m\_3n\_0+m\_2n\_1-m\_1n\_2))^2=(m^2+n^2)^2$


where $m=(m\_1,m\_2,m\_3,m\_4)$, $n=(n\_1,n\_2,n\_3,n\_4)$, and $mn$ is the usual scalar product.


These identities are somehow related to sl(2,R), sl(2,C), sl(2,H), but the case n=5 is missing in this description [3, Theorems 7.1 and 7.2]. 


The above formuli describe also Pythagorean n-tuples of *integers*. There are another descriptions of those; see [2] and [5, Chapter 5] for n<10, [6] for n<15, [1, Theorem 1 in Chapter 3] for arbitrary n, and also the answers below. 


There are reasons to believe that Pythagorean 5-tuples cannot be described by a single polynomial identity. Thus identities producing a "large" set of solutions are also of interest, like 
$(-p^2+q^2+r^2+s^2)^2+(2pq)^2+(2pr)^2+(2ps)^2=(p^2+q^2+r^2+s^2)^2$


This identity does not give all solutions because it produces only reducible polynomials y,z,t (once p,q,r,s are nonconstant). Examples of solutions which cannot be obtained by the approaches in the answers below are also interesting.


Given a solution (x,y,z,t,w), methods to construct a new solution (x',y',z',t',w') are also of interest. For instance, 


$x'=w+y+z$,


$y'=w+z+x$,


$z'=w+x+y$,


$t'=t$,


$w'=2w+x+y+z$


[see the answer of Ken Fan below for generalizations to other n] or


$x'+iy'+jz'+kt'=q(x+iy+jz+kt)q$,


where $q$ is arbitrary polynomial with quaternionic coefficients [see the answer of Geoff Robinson below].


--


[1] L.J. Mordell, Diophantine Equations, Academic Press, London, 1969


[2] D. Cass, P.J. Arpaia, MATRIX GENERATION OF PYTHAGOREAN n-TUPLES, Proc. AMS 109:1 (1990), 1-7


[3] J. Kocik, Clifford Algebras and Euclid’s Parametrization of Pythagorean Triples, Adv. Appl. Clifford Alg. 17:1 (2007), 71-93 


[4] R. Dietz, J. Hoschek and B. Juttler, An algebraic approach to curves and surfaces on the sphere
and on other quadrics, Computer Aided Geom. Design 10 (1993) 211-229


[5] V. Kac, Infinite-Dimensional Lie Algebras (3rd edn. ed.), CUP, 1990


[6] E. Vinberg, The groups of units of certain quadratic forms (Russian), Mat. Sbornik (N.S.) 87(129) (1972), 18–36 



Pythagorean 5-tuples
One way to generate integer solutions is as follows: Let $ v = (p + qi + rj + sk)$, where $p,q,r,s$
are rational integers and $\{1,i,j,k\}$ is the usual $\mathbb{R}$-basis for the algebra of quaternions. Let $v^{\prime}= (p -qi -rj - sk)$ and 
$w = vv^{\prime} = (p^{2}+q^{2}+r^{2}+s^{2}).$ 
If we expand $v^{2}$ in the form $x + yi + zj +tk$ for integers $x,y,z,t$, then we do
have $x^{2} + y^{2} + z^{2} + t^{2} = w^{2}$. This is somewhat analogous to generating 
the Pythagorean triple $(x^{2}-y^{2})^{2}$ + $(2xy)^{2}$ = $(x^{2}+y^{2})^{2}$ by taking 
$({\rm Re}(x+iy)^{2})^{2} + ({\rm Im}(x+iy)^{2})^{2} = (x^{2}+y^{2})^{2}$. It may be
better to work with Hurwitz quaternions for this question. 


Answer extended following the answer of Alex qubeat below, and slight rephrasing of the
original question to place more emphasis on polynomials: At least in the context
of polynomials in $\mathbb{R}[u]$ (it is easy to run out of letters in this game, so $u$
denotes an indeterminate here), more solutions may be manufactured using the fact that the
solutions to $x(u)^{2} +y(u)^{2} + z(u)^{2} + t(u)^{2} = w(u)^{2}$ with 
$x(u),y(u),z(u),t(u),w(u) \in \mathbb{R}[u]$ have a semigroup structure.
Alex's answer combines a fixed solution with an essentially ``constant" solution, to produce 
other solutions, but solutions can be combined in other ways. Let $\mathbb{H}$ denote the algebra of real quaternions. Then the map $N: \mathbb{H}[u] \to \mathbb{R}[u]$ with 
$N(x(u) +iy(u)+jz(u) + kt(u)) =x(u)^{2} +y(u)^{2} + z(u)^{2} +t(u)^{2}$ (for real polynomials
$x(u),y(u),z(u),t(u))$ is multiplicative. The polynomials $p(u) \in \mathbb{H}[u]$ such 
that $N(p(u))$ is a non-zero square in $\mathbb{R}[u]$ are closed under multiplication.


As in the integral case, one way to ensure that $N(x(u) + iy(u) + jz(u) + kt(u))$ is
a square is to take $x(u) + iy(u) +jz(u)+kt(u)$ to be of the form $(a(u)+ib(u)+jc(u)+kd(u))^{2}$
for real polynomials $a(u),b(u),c(u),d(u)$, but it is also clear from this discussion
that $N(p\_{1}(u)p\_{2}(u) \ldots p\_{n}(u))$ is a square in $\mathbb{R}[u]$ as long 
as any given $p\_{i}(u)\in \mathbb{H}[u]$ occurs an even number of times in the (non-commuting) product. In fact, it is permissible to count the total number of occurences of $\mathbb{H}$-conjugates of any given $p\_{i}(u)$, that is elements of the form $v^{-1}p\_{i}(u)v$, where $v$ is a non-zero element of $\mathbb{H}$, since $N$ takes a constant value on the $\mathbb{H}^{\times}$-conjugacy class of $p\_{i}(u)$.




---


Further remarks. May 6: The polynomial ring $\mathbb{H}[u]$ has a natural division ring of fractions,
$\mathbb{H}(u)$, which is isomorphic to a certain ring of $2 \times 2$ matrices over $\mathbb{C}(u)$
(I can't get the latex right for matrices, but the ring should be clear- in particular, 
the determinants of elements in the ring are elements of $\mathbb{R}(u)$). There is a natural
ring homomorphism $\sigma$ from $\mathbb{H}(u)$ to ${\rm SO}(3,\mathbb{R}(u))$, obtained by letting
$\mathbb{H}(u) \backslash \{0\}$ act by conjugation of the $\mathbb{R}(u)$-span of $\{i,j,k\}.$


The question about polynomials amounts to determining $S\sigma$, where $S$ is the set of elements
of $\mathbb{H}(u)$ whose determinants are squares in $\mathbb{R}(u)$. This is the same as
$T\sigma$, where $T$ is the set of elements of determinant $1$, since the non-zero elements
of $\mathbb{R}(u)$ acts trivially by conjugation on $\mathbb{H}(u)$. Now it is clear
that $T\sigma$ is a normal subgroup of ${\rm SO}(3,\mathbb{R})$, and that the factor
group is an elementary Abelian $2$-group (that is, an Abelian
group of exponent $2$). I do not see at present how to calculate the size of this group,
but record this line of thinking in case anyone else can exploit it further.




---


More remarks, May 13: I think that $\mathbb{H}(u)$ has an involutory automorphism $\sigma$
which fixes $\mathbb{R}(u)$ elementwise, and which has $i \sigma = -i$,$j\sigma = k$ and 
$k\sigma =j.$ Then $N(p(u)\sigma) = N(p(u))$ for all $p(u) \in \mathbb{H}(u)$.
Hence, for any $p(u) \in \mathbb{H}(u)$, the element $q(u) = p(u).p(u)\sigma$
will have $N(q(u)) =w(u)^{2}$ for some $w(u) \in \mathbb{R}(u)$, so this will yield
a new type of solution (at least in the context of this answer).


