7
$\begingroup$

Find the smallest positive integer which can be written as the sum of the squares of two positive integers in two different ways.

I took extremely long to solve this

I got

$50= 7^2 + 1^2 $

$50= 5^2 + 5 ^2 $

I did it with the trial and error method.

I'm just curious if this came out during my exams, is there a quicker way to find the answer?

$\endgroup$
2
  • $\begingroup$ It is the variant of so called "Taxicab numbers", for better known 3rd and 4th power's variant an algorithm is described in Nikolaus Wirth's book Algorithmen und Datenstrukturen from 1975. $\endgroup$
    – z100
    Commented Jun 20, 2016 at 14:50
  • $\begingroup$ See oeis.org/A007692 and mathworld.wolfram.com/SumofSquaresFunction.html. $\endgroup$
    – lhf
    Commented Jun 20, 2016 at 15:50

3 Answers 3

5
$\begingroup$

Consider the equation $x^2+y^2=z^2+w^2=N.$

This is equivalent to: $x^2-z^2=w^2-y^2=D.$

and we need $D$ to have at least two different factorizations with the factors having the same parity. One approach is thus to find the smallest values of $D$ which satisfy this property. Another approach is to find parametric solutions.

Let $(x-z)=ab$ and $(x+z)=cd$ with $(w-y)=ac$ and $(w+y)=bd$,

which gives the parametric solution: $\dfrac{1}{2}(ab+cd,bd-ac,cd-ab,ac+bd)$. We have $N=\dfrac{1}{4}(a^2b^2+c^2d^2+b^2d^2+a^2c^2)$.

Now from the fact that $cd-ab$ and $bd-ac$ are distinct positive integers, we can see that no three of $a,b,c,d$ can be the same.

Thus, the lexicographically smallest value for the tuple $(a,b,c,d)$ is $(1,1,2,3)$, which gives the solution $(7,1,5,5)$ and $N=50$. Once we have this solution, it is easily checked that other tuples of $a,b,c,d$ give larger values of $N$.

$\endgroup$
4
$\begingroup$

I do wonder why it took so long... I added all pairs from the first ten squares on a piece of scrap paper in a few minutes. Maybe that's a long time.

\begin{array}{c|c|c} && +1 & +4 & +9 & +16 & +25 & +36 & +49 & +64 & +81 & +100 \\ \hline 1 && 2 \\ \hline 4 && 5 & 8\\ \hline 9 && 10 & 13 & 18 \\ \hline 16 && 17 & 20 & 25 & 32 \\ \hline 25 && 26 & 29 & 34 & 41 & \color{red}{50} \\ \hline 36 && 37 & 40 & 45 & 52 & 61 & 72 \\ \hline 49 && \color{red}{50} & 53 & 58 & \color{blue}{65} & 74 & \color{magenta}{85} & 98 \\ \hline 64 && \color{blue}{65} & 68 & 73 & 80 & 89 & 100 & 113 & 128 \\ \hline 81 && 82 & \color{magenta}{85} & 90 & 97 & 106 & 117 & 130 & 145 & 162 \\ \hline 100 && 101 & 104 & 109 & 116 & 125 & 136 & 149 & 164 & 181 & 200 \\ \hline \end{array}

This also gives the first case when all the squares in question are distinct, at $65 = 8^2+1^2 = 7^2+4^2$

$\endgroup$
0
$\begingroup$

If $p$ is a prime and $p \equiv 1 \bmod 4$, then $p=a^2+b^2$, for some $a,b \in \mathbb N$.

In this case, $2p^2$ has two representations: $p^2+p^2$ and $(a-b)^2+(a+b)^2$.

The second representation ones from $2p^2=|(1+i)(a+bi)^2|^2$.

So, the smallest solution is with $p=5$, for which $a=2$ and $b=1$ and $(a+bi)^2=3-4i$, which give $50=5^2+5^2=1^2+7^2$.

$\endgroup$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .