Respected Mathematicians, I would like to prepare a function, which will generate Pythagorean quadruples (a, b, c, d) = $d^2$ = $a^2$ + $b^2$ + $c^2$...-> (1). How far I am correct I don't know. For some set of integers a and b, consider $a^2$ + $b^2$ = m and d = c + ε. Now by (1), c = (m - $ε^2$)/2ε)....>(2) Now I will discuss the generation of such quadruples.

For a is even and b is odd or b is even and a is odd; (1) Let us take a = 12 and b = 15 then m = 369 = $3^2$ X 41 then ε = 1, $3^2$ but ε = 41 is not possible as $ε^2$ > m. Now for c = 184 and d = 185 for ε = 1; for c = 16 and d = 25 when $3^2$ = ε; So the primitive quadruples for a = 12 and b = 15 are (12, 15, 184, 185) and also (12, 15, 16, 25).

(2) For a = 2 X 3 X 5 X 7 = 210 and b = $3^3$ X 5 = 135 then m = $3^2$ X $5^2$ X 277 = 62325 then ε = 1, $3^2$, $5^2$, $3^2$ X $5^2$. Other combination of ε are not possible due to $ε^2$ > m.

If I am correct with the cited examples, let me know the generalization of the Pythagorean quadruples.

Note: I considered a and b have common factors $p_1$, ...$p_n$.

Thanking you. BABA

You can assume that $a, b, c, d$ are relatively prime (no prime dividing them all), which in this case need not be the same as coprime (no prime dividing any pair).

This is because by homogeneity any other solution is a multiple of one that is a relatively prime. (This assumption can't be made, where the degrees are non-homogenous, such as $x^2 + y^3 = z^5$.)

Then considering the equation mod 8, noting that $x^2 \equiv$ 1 mod(8) if $x$ is odd, one concludes that exactly two of $a, b, c$ must be even, say $a, b$, so that $c, d$ are both odd and $d - c$ and $d + c$ are both even. So each bracketed term in the following is an integer: $$\left(\dfrac{a}{2}\right)^2 + \left(\dfrac{b}{2}\right)^2 = \left(\dfrac{d - c}{2}\right) \left(\dfrac{d + c}{2}\right)$$

Now any prime $\equiv$ 3 mod(4) dividing either of the terms on the RHS must divide $a, b$ and hence must divide exactly one of the terms on the RHS to even multiplicity (or else it would divide $a, b, c, d$, contrary to hypothesis).

This, combined with the fact that 2 and every prime $\equiv$ 1 mod(4) can be expressed as the sum of two squares of integers, and their product composed into the same form by repeated use of: $$(p^2 + q^2) (r^2 + s^2) = (p q - r s)^2 + (p r + q s)^2$$ means that each of $$\frac{d - c}{2}\quad\text{and}\quad\frac{d + c}{2}$$ must be the sum of two squares of integers, say $v^2 + w^2$, $t^2 + u^2$ respectively

You can think of a sum of two squares as the norm of a so-called Gaussian integer, of the form $x + y \sqrt{-1}$, the norm being the product of this and its conjugate $x - y \sqrt{-1}$ to give $x^2 + y^2$.

The nice thing about Gaussian integers, also referred to as the ring $Z[\sqrt{-1}]$, is that factorisation into "primes" of the same form is unique, just like the rational ("ordinary") integers.

So treating the first equation above as expressing a Gaussian integer as the product of two others, i.e. $$\dfrac{a}{2} + \dfrac{b}{2} \sqrt{-1} = (v + w \sqrt{-1}) (t + u \sqrt{-1})$$ where the norms of the bracketed terms on the RHS correspond to $\dfrac{d - c}{2}$ and $\dfrac{d + c}{2}$ respectively, one can conclude by multiplying out the RHS and equating coefficients (of $\sqrt{-1}$ and "1") that there must be some set of integers $t, u, v, w$ for which: \begin{align*} \dfrac{a}{2} &= t v - u w\\ \dfrac{b}{2} &= u v + t w \end{align*} and taking norms gives: \begin{align*} \dfrac{d - c}{2} &= v^2 + w^2\\ \dfrac{d + c}{2} &= t^2 + u^2\\ \end{align*} i.e. \begin{align*} c &= t^2 + u^2 - v^2 - w^2\\ d &= t^2 + u^2 + v^2 + w^2 \end{align*} I imagine this is very much like the solutions given in the earlier questions cited; but it's useful revision working it out again ;-)

• $\LaTeX$ tip: the argument of \sqrt should be in curly brackets, not parentheses (\sqrt{-1} rather than \sqrt(-1); the latter places only ( inside the radical). Also, \dfrac will automatically write things in display mode; \frac can be used when in-line. And if you use $$...$$ you get displayed equations, which are better spaced and sized than in-line $...$ and automatically get centered (and no need to break up the paragraph with blank lines). – Arturo Magidin Feb 4 '12 at 20:42
• Many thanks Arturo - I thought those round brackets looked a bit ugly. I'll add your comments to my LaTeX hints and tips file. – John R Ramsden Feb 4 '12 at 22:20
• @ArturoMagidin Thank you so much for your help. – baba Feb 6 '12 at 5:17
• @JohnRRamsden! Thank you so much and it is sufficient for me to re think for further levels. I will come again in near future with one more question. Once again thank you So much. – baba Feb 6 '12 at 5:19