Some Theory concerning 5 x 5 magic squares
© H.B. Meyer

Consider a 5 x 5 magic square
c01
c02
c03
c04
c05
c06
c07
c08
c09
c10
c11
c12
c13
c14
c15
c16
c17
c18
c19
c20
c21
c22
c23
c24
c25

with 1 ≤ c01,c02,...,c24,c25 ≤ 25, all entries different, and equal row-, column- and diagonal sums (=65).

If all entries c01,c02,...,c24,c25 are replaced by 26-c01,26-c02,...,26-c24,26-c25 then the square remains magic.

Observation 1

(i) For any choice of 5 different numbers c01,c02,c03,c04,c05 from {1,2,...,25} with sum 65 there exists at least one 5x5 Magic Square with this first row.
(ii)For any choice of 5 different numbers c01,c07,c13,c19,c25 from {1,2,...,25} with sum 65 there exists at least one 5x5 Magic Square with this diagonal.

This can be verified with a computer experiment, e.g. with the downloadable program "mag5x.exe".

Theorem 1   The entries of the magic square satisfy the following equations:

c05 = 65-c01-c02-c03-c04,
c10 = 65-c06-c07-c08-c09,
c15 = 65-c11-c12-c13-c14,
c17 = 2c01+c02+c03+c04+c06-c09+c11-c13+c16-65,
c18 = 325-4c01-2c02-2c03-2c04-2c06-2c07-c08-2c11-c12-c13-c14-2c16-2c19,
c20 = 2c01+c02+c03+c04+c06+2c07+c08+c09+c11+c12+2c13+c14+c19-195,
c21 = 65-c01-c06-c11-c16,
c22 = 130-2c01-2c02-c03-c04-c06-c07+c09-c11-c12+c13-c16,
c23 = 4c01+2c02+c03+2c04+2c06+2c07+2c11+c12+c14+2c16+2c19-260,
c24 = 65-c04-c09-c14-c19, and
c25 = 65-c01-c07-c13-c19.

This results from solving the 12 linear equations rowsum=65, columnsum=65, diagonalsum=65 and expressing the 14-dimensional general solution with variables c01,c02,c03,c04,c06,c07,c08,c09,c11,c12,c13,c14,c16 and c19.

Remark 1   Every linear equation valid for the entries c01,c02,...,c24,c25 of all 5x5-magic squares, including the equations of Theorem 1, can be obtained with the "calculator" below (requires JavaScript):
c01 c02 c03 c04 c05
c06 c07 c08 c09 c10
c11 c12 c13 c14 c15
c16 c17 c18 c19 c20
c21 c22 c23 c24 c25



result:
Examples:
1) To get the first equation c01+c02+c03+c04+c05 = 65, simply press the "+"-button of row 1.
2) The equation 4c01+2c02+2c03+2c04+2c06+2c07+c08+2c11+c12+c13+c14+2c16+c18+2c19 = 325, f.i., can be obtained in the following way: three times "+" in row 1, two times "+" in rows 2, 3, and 4, one time "+" in row 5 and diagonal c01...c25, one "-" for columns 2, 3, 4 and diagonal c05...c21, finally two times "-" in column 5.
3) Another equation (*) 2c01+c02+c06+2c07-c14-c15-c18-c20-c23-c24 = 0, is shown by: "+" for diagonal c01...c25, column 1 and column 2, "-" for rows 3, 4 and 5.

Theorem 2   55 ≤ 3(c01 + c07) + 2(c02 + c06) ≤ 205.
This estimation is best possible, as shown by the square  
 1 2222515
 910161119
172313 5 7
2412 620 3
1418 8 421

Proof  Equation (*) from example 3) gives c14+c15+c18+c20+c23+c24 = 2c01+c02+c06+2c07, therefore
55 = 1+2+3+...+10 ≤ c01+c02+c06+c07+c14+c15+c18+c20+c23+c24 = 3(c01+c07)+2(c02+c06). The upper bound is obtained, when every entry c is replaced by 26-c.


Corollary 1   20 ≤ c01+c02+c06+c07 ≤ 84.

This follows from Theorem 2, since 58 ≤ 55 + c02+c06 ≤ 3(c01+c02+c06+c07). Then 60 ≤ 3(c01+c02+c06+c07), too. The square given in Theorem 3 shows, that the bounds 20 and 84 cannot be enlarged resp. reduced.

Theorem 3    218 ≤ 3(c01+c07+c13) + 2(c02+c03+c05+c08+c11+c12) ≤ 328.

Proof   Define
n:= c01+c02+c03+c06+c07+c08+c11+c12+c13,   
s:= c04+c05+c09+c10+c14+c15,
f:= c19+c20+c24+c25.
n
s
 
f
     
22 6 31816
 414111521
 5 8122317
251319 7 1
 92420 210

One has n + s = 195 and f + s = 130, hence n = 65 + f ≥ 85 (see Corollary 1).
Now   n + c01+c07+c13 = 65 + c01+c07+c13 + f = 65 +c01+c07+c13+c19+c25+c20+c24 = 130 +c20+c24 ≥ 133.
Together with n ≥ 85 one now has 2n + c01+c07+c13 ≥ 133 + 85 = 218. The square above shows that the bound 218 ist best possible.

Theorem 4  For the "corner sum" the inequality 26 ≤ c01+c05+c21+c25 ≤ 78 holds.

Proof   From Theorem 1 (using the calculator of Remark 1) we get: 65 + c08+c12+c14+c18 = 2(c01+c05+c21+c25) + c13,    
hence 65 + 10 ≤ 2(c01+c05+c21+c25) + 25, and 50 ≤ 2(c01+c05+c21+c25). Equality is impossible,
since {c08, c12,c14,c18} = {1,2,3,4} would imply 26 = 5+6+7+8 ≤ c01+c05+c21+c25.

Corollary 2  "X"-sum and "x"-sum: 52 ≤ c01+c05+2c13+c21+c25 ≤ 104.

 5 92025 6
1315 21124
21 123 317
1918 41410
 7221612 8
This follows, because exchange of proper rows and colums turns the "X"-sum c01+c05+2c13+c21+c25 into an "x"-sum c06+c08+2c13+c16+c18 and because "x"-sum + "corner sum" = 130. The example with "corner sum" 5+6+7+8 and "x"-sum 15+11+2·23+18+14 tells, that the bounds 26,78 in Theorem 4 and 52,104 in Corollary 2 cannot be improved.

Theorem 5    Let V5:= c01+c05+c07+c09+c13, and Σ(k) resp. σ(k) be the greatest resp. lowest sum of k numbers from 1 to 25, not occuring as summands in V5, then

(i)    σ(10) ≤ V5+65 ≤ Σ(10)
(ii)   28 ≤ V5 ≤ 102, -37 ≤ c01+c07-c05-c09 ≤ 37
(iii)  66 ≤ 2V5+c13 ≤ 220
(iv)   130-Σ(4) ≤ V5+c13 ≤ 130-σ(4); especially 36 ≤ V5+c13 ≤ 120
(v)    195-Σ(12) ≤ 2c01+2c07-c05-c09+c13 ≤ 195-σ(12)
(vi)   41 ≤ V5+c01+c05+c13 ≤ 167 and 41 ≤ V5+c07+c09+c13 ≤ 167

Proof    The calculator of Remark 1 shows (+ for both diagonals and - for the lower 3 rows): V5 + 65 is the sum of 10 numbers not belonging to V5; this proves (i).
Moreover from 2V5 + Sum of 10 other entries = 260 (+ for both diagonals and + for the upper 2 rows) it follows 260 - Σ(10) ≤ 2V5 ≤ 260 - σ(10); hence 55 ≤ 2V5 ≤ 205 this proves the first part of (ii), the second part results, if the first part is applicated to V5' = c01+c05+c13+c17+c21, with c17+c21 = 65-c05-c09-c13.
Next, from 2V5 + c13 + Sum of 14 other entries = 325 (+ for both diagonals and + for the upper 3 rows) it follows 325 - Σ(14) ≤ 2V5 + c13 ≤ 325 - σ(14), proving (iii).
The inequality (iv) follows from V5 + c13 = 130 - (c17 + c19 + c21 + c25). For (v), again use the calculator of Remark 1 (+ for the diagonal c01 - c25 and for the 3 left columns then - for the other diagonal). Inequality (vi) follows from V5+c01+c05+c13 + Sum of 7 unused entries = 195 (+ for both diagonals and for the first resp. second row).

The left square below is an example for (i) with σ(10)= 5+6+...+14 = 95, V5 = 30; (i) shows, e.g., that 20 cannot be replaced by 19. The second square shows, that none of the bounds given in (ii) and (iii) can be improved.
(iii) tells e.g., that V5 = 28 is impossible with c13 < 10. [A computer calculation has shown: V5 = 28 is impossible, if the number 11 occurs in V5.]. The third square illustrates (iv), the fourth one shows (v), with 195-Σ(12) = 2c01+2c07-c05-c09+c13, and the right square illustrates (vi).
(1,8,10.7,2) is the only possibility for (c01,c07,c13,c09,c05) with c01 < c05,c07,c09, leading to equality with the leftt bound 41 in (vi).

 1251917 3
23 215 421
121420 910
 716 52413
22 8 61118
 1222118 3
19 515 917
1614101213
 620 824 7
23 411 225
 8182014 5
121021 913
1711 21619
 425 723 6
24 115 322
 52212 125
18 71324 3
21171011 6
19 41420 8
 21516 923
 1192320 2
15 817 718
1814101216
1121 622 5
25 3 9 424
(i)
(ii), (iii)
(iv)
(v)
(vi)


Theorem 6    c19 = 1/12(1495-19c01-9c02-7c03-10c04-9c06-11c07-3c08-2c09-9c11-5c12-5c13-6c14-8c16 ± sqrt(D)),
sqrt denoting the square root. D is the square number:
D  -215c012-111c022-71c032-68c042-87c062-71c072-39c082-68c092-87c112-47c122-95c132-36c142-80c162
+c01(-258c02-190c03-172c04-210c06-134c07-30c08+124c09-210c11-98c12+70c13-12c14-200c16)
+c02(-138c03-132c04-126c06-90c07-18c08+84c09-126c11-78c12+66c13-12c14-120c16)
+c03(-100c04-90c06-62c07-30c08+52c09-50c12+22c13-12c14-90c11-80c16)
+c04(-84c06-44c07-12c08+40c09-84c11-44c12+52c13-24c14-80c16)
+c06(-90c07-42c08+36c09-126c11-54c12+42c13-12c14-120c16)
+c07(-54c08-4c09-66c11-58c12-34c13-12c14-40c16)
+c08(-36c09-18c11-18c12-42c13-12c14)
+c09(60c11+20c12-76c13-24c14+80c16)
+c11(-78c12+18c13-36c14-120c16)
+c12(-22c13-36c14-40c16)
+c13(-36c14+80c16)
+22750c01+15210c02+11830c03+10660c04+13650c06+10790c07
+5070c08-2860c09+13650c11+8450c12+650c13+3900c14+10400c16
-791375.

This follows from the equation c012 + c022 + ... + c242 + c252 = 12 + 22 + ... + 242 + 252. Substitution of c05,c10,c15,c17,c18,c20,c21,c23,c24, and c25 by their expressions given in Theorem 1 leads to a quadratic equation for c19 with the above solutions.

Remark 2  The next two squares show, that the entries c01,c02,c03,c04,c06,c07,c08,c09,c11,c12,c13,c14, and c16 do not completely determine the magic square, but by Theorem 6 there are at most 2 squares having these entries in common, because there are not more than 2 possible values for c19. These values may be determined with the following "calculator" (JavaScript required, "NaN" means: "not a number"). 
20 11323 8
 42114 224
 6221216 9
101815 517
25 31119 7
   
20 11323 8
 42114 224
 6221216 9
101811 719
25 31517 5

c01 c02 c03 c04 c05
c06 c07 c08 c09 c10
c11 c12 c13 c14 c15
c16 c17 c18 c19 c20
c21 c22 c23 c24 c25


c19 =    


Relations for pattern sums    Consider the following sums of entries:

       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
        
        
        
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
V=c01+c05
 +c21+c25
v=c07+c09
 +c17+c19
N=c01+c03+c05
 +c11+c13+c15
 +c21+c23+c25
n=c07+c08+c09
 +c12+c13+c14
 +c17+c18+c19
m=c13 K=c03+c11
 +c15+c23
k=c08+c12
 +c14+c18
O=c02+c04+c06
 +c10+c16+c20
 +c22+c24

Proper combinations of equations from Theorem 1 (with the help of the "equation-calculator" in Remark 1) lead to:

(R01) 2V+m = k+65 (R02) 2v+m = K+65 (R03) V+65 = n (R04) v+65 = N
(R05) 2v+3m+k = 195 (R06) 2V+3m+K = 195 (R07) 3V = v+2k (R08) 3v = V+2K
(R09) k = v mod 3 (R10) K = V mod 3 (R11) O = 3m+65 (In1) 26≤V,v≤78
(In2) 52≤V+2m,v+2m≤104 (In3) 91≤N,n≤143 (In5) 39≤k+3m,K+3m≤143 (In6) 44≤V+m,v+m≤86 *)

*) Inequality (In6) was found by a computer calculation.

These Relations are useful for showing, that certain entries in magic squares are impossible:

Example 1    There is no 5x5 magic square with c01=1, c05=2, c21=4, and c25=24.
Proof    With (R01) the assumption leads to: m = k+65-2V = k + 3 ≥ 3+5+6+7 + 3 = 24. Because 24 is used: m=25. Further, by (R01) again: k=22 = 3+5+6+8. Now, c07+c19=15 leads to a contradiction, because there are not enough unused numbers left, that two of them could sum up to 15.

Reduced 5x5 Magic Squares   The two maps
map1:
 
exchange rows 1 and 2, exchange columns 1 and 2
exchange rows 4 and 5, exchange columns 4 and 5
map2:exchange rows 2 and 4, exchange columns 2 and 4

in combination with the 4 reflections and the 3 rotations of a 5x5 square generate a set of 32 transformations (including the identity), each of which maps every 5x5 magic square onto another one.
Every 5x5 magic square can be mapped by one of these 32 transformations onto a unique "reduced square" for which the following inequalities are valid:
c01<c05<c21, c01<c25, c01<c07, c01<c09, c01<c17, c01<c19, c02<c04.

The number of reduced 5x5 magic squares depending on the value of c01 is shown by the table below:

c01number of reduced squares
117736163
215437677
312581407
48803796
55927144
63786042
72286273
81332837
9645631
10217929
1158598
1212809
 68826306

There exist 68820306 reduced 5x5 magic squares and 32x68826306 = 2202441792 magic squares of order 5.
(This number is well known since 1973, found by R. Schroeppel). There is a downloadable program "red5.exe" available, which produces all reduced 5x5 magic squares; moreover, the user may prescribe fixed entries.

The Delacorte-Number d of a 5x5-square (cij) is defined as
d = ½∑[gcd(cij,ckl)*((i-k)2+(j-l)2)|i,j,k,l=1,...,5].
This also may be written as d = ∑[φ(k)*Sk|k=1,...,12],
where φ denotes the Euler-function φ(k)=number of integers ≤k, coprime to k,
and Sk is the sum over all squares of distances of multiples of k occuring in (cij).   
There are (except for reflections or rotations) unique 5x5-Magic Squares
with the lowest and highest possible Delacorte-Numbers d=3458 and d=5890, namely:
 1 5152519
2320 6 9 7
131018 321
17 82412 4
1122 21614
d=3458
 81014 924
221325 1 4
 519 72311
1821 317 6
12 2161520
d=5890

last update: 2016-March-29.







eXTReMe Tracker