The definition of a regular magic square motivates us to introduce the new special magic squares, which are reflective magic squares, corner magic squares, and skew-regular magic squares. Combining the concepts of magic squares and linear algebra, we consider a magic square as a matrix and find the dimensions of the vector spaces of these magic squares under the standard addition and scalar multiplication of matrices by using the rank-nullity theorem.
1. Introduction
A classical magic square is an n×n square array of the distinct positive integers 1,2,…,n2 arranged in such a way that the summations of n entries along each row, each column, the main diagonal, and the cross diagonal are all equal to the same constant, called a magic sum. For example, the famous classical magic square appearing in Albrecht Dürer’s engraving Melancholia, known as Yang Hui-Dürer magic square, is(1)16321351011896712415141.
In this article, a magic square is also defined in the same context as the classical one except that all of its entries can be any real numbers and need not be distinct. The idea to study a magic square as a matrix was initiated by Fox [1] in 1956 where he considered a magic square as a matrix of real numbers (each entry needs not to be distinct) and showed that the inverse of a 3×3 magic square with the magic sum μ≠0 was also a magic square with the magic sum 1/μ. Certainly, many research studies of magic squares in the framework of linear algebra come afterwards.
The set of all n×n magic squares is well-known to be a vector space over R under the usual addition and scalar multiplication of matrices, denoted by MS(n). A magic square with the zero magic sum is called a zero magic square, and 0MS(n) denotes the set of all n×n zero magic squares, which is a subspace of MS(n). In 1959, Ratliff [2] found the dimension of the vector space of all n×n magic squares whose entries are from any field F. Later in 1980, Ward [3] by applying the rank and nullity theorem derived that the dimension of the vector space of all n×n magic squares over R was equal to n2-2n.
One of the popular types of the special magic squares that draw attentions from researchers is the regular magic squares; for example, see [4–9]. The property to define a regular magic square was noticed during the construction of magic squares (see [10] p. 202). We then challenge ourselves by constructing new types of magic squares which leads us to determine the following three types of magic squares.
2. Reflective Magic Squares
Before introducing the reflective magic squares, we shall recall the definition of the regular magic squares.
Definition 1.
An n×n magic square A=[aij] with a magic sum μ is said to be regular if(2)aij+an+1-in+1-j=2μn∀i,j=1,2,3,…,n.The set of all n×n regular magic squares is denoted by RMS(n) and 0RMS(n) is the set of all n×n zero regular magic squares. The magic squares below are examples of 4×4 and 5×5 regular magic squares where the entries with the same symbol represent the pairs satisfying (2):(3)♠♡♣⋄▵■▿▲▲▿■▵⋄♣♡♠,♠♡♣⋄∙▵■▿▲□★◃⊗◃★□▲▿■▵∙⋄♣♡♠.
In the regular conditions, any two entries added together are located in the positions diametrically equidistant from the center of the square. This way of symmetry persuades us to add up a new pair of entries that are symmetric along the main diagonal line. In this fashion, we define the new magic squares. (4)♠♡♣⋄♡♠□∙♣□♠°⋄∙°♠.
Definition 2.
An n×n magic square A=[aij] with a magic sum μ is said to be reflective if (5)aij+aji=2μn∀i,j=1,2,3,4,…,n.
Nonetheless, condition (5) imposed here with the summation conditions of a magic square forces all entries on the main diagonal to be μ/n. In particular, all entries on the main diagonal of a zero magic square must be zero. Let FMS(n) and 0FMS(n) denote the set of all n×n reflective magic squares and zero reflective magic squares, respectively. Consequently, FMS(n) and 0FMS(n) are subspaces of MS(n).
Lee et al. [11] showed that the dimension of the vector space of all n×n regular magic square matrices (RMS(n)) is n-12/2+1 when n is odd and n(n-2)/2+1 when n is even. Their results lead us to pursue the dimension of FMS(n). We shall begin with the most basic approach.
Let A∈0FMS(4) such that(6)A=0a12a13a14a210a23a24a31a320a34a41a42a430.Then we derive the homogeneous system of linear equations of aijs’ satisfying the row conditions, column conditions, and the reflective conditions, respectively. The main condition is omitted in this case because each entry on the main diagonal is zero. Moreover, the cross diagonal condition is replaced by the reflective conditions. Let A¯ denote the coefficient matrix where the variables are a12,a13,a14,a21,a23,a24,a31,a32,a34,a41,a42,a43, as shown in the following example of the coefficient matrix A¯ when A∈0FMS(4):(7)111000000000000111000000000000111000000000000111000100100100100000010010010010000001001001001000100100000000010000100000001000000100000010010000000001000010000000001001.By using elementary row operations to A¯ to get the row-reduced echelon matrix A¯rr of A¯, we derive a basis of 0FMS(4) to be {A1,A2,A3}(8)A1=0-11010-10-11000000,A2=0-101100-10000-1100,A3=00-110000100-1-1010.Moreover, the associate basis for FMS(4) is {A1,A2,A3,U}, where(9)U=1111111111111111.Therefore, dim(0FM(4)) = 3 and dim(FM(4)) = 4. Elements in 0FMS(4) and FMS(4) can be calculated by using these bases; for example,(10)2A1+4A3=0-2-2420-20220-4-4040∈0FMS4,3A2+A3+4U=4138744154430754∈FMS4.
However, this basic method cannot be used to find the dimension of 0FMSn and FMSn in the general cases. The rank and nullity theorem plays an important role to obtain the results.
Theorem 3.
For n≥4, the dimension of 0FMSn is (n2-3n+2)/2 and the dimension of FMSn is (n2-3n+4)/2.
Proof.
Let A=[aij]∈0FMS(n), where aii=0 and aij∈R, for all i,j∈{1,2,3,…,n}. By the summation of aijs’ along each line to be zero, we then write the homogeneous system of linear equations of aijs’ satisfying the row conditions, column conditions, and the reflective conditions, respectively. The cross diagonal condition is not included here because it is replaced by the reflective conditions. We denote Ri, the ith row of the coefficient matrix, and let A¯ denote the coefficient matrix where the variables are all aij such that i≠j for all i,j∈{1,2,3,…,n}. That is, there are n2-n variables in the homogeneous system. By the rank-nullity theorem, dim(0FMS(n)) can be derived by finding the rank of the coefficient matrix A¯ first. In this case, A¯ is an ((n2+3n)/2)×(n2-n) matrix (see equation (7)) whose rows are ordered by n row conditions (starting from the first row), n column conditions (starting from the first column), and n(n-1)/2 reflective conditions (ordering pairs from left to right and then to the rows below). The rows of A¯ are related in the following ways:
R2n is a linear combination of Rk for all k=1,2,…,2n-1.
R3n-1 is a linear combination of R1,Rn+1, and Rk for all k=2n+1,2n+2,…,3n-2.
For each 2≤i≤n-3, R2n+i(2n-1-i)/2 is a linear combination of Ri,Rn+i, and n-2 rows from the reflective conditions.
R(n2+3n-4)/2 is a linear combination of Rk for all k=n,n+1,…,2n-1 and (n2-3n)/2 rows from the reflective conditions.
R(n2+3n-2)/2 is a linear combination of Rn-2,Rn,Rn+1, Rn+2,…, R2n-3,R2n-1 and (n2-5n+6)/2 rows from the reflective conditions.
R(n2+3n)/2 is a linear combination of Rk for all k=n-1,n,n+1,…,2n-2 and (n2-5n+6)/2 rows from the reflective conditions.
The remaining (n2+n-2)/2 rows, which are all rows except Rk(2n-1-k)/2 where k=0,1,…,n, are linearly independent.
Therefore, dim(0FMS(n))=(n2-n)-n2+n-2/2=(n2-3n+2)/2. Let U denote the n×n matrix with all entries of 1. We observe that, for any A∈FMS(n) with a magic sum μ, there is the associate zero magic square A0∈0FMS(n), where A0=A-(μ/n)U. It is easy to see that B∪{U} forms a basis for FMS(n) for any basis B of 0FMS(n). Hence dim(FMS(n))=dim(0FMS(n))+1=(n2-3n+4)/2.
The generalization of a regular magic square which we shall introduce next will be a magic square satisfying a condition of combining four entries instead of adding two entries.
3. Corner Magic Squares
The idea to construct this type of magic squares comes from our observation on any four entries in a magic square which form corners of a rectangle whose center is the same as the magic square and is symmetric horizontally and vertically. In particular, even the famous Yang Hui-Dürer magic square also satisfies the observed properties.
Definition 4.
An n×n magic square A=[aij] with a magic sum μ is said to be a corner magic square if (11)aii+an+1-in+1-i+ain+1-i+an+1-ii=4μnfor all i=1,2,3,…,n. The set of all n×n corner magic squares is denoted by CMS(n) and 0CMS(n) is the set of all n×n zero regular magic squares. The magic squares below are examples of 4×4 and 5×5 corner magic squares where the entries with the same symbol represent the entries satisfying (11):(12)♠♡◯♠▵■■▿◃■■▹♠⋄□♠,♠♡♣⋄♠▵■▿■▹∙◃★◯▲⊠■°■⊚♠⊝⧫□♠.
By the linear property of (11), it is easy to check that both 0CMS(n) and CMS(n) are subspaces of MS(n). Moreover, RMS(n)⊆CMS(n) and 0RMS(n)⊆0CMS(n), but the converse does not hold; for example,(13)4512315333332334is an element in CMS(4), but not in RMS(4). Nevertheless, CMS(3) = RMS(3) and 0CMS(3) = 0RMS(3).
To find a basis of 0CMS(4), we can use the Gauss-Jordan elimination method as before to retrieve a basis of 0CMS(4) to be {A1,A2,A3,A4,A5,A6,A7}, where(14)A1=11-1-1-1-11100000000,A2=0-11010-10-11000000,A3=01-101-100-10100000,A4=11-1-10-110-10010000,A5=10-100-1100000-1100,A6=11-200-1100000-1010,A7=12-2-10-2200000-1001.Moreover, the associate basis of CMS(4) is {A1,…,A7,U}, where(15)U=1111111111111111;that is, dim(0CMS(4)) = 7 and dim(CMS(4)) = 8. Apparently, dim(CMS(4)) = dim(MS(4)). This means that CMS(4) is the same space as MS(4). Furthermore, we can use the bases to find a magic square in 0MS(4) and MS(4); for example,(16)3A2+5A7=57-7-53-1070-3300-5005,3A2+5A7+13U=1820681632013101613138131318.
Nevertheless, CMS(n) is not always the same set as MS(n). For the general case, we can apply the rank and nullity theorem to find the dimension of 0CMS(n) and CMS(n).
Theorem 5.
For n≥5, the dimension of 0CMS(n) is (2n2-5n-1)/2 when n is odd and (2n2-5n)/2 when n is even. Moreover, the dimension of CMS(n) is (2n2-5n+1)/2 when n is odd and (2n2-5n+2)/2 when n is even.
Proof.
Let A=[aij]∈ 0CMS(n), where aij∈R for all i,j∈{1,2,3,…,n}. By the summation of aijs’ along each line to be zero, we then write the homogeneous system of linear equations of aijs’ satisfying the row conditions, column conditions, the main diagonal condition, the cross diagonal condition, and the corner conditions, respectively. As before, let A¯ denote the coefficient matrix.
Case 1 (n is odd). Including all conditions, there are ((5n+3)/2) homogeneous equations in the system and a((n+1)/2)((n+1)/2)=0 by the corner condition at the center. Then all aij except a((n+1)/2)((n+1)/2) are variables in this system. We then arrange the equations so that the coefficient matrix A¯ is an ((5n+3)/2)×(n2-1) matrix of 0’s and 1’s where its rows are, respectively, ordered by n row conditions, n column conditions, 1 main diagonal condition, 1 cross diagonal condition, and (n-1)/2 corner conditions. See the following matrix as an example of the coefficient matrix A¯ when A∈0CMS(4):(17)111100000000000000001111000000000000000011110000000000000000111110001000100010000100010001000100001000100010001000010001000100011000010000100001000100100100100010010000000010010000011001100000.Observing the coefficient matrix A¯, we derive the relationships of the rows of A¯ as follows:
R2n is a linear combination of Rk for all k=1,2,…,2n-1.
R2n+2 is a linear combination of R2n+1 and Rk for all k=2n+3,2n+4,…,(5n+3)/2.
The remaining rows are linearly independent.
Therefore, A¯ has (5n-1)/2 linearly independent rows. By the rank-nullity theorem, dim(0CMS(n))=(n2-1)-((5n-1)/2)=(2n2-5n-1)/2.
Case 2 (n is even). In this case, the coefficient matrix A¯ is an ((5n+4)/2)×n2 matrix of 0’s and 1’s such that its rows are, respectively, arranged by n row conditions, n column conditions, 1 main diagonal condition, 1 cross diagonal condition, and n/2 corner conditions (see (17) for example). Moreover, we derive the relationships of the rows of A¯ as follows:
R2n is a linear combination of Rk for all k=1,2,…,2n-1.
R2n+2 is a linear combination of R2n+1 and Rk for all k=2n+3,2n+4,…,(5n+4)/2.
The remaining rows are linearly independent.
Therefore, A¯ has 5n/2 linearly independent rows. By the rank-nullity theorem, dim(0CMS(n))=n2-(5n/2)=(2n2-5n)/2.
Let U be the n×n matrix with all entries of 1. For any A∈CMS(n) with a magic sum μ, we have the associate zero magic square A0∈0CMS(n) such that A0=A-(μ/n)U. From this fact, B∪{U} forms a basis for CMS(n) when B is a basis for 0CMS(n). The dimension of CMS(n) is then derived to be dim(0CMS(n))+1.
4. Skew-Regular Magic Squares
From the corner magic squares, we shift to observe any four entries in a magic square which form corners of a rectangle located in the position that its center is the same as the magic square and symmetrical axes are the main diagonal and cross diagonal.
Definition 6.
An n×n magic square A=[aij] with a magic sum μ is said to be a skew-regular magic square if (18)aij+an+1-in+1-j+aji+an+1-jn+1-i=4μn,where i∈{1,2,3,…,(n-1)/2} and j∈{i+1,i+2,…,n-i} if n is odd and i∈{1,2,3,…,(n-2)/2} and j∈{i+1,i+2,…,n-i} if n is even. The set of all n×n skew-regular magic squares is denoted by SRMS(n) and 0SRMS(n) is the set of all n×n zero skew-regular magic squares. The matrices below are examples to indicate groups of four entries (not on the diagonals) in the same symbols satisfying (18) for skew-regular magic squares: (19)♠♡■◯♡♠◯■■◯♠♡◯■♡♠,♠♡♣⋄♠♡♠▿♠⋄♣▿♠▿♣⋄♠▿♠♡♠⋄♣♡♠.
As before, the linear property of (18) implies that both 0SRMS(n) and SRMS(n) are subspaces of MS(n).
Theorem 7.
For n≥6,(20)dim0SRMSn=3n2-6n-14,ifnisodd,3n2-6n4,ifniseven,dimSRMSn=3n2-6n+34,ifnisodd,3n2-6n+44,ifniseven.
Proof.
Let A=[aij]∈0SRMS(n), where aij∈R for all i,j∈{1,2,…,n}.
Case 1 (n is odd). All rows of the coefficient matrix A¯ are ordered by n row conditions, n column conditions, the main diagonal condition, the cross diagonal condition, and n-12/4 skew-regular conditions, respectively. Including all conditions, there are ((n2+6n+9)/4) homogeneous equations in the system. By the sums along the middle column, the middle row, and all four corners on these two lines, we can conclude that a((n+1)/2)((n+1)/2)=0. Then we have the homogeneous system with the variables all aij except a((n+1)/2)((n+1)/2). Observing the ((n2+6n+9)/4)×(n2-1) coefficient matrix A¯, we derive the relationships of the rows of A¯ as follows:
R2n is a linear combination of Rk for all k=1,2,…,2n-1.
R(n2+6n+5)/4 is a linear combination of R1,R2,…, R(n-1)/2,R(n+3)/2,…,Rn,R(3n+1)/2,R2n+1,R2n+2 and all rows from the skew-regular conditions except R(n2+6n+9)/4-k(k+1) for all k=0,1,…,(n-3)/2.
R(n2+6n+9)/4 is a linear combination of R(n+1)/2,R(3n+1)/2 and R(n2+6n+9)/4-k(k+1) for all k=1,…,(n-3)/2.
The remaining rows are linearly independent.
By the rank and nullity theorem, dim0SRMS(n)=(n2-1)-((n2+6n+9)/4-3)=(3n2-6n-1)/4.
Case 2 (n is even). The rows of A¯ are arranged as in the previous case except that there are (n2-2n)/4 skew-regular conditions; see the following matrix as an example of the coefficient matrix A¯ when A∈0SRMS(4):(21)111100000000000000001111000000000000000011110000000000000000111110001000100010000100010001000100001000100010001000010001000100011000010000100001000100100100100001001000000100100010000110000100,and hence, A¯ has (n2+6n+8)/4 rows and n2 columns. Moreover, we derive the relationships of the rows of A¯ as follows:
R2n is a linear combination of Rk for all k=1,2,…,2n-1.
R(n2+6n+8)/4 is a linear combination of R1,R2,…,Rn and R2n+1,R2n+2,…,R(n2+6n+4)/4.
The remaining rows are linearly independent.
Therefore, A¯ has (n2+6n)/4 linearly independent rows resulting in dim0SRMS(n)=n2-(n2+6n)/4=(3n2-6n)/4.
From the same reason as before, B∪{U} is a basis for SRMS(n) for any basis B of 0SRMS(n) where U is the n×n matrix with all entries of 1. Hence dimSRMS(n) is derived afterward.
5. Conclusion
According to the studies of regular magic squares, the reflective magic squares, corner magic squares, and skew-regular magic squares, as the generalization, can also lead to new research studies of their properties and applications.
Competing Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
FoxC.Magic matrices1956402092011Zbl0071.03603RatliffJ.The dimension of the magic square vector space19596679379510.2307/2310469MR0122823WardI.Vector spaces of magic squares198053210811110.2307/2689960MR567960MattinglyR. B.Even order regular magic squares are singular2000107977778210.2307/2695733MR1792410LolyP.CameronI.TrumpW.SchindelD.Magic square spectra2009430102659268010.1016/j.laa.2008.10.032MR25098482-s2.0-62749083868LeeM. Z.LoveE.NarayanS. K.WascherE.WebsterJ. D.On nonsingular regular magic squares of odd order201243761346135510.1016/j.laa.2012.04.004MR29423552-s2.0-84862888354NordgrenR. P.On properties of special magic square matrices201243782009202510.1016/j.laa.2012.05.031MR29504682-s2.0-84864460062ChanC. J.MainkarM. G.NarayanS. K.WebsterJ. D.A construction of regular magic squares of odd order201445729330210.1016/j.laa.2014.05.032MR32304472-s2.0-84902185363LiuL.GaoZ.ZhaoW.On an open problem concerning regular magic squares of odd order201445911210.1016/j.laa.2014.06.046MR32472112-s2.0-84904174558Rouse BallW. W.CoxeterH. S. M.1987Courier CorporationLeeM.LoveE.WascherE.2006Mount Pleasant, Mich, USACentral Michigan University