Basic theory
3×3 magic squares over a general carrier
The magic constant, the complete form m(E,x,y), its uniqueness, and the exact distinctions between abelian groups, rings, fields, and the real, rational, and integer cases.
1. Carrier and definition
Let A be an abelian group written additively. A 3×3 magic square over A is an array whose three row sums, three column sums, and two main diagonal sums are equal to one element M∈A. An abelian group is the natural general setting: the proof needs addition, zero, and subtraction, but it needs no multiplication, order, or division.
If A is a module over a ring R, squares are added entrywise and every entry may be multiplied by one scalar. The classification below is compatible with this module structure.
2. The magic constant
Theorem
In every 3×3 magic square over an abelian group, the magic constant is three times the central entry:
Proof
Let T be the sum of all nine entries. Adding the three rows gives T=3M. Now add the middle row, the middle column, and both diagonals. Every noncentral entry occurs once and the center occurs four times. Hence this sum is both 4M and T+3E:
Substituting T=3M and cancelling 3M in the abelian group gives M=3E. No division by 3 was used. The four lines through the center immediately give the opposite-pair identities:
3. The complete form m(E,x,y)
Classification theorem
For every abelian group A, each 3×3 magic square over A has a unique representation of the following form, with E,x,y∈A:
Surjectivity: every magic square has this form
Let Q be any magic square and set x=A−E and y=G−E. Then A=E+x and G=E+y. The opposite-pair identities give J=E−x and C=E−y. The bottom row and first column then give H=E+x−y and D=E−x−y, while their opposite entries are B=E−x+y and F=E+x+y. Thus all nine entries have the stated form.
Consequently every Q∈𝓜₃(A) has a preimage (E,x,y), so the map Φₐ:A³→𝓜₃(A) is surjective.
Well-definedness: every coordinate triple gives a magic square
For arbitrary E,x,y, the eight required sums are computed directly. None of these identities uses division:
Injectivity: the coordinates are unique
The coordinates are recovered without choices or denominators: E is the central entry, x=A−E, and y=G−E. Therefore two different coordinate triples cannot define the same square.
4. Group, module, and vector space
Write 𝓜₃(A) for the set of 3×3 magic squares over A. The theorem gives an isomorphism of abelian groups A³≅𝓜₃(A). If A is an R-module, this isomorphism is R-linear:
For a commutative ring R, this is a free R-module with the following three explicit basis matrices:
In particular, over every field K the space 𝓜₃(K) has dimension three. This statement concerns entrywise addition and scalar multiplication; ordinary matrix multiplication does not in general preserve magic squares.
5. Different scalar domains
| Carrier | Structure | Exact consequence |
|---|---|---|
| abelian group | ||
| commutative ring | free R-module of rank 3 | |
| field | ||
| ordered field | fixed M gives the affine plane E=M/3 | |
| rational field | a common denominator scales the square to an integral one | |
| free abelian group |
Real numbers
Over ℝ one obtains a three-dimensional real vector space. For a fixed magic constant M, the coordinate E=M/3 is fixed while x and y are free, giving a two-dimensional affine plane. Positivity is expressed by nine linear inequalities, while pairwise distinctness removes a finite collection of lines from the (x,y)-plane.
Rational numbers
Rational entries are equivalent to rational coordinates E,x,y. Multiplying by a common denominator of the coordinates turns any rational magic square into an integral one. To preserve the stronger property that the entries are rational squares, take a common denominator of their square roots and multiply the whole square by the square of that denominator.
Integers
An integral magic square has integral E,x,y because these coordinates are integral differences of its entries; the converse is immediate from the formula. Its magic constant is necessarily divisible by 3. Primitivity is also read directly from the coordinates:
Indeed, every entry is an integral linear combination of E,x,y, while E,x,y are themselves integral linear combinations of the entries. Hence the two gcds divide each other.
Fields of positive characteristic
The form m(E,x,y) and the three-dimensional classification remain valid in every characteristic, but the familiar geometry may degenerate. In characteristic 3 every magic square has M=3E=0, so M no longer determines the center. In characteristic 2 opposite entries coincide and the four side entries B,D,F,H share one value; the square cannot have nine pairwise distinct entries:
Over a ring in which 2 or 3 is not invertible, one should use the denominator-free form and recover E=Q₂₂, x=A−E, y=G−E. The formulas E=M/3, x=(A−J)/2, and y=(G−C)/2 are valid only when the corresponding elements are invertible.
6. Boundary of the linear theory
The theorem classifies all 3×3 magic squares, but by itself says nothing about positivity, distinctness, or square-valued entries. Positivity requires an order; being a square requires multiplication; requiring selected linear forms to be squares turns the linear problem into a Diophantine one. This is the point at which the k/9 problems, residue theory, norms, and elliptic surfaces begin.