Notes on The Magic Squares of Squares Problem

1. Problem Introduction

A Magic Square is an \(n \times n\) matrix where the sums of the elements along the rows, columns, and diagonals are the same. Here is an example of a classic \(3 \times 3\) Magic Square using the natural numbers \(1\) through \(9\).


In the square above it is easy to verify that all rows, columns, and diagonals sum to \(15\).

People have been studying Magic Squares for at least the past \(4000\) years; however, there are a few open problems related to Magic Squares with a few additional constraints on the values of their entries. A good survey of these open problems (and the rewards for solving them) is found here. These recreational mathematics problems are easy to state, yet deceptively difficult to answer.

The problem in particular that has captured my interest for well over a year now is the Magic Squares of Squares problem which asks if a \(3 \times 3\) Magic Square exists with \(9\) distinct positive square integers.

For a good survey of what is known so far about this problem, I recommend taking a look here and here. This is a well studied problem in number theory, yet no one has been able to produce either a \(3 \times 3\) Magic Square of Squares or a proof that it doesn't exist.

While, I have not solved the problem, I believe that I have some interesting results, and I see no reason not to share them with others while I continue to think about the problem.

2. My Results

If a \(3 \times 3\) Magic Square of Squares exists, it must be a square integer multiple of a rational \(3 \times 3\) Magic Square of Squares of the following form (up to rotation and reflection)


Also, if there does not exist \(u,w_0,w_1 \in \mathbb{Q}\) that is a non-trivial solution to \(\frac{2u(u^2-1)}{(u^2+1)^2}=\frac{w_0(w_0^2-1)}{(w_0^2+1)^2}+\frac{w_1(w_1^2-1)}{(w_1^2+1)^2}\), then there does not exist a non-trivial Magic Square of Squares.

Also, if there does not exist \(u,v,w_0 \in \mathbb{Q}\) that is a non-trivial solution to \(\frac{u(u^2-1)}{(u^2+1)^2}+\frac{v(v^2-1)}{(v^2+1)^2}=\frac{w_0(w_0^2-1)}{(w_0^2+1)^2}\), then there does not exist a non-trivial Magic Square of Squares.

3. Proof of Results

a. Searching Over Rationals Instead of Integers For Solutions

To make the problem easier we are going to search for a \(3 \times 3\) Magic Square with 9 distinct positive square rationals.

If a \(3 \times 3\) Magic Square exists 9 distinct positive square rationals, then a \(3 \times 3\) Magic Square exists with 9 distinct positive square integers and vice-versa

The integers to rationals case is trivial, and the rationals to integers case just involves multiplying all of the entries by the gcd of the denominators.

b. Parameterizing Solutions

It is well known that all Rational \(3 \times 3\) Magic Squares can parameterized by the following:


Dividing through by \(x\) we get the following (Note \(x\) is never \(0\)):


Which simplifies to the following with \(Y:=\frac{y}{x}\) and \(Z:=\frac{z}{x}\)


All that we have done so far is scale the initial parameterization. This new Magic Square now parameterizes all \(3 \times 3\) Magic Squares with Magic sums of \(3\).

For a Magic Square of Squares to exist, the following radicals (ignoring signs) must all be rational (and unique):


We will return to these once we prove something about the rational parameterization of \(\sqrt{1-p},\sqrt{1+p}\)

c. A Rational Parameterization of \(\sqrt{1-p},\sqrt{1+p}\)

We can find a rational parameterization of \(\sqrt{1-p}\) in terms of \(t\) easily by the following algebraic manipulation:




Then we will substitute \(1-t^2\) for \(p\) in \(\sqrt{1+p}\) and generate a new rational parameterization of both expressions






This is the equation for a circle with radius 2. All circles have rational parameterizations in 1 variable, and we can find this circle's rational parameterization by the following steps:

\(s=1,t=1\) is a rational point on this circle, so all rational points (ignoring the point \((1,-1))\) can be expressed as the intersection between the line \(s=u(t-1)+1\) with rational slope \(u\) and the circle \(s^2+t^2=2\)

Next we will plug \(s=u(t-1)+1\) into \(s^2+t^2=2\) to get the intersection. Simplifying and solving for \(t\) is messy, but we get the following simple result:




Move all terms to the left side of the equation


Collect powers of \(t\):


Quadratic formula:

\[t=\frac{-(2u-2u^2) \pm \sqrt{(2u-2u^2)^2-4(u^2+1)(u^2-2u-1)}}{2(u^2+1)}\]


\[t=\frac{u^2-u \pm (u+1)}{u^2+1}\]




Plugging \(t\) back into our original equation \(p=1-t^2\) and solving for \(p\) we get two solutions:

The first is trivial (and it is a trivial solution to the larger Magic Squares problem): \(t=1\)


The second is more interesting: \(t=\frac{u^2-2u-1}{u^2+1}\)





d. A final Parameterization of \(3 \times 3\) Magic Squares of Squares

Using this parameterization (above), we define the following:


\(\sqrt{1-Y},\sqrt{1+Y},\sqrt{1-Z},\sqrt{1+Z}\) are always rational with this parameterization, so all that remains is to find a pair \((u,v) \in \mathbb{Q}^2\) such that the following are rational: \(\sqrt{1-Y-Z},\sqrt{1+Y-Z},\sqrt{1-Y+Z},\sqrt{1+Y+Z}\)

For \(\sqrt{1-Y-Z}\) and \(\sqrt{1+Y+Z}\) to be rational, there must exist \(w_0\in\mathbb{Q}\) such that \(Y+Z=\frac{4w_0(w_0^2-1)}{(w_0^2+1)^2}\)

For \(\sqrt{1+Y-Z}\) and \(\sqrt{1-Y+Z}\) to be rational, there must exist \(w_1\in\mathbb{Q}\) such that \(Y-Z=\frac{4w_1(w_1^2-1)}{(w_1^2+1)^2}\)

Substituting what we know about \(Y\) and \(Z\), we get the following two equations:

\[\frac{4u(u^2-1)}{(u^2+1)^2}+\frac{4v(v^2-1)}{(v^2+1)^2}=\frac{4w_0(w_0^2-1)}{(w_0^2+1)^2} \;\;\; , \;\;\; \frac{4u(u^2-1)}{(u^2+1)^2}-\frac{4v(v^2-1)}{(v^2+1)^2}=\frac{4w_1(w_1^2-1)}{(w_1^2+1)^2}\]

We can divide through by 4:

\[\frac{u(u^2-1)}{(u^2+1)^2}+\frac{v(v^2-1)}{(v^2+1)^2}=\frac{w_0(w_0^2-1)}{(w_0^2+1)^2} \;\;\; , \;\;\; \frac{u(u^2-1)}{(u^2+1)^2}-\frac{v(v^2-1)}{(v^2+1)^2}=\frac{w_1(w_1^2-1)}{(w_1^2+1)^2}\]

And add the two equations together to get \(1\) equation in \(3\) variables:


Proving that no non-trivial rational triple of \((u,w_0,w_1)\) that satisfies the above relation, suffices to prove that no Magic Square of Squares exist.

(Trivial solutions to this relation are all cases where \(\frac{2u(u^2-1)}{(u^2+1)^2}\), \(\frac{w_0(w_0^2-1)}{(w_0^2+1)^2}\), and \(\frac{w_1(w_1^2-1)}{(w_1^2+1)^2}\) are not distinct.)

4. Additional Notes

Proving that there is no non-trivial rational solution to \(\frac{u(u^2-1)}{(u^2+1)^2}+\frac{v(v^2-1)}{(v^2+1)^2}=\frac{w_0(w_0^2-1)}{(w_0^2+1)^2}\) proves that there are no non-trivial Magic Squares of Squares but does not prove that no non-trivial Magic Hourglasses of Squares exist. Similarly, a non-trivial triple would prove that a Magic Hourglass of Squares exists, but would not prove that a Magic Square of Squares exists.

The general function \(f(u)=\frac{u(u^2-1)}{(u^2+1)^2}\) has an interesting structure. All of the following are equal!


This means that we can confine our search to a rational triple \((u,w_0,w_1)\) in the open interval \((0,1)^3\)

5. Computational Results

In C++, using GMP and Farey Sequences, I conducted a search over all possible positive rational pairs \((u,v)\) with denominators less than or equal to \(3000\) where \(Y=-\frac{4u(u^2-1)}{(u^2+1)^2}\) and \(Z=-\frac{4v(v^2-1)}{(v^2+1)^2}\) such that both \(\sqrt{1-Y-Z}\) and \(\sqrt{1+Y+Z}\) exist and \(0\le v\le u\le \sqrt{2}-1\) for nontrivial solutions.

My program ran for ~\(132\) hours, checked \(155,228,794,012\) pairs, and found the following:

\(\sqrt{1-Y-Z}\) is a nontrivial rational \(445\) times.

\(\sqrt{1-Y+Z}\) is a nontrivial rational \(435\) times.

\(\sqrt{1+Y+Z}\) is a nontrivial rational \(1933\) times.

\(\sqrt{1+Y-Z}\) is a nontrivial rational \(802\) times.

There are no pairs in this search such that \(2\) or more of these expressions are nontrivial rationals at the same time.

While this is not a proof, it certainly lends some experimental evidence to the conjecture that no \(3 \times 3\) Magic Square of Squares exists.

A full dataset of these pairs can be downloaded here as a text file: magic_pairs_3000.txt

Email: zachdestefano@gmail (dot) com

Back to main page