# $3\times3$ Magic Square and hidden formula [Solved]

I was doing the $3 \times3$ Magic Square of Squares problem -- found here: http://www.multimagie.com/English/SquaresOfSquaresSearch.htm -- and I figured out that if such Magic square exists with $9$ distinct numbers, then it must satisfy the following equation:

$$\sqrt{a} + \sqrt{b} - \sqrt{c} = \sqrt{d}$$

where the numbers $a,b,c$ and $d$ are distinct entries in the square.

Crucial notes:

1) $a+b$ must also be a square number

2) The numbers $a,b,c,d$ can be any distinct integers greater than 0.

My attempt was $$\sqrt{36} + \sqrt{64} - \sqrt{75} = \sqrt{25}$$ which isn't quite equal and doesn't work because 75 isn't a perfect square.

In my amateur opinion there isn't a solution, but would like someone good in mathematics to prove or disprove above equation.

• What are $a,b,c,d$? – GoodDeeds Aug 9 '16 at 15:43
• a b c d need to be all square roots with real numbers. This means that: a= 36=6^2.....b= 64 =8^2...and so on...Obviously it can be any numbers, but will it satisfy the equation criteria. – user356448 Aug 9 '16 at 15:51
• So you're looking for district positive solutions $a,b,c,d$? There are infinitely many. For example $a=16$ $b=25$ $c=36$ and $d=9$. – Zestylemonzi Aug 9 '16 at 16:08
• A magic square is a square array of numbers consisting of the distinct positive integers, arranged such that the sum of the $n$ numbers in any horizontal, vertical, or main diagonal line is always the same number. Are we using the same definition? what is the relationship between $a, b, c$ and $d$ with a particular magic squares? are they entries of the magic square? – Siong Thye Goh Aug 9 '16 at 16:09
• Some points on what makes this a poor question. It appears that you are trying to make a $3 \times 3$ magic square using square numbers, but you never say that. We can only guess it from the numbers which you say are "correct". You introduce $a,b,c,d$ and never say what they are. Presumably they are entries in the square. In your comment, you appear to mean to say they are squares, not square roots. As you saw in your previous question, there are numbers which are the sum of two squares in more than one way. Please think about what you are trying to ask and make it clear. – Ross Millikan Aug 9 '16 at 16:11

From what I understand in your post and the comments, you would like to find -- as JMoravitz said -- $a,b,c,d,e$ such that $$a^2 + b^2 = c^2 + d^2=e^2$$ We necessarily have $$a^2+b^2-d^2=c^2$$ And if I may explain how this relates to magic squares problems, as most people won't know. The existence of a 3x3 magic square of square numbers is currently unknown. There is a prize for finding one (Read here: http://www.multimagie.com/English/SquaresOfSquaresSearch.htm) But if a solution did exist it would have the following form $$\begin{bmatrix} a^2 & b^2 & c^2 \\ d^2 & e^2 & f^2 \\ g^2 & h^2 & i^2 \end{bmatrix}$$

Being a magic square means the sum of the entries of each column, row, and the 2 diagonals are equal. From this, one can show that $$a^2 + i^2 = b^2 + h^2 = c^2 + g^2=2e^2$$

Not exactly what you wanted though -- I think. However from this we can derive other interesting equalities. For example $$(ai)^2 + \Big(\frac{a^2-i^2}{2}\Big)^2= (bh)^2 + \Big(\frac{b^2-h^2}{2}\Big)^2= (cg)^2 + \Big(\frac{c^2-g^2}{2}\Big)^2 = e^4$$

Maybe this is what you were tackling?

Anyways, to solve your question -- and the magic square of squares problem -- it is very important to understand the two square identity $$(a^2 + b^2)(c^2 + d^2) = (ac \mp bd)^2 + (ad \pm bc)^2$$

It's closely related to the Gaussian integers (integer complex numbers. read here: https://en.wikipedia.org/wiki/Complex_number#Multiplication_and_division)

To solve the first equation, lets break it up into to 2 $$a^2 + b^2 = e^2$$ $$c^2 + d^2 = e^2$$

Each equation is solved if we substitute $$a=2mn \quad b=m^2-n^2 \quad c = 2pq \quad d=p^2-q^2$$ $$e=m^2 + n^2 = p^2 + q^2$$

I mentioned the two square identity because it can be used to find this substitution. Now we must also find $m,n,p,$ and $q$ such that $m^2 + n^2=p^2+q^2$, which again can be done with the two square identity. The smallest example that gives a distinct solution without zeros is $$(2^2 + 1^2)(3^2 + 2^2) \ \ =\ \ 8^2 + 1^2 \ \ =\ \ 7^2 + 4^2 \ \ =\ \ 65$$

So we can use $m=8$, $n=1$, $p=7$, and $q=4$ to get our first -- and the smallest -- solution $$16^2 + 63^2 = 56^2 + 33^2 = 65^2$$

It would be fitting here to also explain why there are guaranteed to be infinitely many solutions. Any prime number that leaves a remainder of 1 when divided by 4, can be expressed as the sum of two squares (read more here: https://en.wikipedia.org/wiki/Fermat's_theorem_on_sums_of_two_squares). For the previous solution I used the first two such primes: $5=2^2 + 1^2$ and $13 = 3^2 + 2^2$.

$\quad$ There are indeed infinitely many of this kind of prime just like there are infinitely many primes. The first few are $5,13,17,29,37,41,...$ (https://oeis.org/A002144). You can pick any two distinct products of these primes to make a new solutions.

For example, starting with $m=7$, $n=4$, $p=5$, and $q=2$ will yield this solution $$1836^2 + 427^2 = 1813^2 + 516^2 = 1885^2$$

That choice of $m,n,p,$ and $q$ works because $7^2+4^2=65=5\cdot 13$ and $5^2 + 2^2 = 29$. The numbers $5,13,$ and $29$ are primes of the form $4k+1$.

All solutions to $a^2 + b^2 = c^2 + d^2=e^2$ can either be generated with this method or by multiplying the $a,b,c,d$ and $e$ of some such solution by an arbitrary integer.

Hope this helps. Good luck getting that prize :)