Back to theory contents

Arithmetic of a minimal 9/9 square

Prime divisors in a minimal 9/9 square

Representations as sums of two squares determine the possible prime divisors of the central root and exclude primes of the form 8k+3 from every other root.

1. Assumptions and notation

Consider a 3×3 magic square whose nine entries are positive, pairwise distinct squares of integers:

M(e2,x,y)=(a2b2c2d2e2f2g2h2j2).\mathcal M(e^2,x,y)= \begin{pmatrix} a^2&b^2&c^2\\ d^2&e^2&f^2\\ g^2&h^2&j^2 \end{pmatrix}.

The square is called minimal when all entry roots are coprime as a collection:

gcd(a,b,c,d,e,f,g,h,j)=1.\gcd(a,b,c,d,e,f,g,h,j)=1.

Equivalently, the entries cannot all be divided by the same integer square greater than one. All factorizations below concern entry roots; prime exponents in the entries themselves are twice as large.

The general form of a 3×3 magic square

2. Two sets of identities

Every pair of entries opposite through the center has sum 2e²:

a2+j2=b2+h2=c2+g2=d2+f2=2e2. a^2+j^2=b^2+h^2=c^2+g^2=d^2+f^2=2e^2.

Moreover, every corner is the middle term of an arithmetic progression whose endpoints are two side entries:

f2+h2=2a2,d2+h2=2c2,b2+f2=2g2,b2+d2=2j2. \begin{aligned} f^2+h^2&=2a^2,& d^2+h^2&=2c^2,\\ b^2+f^2&=2g^2,& b^2+d^2&=2j^2. \end{aligned}

Proof

In the form m(e²,x,y), the offsets of the four opposite pairs from the center are x, y−x, y, and x+y. Adding each pair cancels its offset and gives 2e². For the first corner-centered progression,

(e2+x+y)+(e2+xy)=2(e2+x)=2a2. (e^2+x+y)+(e^2+x-y)=2(e^2+x)=2a^2.

The other three identities follow by the same expansion or by rotating the square.

3. Primes 4k+3 and a sum of two squares

Lemma

Let q be prime with q≡3 (mod 4). If q divides u²+v², then q divides both u and v.

Proof

If v were not divisible by q, then the class uv⁻¹ would be a square root of −1 modulo q. Euler's criterion gives

u2v2(modq)(uv1)21(modq),qv. u^2\equiv-v^2\pmod q \quad\Longrightarrow\quad (uv^{-1})^2\equiv-1\pmod q, \qquad q\nmid v. (1q)=(1)(q1)/2=1, \left(\frac{-1}{q}\right)=(-1)^{(q-1)/2}=-1,

so no such root exists. Hence q divides v, and then q∣u² implies q∣u.

Valuation form

If u and v are not both zero, then

vq(u2+v2)=2min{vq(u),vq(v)}. v_q(u^2+v^2)=2\min\{v_q(u),v_q(v)\}.

Indeed, after removing the common power of q, the remaining sum of two squares is not divisible by q by the lemma.

4. The unique primitive representation of one prime power

Why factorization is unique in ℤ[i]

For z=u+iv put N(z)=u²+v². Given α,β∈ℤ[i] with β≠0, round the real and imaginary parts of α/β to the nearest integers to obtain γ∈ℤ[i]. Then the remainder ρ=α−γβ satisfies

N(ρ)=N(β)αβγ212N(β)<N(β). N(\rho)=N(\beta)\left|\frac{\alpha}{\beta}-\gamma\right|^2 \le\frac12N(\beta)<N(\beta).

Thus the norm is Euclidean. The Euclidean algorithm gives greatest common divisors and Bézout identities. Hence every irreducible is prime: if π∣αβ and π∤α, then gcd(π,α)=1, and multiplying a Bézout identity by β gives π∣β. Factorization into irreducibles exists by descent on the positive norm, and primality of irreducibles successively cancels matching factors from any two factorizations. Therefore ℤ[i] is a unique factorization domain.

Geometry of divisionThe nearest Gaussian integer
Rounding a complex number to the nearest Gaussian integerThe point alpha over beta lies in the unit square centered at gamma; both remainder coordinates have absolute value at most one half.γα/β|s| ≤ 1/2|t| ≤ 1/2
The point α/β always lies in one of these squares.|α/β − γ|² = s² + t² ≤ 1/2

Splitting a prime p≡1 (mod 4)

Euler's criterion gives an integer t with t²≡−1 (mod p). Hence p divides (t+i)(t−i), but divides neither factor in ℤ[i]: divisibility by the rational integer p would require both coordinates, including ±1, to be divisible by p. Thus p is not prime in ℤ[i] and factors nontrivially. The norms of the two nonunit factors multiply to p², so each norm is p. Choosing one factor as π gives

p=ππˉ,N(π)=p.p=\pi\bar\pi,\qquad N(\pi)=p.

Two representations N=u²+v² are identified when they differ only by swapping u,v or changing signs. A representation is p-primitive when p does not divide both u and v.

Gaussian lemma

If p≡1 (mod 4) is prime and α≥1, then 2p²ᵅ has exactly one p-primitive representation as a sum of two squares, up to the stated equivalence.

Proof

In the Gaussian integers choose a prime π with p=ππ̄. By unique factorization, every element z=u+iv of norm 2p²ᵅ has, up to a unit, the form

z(1+i)πrπˉ2αr,0r2α. z\sim(1+i)\pi^r\bar\pi^{\,2\alpha-r}, \qquad 0\le r\le2\alpha.

The condition p∣u and p∣v is equivalent to divisibility of z by p=ππ̄. It holds exactly for 1≤r≤2α−1. The remaining cases r=0 and r=2α are conjugate and yield one representation after swapping coordinates and changing signs.

Interactive tool

Gaussian factorization

Swap conjugate factors and observe which representation as a sum of two squares they produce.

325 =524k+1134k+1
A representation as a sum of two squares existsEvery prime 4k+3 occurs to an even exponent.
All representations
325 = 1² + 18²325 = 6² + 17²325 = 10² + 15²
Left columnRight column
1 + 2i1 − 2i
1 + 2i1 − 2i
2 + 3i2 − 3i
-18 − i×-18 + i
Column productsz = -18 − i, z̄ = -18 + i
Norm of the selected product325 = 1² + 18²

5. Factorization of the central root

Square structureFive representations of 2e²

a² + j² = b² + h² = c² + g² = d² + f² = 2e²

e² + e² = 2e²
Matching colors connect entries opposite through the center.

Theorem

The central root e of a minimal 9/9 square has the form

e=i=1rpiαi,r2,pi1(mod4),αi1, e=\prod_{i=1}^{r}p_i^{\alpha_i}, \qquad r\ge2,\quad p_i\equiv1\pmod4,\quad \alpha_i\ge1,

where p₁,…,pᵣ are pairwise distinct primes.

Excluding primes 4k+3

Suppose a prime q≡3 (mod 4) divides e. Each of the four opposite pairs satisfies u²+v²=2e², so the preceding lemma forces q to divide both roots in every pair. Thus q divides all nine roots, contradicting minimality.

Excluding 2

If e were even, then 2e² would be divisible by 8. A sum of two squares can be divisible by 8 only when both roots are even. The four opposite-pair equations would again make every root even. Hence e is odd.

Therefore every prime divisor of e is congruent to 1 modulo 4.

At least two distinct divisors

The case e=1 is impossible: 2 has only the representation 1²+1², whereas the four pairs of distinct noncentral entries must give four distinct representations of 2e².

Now suppose e has only one distinct prime divisor. Then e=pᵅ for some p≡1 (mod 4). The four opposite pairs of noncentral entries give four distinct representations of 2p²ᵅ. By the Gaussian lemma, at most one pair is p-primitive. Thus modulo p at most one pair of opposite entries can remain nonzero.

The magic constant is 3e² and is therefore zero modulo p. Choose a row or column containing one entry of the remaining pair but not its opposite. The other two entries on that line are zero, so the line sum forces the third one to be zero as well. Hence p also divides the roots in the last pair and therefore all nine roots, again contradicting minimality.

6. The number of representations of 2e²

Let e have the proved factorization. The number of unordered positive representations 2e²=u²+v², up to signs, is

R(2e2)=1+i=1r(2αi+1)2. R(2e^2)=\frac{1+\prod_{i=1}^{r}(2\alpha_i+1)}{2}.

Proof

In the Gaussian factorization, for each pair πᵢ,π̄ᵢ one may independently choose the exponent of πᵢ from 0 through 2αᵢ, giving ∏(2αᵢ+1) choices before units. The standard ordered count is therefore 4∏(2αᵢ+1), including signs. The unique diagonal representation is e²+e²; it contributes four signed ordered solutions, whereas every nondiagonal unordered representation contributes eight. The formula follows.

The square itself uses five distinct representations: four opposite-entry pairs and the central pair e²+e².

7. Prime divisors of noncentral roots

Theorem

Let q≡3 (mod 4) be a prime divisor of any of the eight noncentral roots of a minimal 9/9 square. Then

q7(mod8).q\equiv7\pmod8.

The central-root theorem gives q∤e.

A corner entry

By symmetry it suffices to assume q∣a. From f²+h²=2a² and the lemma for primes 4k+3, q divides both f and h. In the coordinates m(e²,x,y), the differences f²−a²=y and h²−a²=−y give y≡0 (mod q). Since a²=e²+x≡0, we obtain x≡−e². Therefore

b2=e2x+y2e2(modq).b^2=e^2-x+y\equiv2e^2\pmod q.

Since q does not divide e, the number 2 is a nonzero square modulo q.

A side entry

By symmetry assume q∣b. Use the two corner-centered progressions

b2+d2=2j2,b2+f2=2g2. b^2+d^2=2j^2,\qquad b^2+f^2=2g^2.

If at least one of j,g is not divisible by q, the corresponding identity immediately shows that 2 is a square modulo q. If q divides both j and g, then it also divides d and f. The congruences j²=e²−x≡0 and g²=e²+y≡0 give x≡e² and y≡−e², whence f²=e²+x+y≡e². This contradicts q∣f together with q∤e. Thus 2 is again a square modulo q.

Conclusion

The supplementary law for the Legendre symbol is

(2q)=(1)(q21)/8. \left(\frac2q\right)=(-1)^{(q^2-1)/8}.

For q≡3 (mod 4), the possible classes modulo 8 are 3 and 7. The number 2 is a square only in the latter class, so q≡7 (mod 8).

8. Final factorization boundary

The central root contains only primes congruent to 1 or 5 modulo 8, with at least two distinct primes. In every noncentral root, a prime divisor congruent to 3 modulo 4 can only lie in the class 7 modulo 8; primes congruent to 3 modulo 8 are excluded.

Together with the restrictions modulo 24, all nine roots are odd and not divisible by 3. These conditions are necessary but are not by themselves sufficient for the existence of a 9/9 square.

Residues and quadratic residues