0
$\begingroup$

Let's start with an example, $N=n^2=7^2=49$. $49$ can also be produced by simply writing $49= (6+1)^2 = 36 + 2\cdot6 + 1 = 36 + 13$. So if we can find a way to represent 13 as a sum of two squares, we will have a representation of 49 as a sum of 3 squares. 13 is an integer of the form $4k+1$ so it can be represented by a sum of 2 squares (I recently posted an algorithm). It is easy to see that $13= 2^2 + 3^2$. So basically, to write 49 as a sum of 3 squares all that was needed is the representation of 13 as a sum and a difference of 2 squares. $13=2^2+3^2=7^2-6^2$. Then it's just a matter of moving $6^2$ to the left hand side to get $49 = 2^2 + 3^2 + 6^2$.

When adding consecutive odd numbers to form the square $49$, $13$ is the last odd number to be added. Note that this algorithm will not work for squares of the form $4k$ simply because the last odd number to be added is of the form $4k+3$. For example $64= 49+ 15= 7^2 + 15$.

To summarize the algorithm:
1-Given an integer $N=n^2$ we want to write as $N=a^2+b^2+c^2$
2-Find $m=2n-1$
3-Express $m$ as $m=((m+1)/2)^2 - ((m-1)/2)^2 = n^2 - c^2$
4-Find the decomposition of $m$ as $m=a^2 + b^2$ using my algorithm posted on this site ( or some other algorithm of your choice)
5-Set $a^2+b^2=n^2-c^2$
6-Write $N=n^2=a^2 + b^2 +c^2$

Can this algorithm be considered as an application of De Gua's theorem, the equivalent of the Pythagorean theorem in 3D?

$\endgroup$
  • $\begingroup$ Why don't you just use the algorithm in step 4 to $N$ directly? $\endgroup$ – didgogns Feb 25 '17 at 2:09
  • $\begingroup$ the algorithm in step 4 can only give the 2 squares representation of $N$. We want the 3 square representation of $N$. $\endgroup$ – user25406 Feb 25 '17 at 11:55
  • $\begingroup$ Wouldn't it just be easier to use the known complete parameterization? $\endgroup$ – Kieren MacMillan Mar 9 '17 at 1:47
  • $\begingroup$ @KierenMacMillan, sure but this algorithm quickly gets one representation of a sum of 3 squares for a given square of a given form. I am not sure "the complete parametrization" is easier. You are welcome to add it as an answer. $\endgroup$ – user25406 Mar 9 '17 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.