Existence of Some Signed Magic Arrays††thanks: Research
supported by NSF REU Grant DMS1262838, University of West Georgia
Abdollah Khodkar
Department of Mathematics
University of West Georgia
Carrollton, GA 30118
[email protected]
Christian Schulz
Department of Mathematics
Rose Hulman Institute of Technology
5500 Wabash Ave, Terre Haute, IN 47803
[email protected]
Nathan Wagner
Department of Mathematics
Bucknell University
701 Moore Avenue,Lewisburg, PA 17837
[email protected]
Abstract
We consider the notion of a signed magic array, which is an m×n rectangular array with the same number of filled cells s in each row and the same number of filled cells t in each column, filled with a certain set of numbers that is symmetric about the number zero, such that every row and column has a zero sum. We attempt to make progress toward a characterization of for which (m,n,s,t) there exists such an array. This characterization is complete in the case where n=s and in the case where n=m; we also characterize three-fourths of the cases where n=2m.
Keywords: magic array, Heftter array, signed magic array
1 Introduction
A magic rectangle is defined as an m×n array whose entries are precisely the integers from [math] to mn−1 wherein the sum of each row is c and the sum of each column is r.
A magic square is a magic rectangle with m=n and c=r.
In [5] it is proved that:
Theorem 1**.**
There is an m×n magic rectangle if and only if m≡n(mod2), m+n>5, and m,n>1.
An integer Heffter array H(m,n;s,t) is an m×n array with entries from
X={±1,±2, …,±ms}
such that each row contains s filled cells and each column contains t filled cells,
the elements in every row and column sum to 0 in Z, and
for every x∈A, either x or −x appears in the array.
The notion of an integer Heffter array H(m,n;s,t) was first defined by Archdeacon in [1].
Integer Heffter arrays with m=n represent a type of magic square where each number from the set
{1,2,…,n2} is used once up to sign. A Heffter array is tight if it has no empty cell; that is,
n=s (and necessarily m=t).
Theorem 2**.**
[2]**
Let m,n be integers at least 3.
There is a tight integer Heffter array if and only if mn≡0,3(mod4).
A square integer Heffter array H(n;k) is an integer Heffter array with m=n and s=t=k.
In [3, 4] it is proved that:
Theorem 3**.**
There is an integer H(n;k) if and only if 3≤k≤n and nk≡0,3(mod4).
A signed magic array SMA(m,n;s,t) is an m×n array with entries from X, where
X={0,±1,±2,…,±(ms−1)/2} if ms is odd and X={±1,±2,…,±ms/2} if ms is even,
such that precisely s cells in every row and t cells in every column are filled,
every integer from set X appears exactly once in the array and
the sum of each row and of each column is zero.
In the case where m=n, we call the array a signed magic square.
Signed magic squares also represent a type of magic square where each number from the set X
is used once.
We use the notation SMS(n;t) for a signed magic square with t filled cells in each row and
t filled cells in each column. An SMS(n;t) is called k-diagonal if its entries all belong to k consecutive diagonals (this includes broken diagonals as well). In the case where k=t, we abbreviate this to simply diagonal.
An SMA(m,n;s,t) is called tight, and denoted SMA(m,n), if it contains no empty cells; that is m=t and n=s. Figure 1 displays two examples of signed magic arrays.
In this paper we investigate the existence of SMA(m,n), SMS(m;t) and SMA(m, 2m;2t,t).
In Section 2 we prove an SMA(m,n) exists precisely when m=n=1, or when m=2 and n≡0,3(mod4), or when n=2 and m≡0,3(mod4), or when m,n>2.
In Section 3 we
show that there exists an SMS(n;t) for n≥t≥1 precisely when n,t=1 or n,t>2.
Finally, in Section 4 we prove that there exists an SMA(m,2m;2t,t) if m≥t≥3 and mt≡0 or 3(mod4) or m,t≡2(mod4).
In the following sections, the notation [a,b] refers to the set of integers z such that a≤z≤b.
Two partitions P1 and P2 of a set A are orthogonal if the intersection
of each member of P1 and of P2 has precisely one element.
A rectangular array is shiftable if it contains the same number of positive as negative entries in every column and in every row (see [1]).
These arrays are called shiftable because they may be shifted to use different absolute values. By increasing the absolute value of each entry by k, we add k to each positive entry and −k to each negative entry. If the number of entries in a row is 2ℓ, this means that we add ℓk+ℓ(−k)=0 to each row, and the same argument applies to the columns. Thus, when shifted, the array retains the same row and column sums.
2 Tight signed magic arrays
We first examine the case of a tight array, with all of its cells filled. We will completely characterize the values of m and n for which tight m×n signed magic arrays exist through the use of several lemmata. The proof of the following lemma is trivial.
Lemma 1**.**
A tight SMA(1,n) exists if and only if n=1.
Lemma 2**.**
An SMA(2,n) exists if and only if n≡0,3(mod4).
Proof.
In an SMA(2,n), let x be a value in a column; then −x must be the other value if their sum is zero. Thus, each row in the 2×n array contains every absolute value from 1 to n exactly once. If n≡1(mod4), then n(n+1)≡2(mod4), so ∑i=1ni=21n(n+1) is odd. Note that for all x, x−(−x)=2x is even, so by replacing any number by its negative in a sum, one cannot change the parity of the sum. Because each row in the 2×n array contains every absolute value from 1 to n exactly once, their sum is equal to ∑i=1ni after some of the positives have been replaced by negatives; but this sum will always be odd, so the sum of a row cannot be the even number 0. Thus, no tight 2×n signed magic array exists. If n≡2(mod4), then n(n+1)≡2(mod4), and the same argument holds as in the previous case.
Now let n≡0,3(mod4). By induction we prove that an SMA(2,n) exists. A 2×3 array with the first row 1,2,−3 and the second row −1,−2,3 is obviously an SMA(2,3).
When n=4 we use the array given in Figure 2.
Now let n≡0,3(mod4) with n>4, and assume the existence of an SMA(2,n−4). Onto the right side of this array we add four columns, leaving a 2×4 space of cells to be filled. Note that the 2×4 array in Figure 2 is shiftable, so we may merely shift its absolute values from 1 through 4 to n−3 through n and use it to fill the empty space. As the shiftable array has zero row and column sums, the sum of each row is still zero, and the sum of each of the four new columns is also zero. We thus construct an SMA(2,n).
Now the result follows by strong induction.
∎
The remaining cases split based on the parity of m and n.
2.1 Tight signed magic arrays with m,n both even
Lemma 3**.**
A shiftable SMA(m,n) exists if m,n are both even and greater than 2.
Proof.
Proceed by strong induction first on n and then on m. As the base case, we provide arrays for (m,n)=(4,4), (4,6), and (6,6) in Figures 3 and 4. Note that as the transpose of a signed magic array is a signed magic array, we need not provide a separate 6×4 array and may transpose the 4×6 array.
Now, let m∈{4,6} and n be even, and assume that there exists a shiftable SMA(m, n−4). We may extend this array by adding four columns to create an m×n array. Note that the empty m×4 space, because m is even, partitions into 2×4 rectangles, each of which may be filled by a shifted copy of Figure 2 using a method analogous to that of Lemma 2 with the appropriate absolute values. As the shifted copies each have a row and column sum of zero, they do not change the row sums from the m×(n−4) array, and the sums of the new columns will be zero as well. Therefore, a shiftable SMA(m,n) exists. Hence, by strong induction on n,
a shiftable SMA(m,n) exists for m∈{4,6} and n>2 even.
Now, let m and n both be even, and assume that there exists a shiftable SMA(m−4,n). We may extend this array by adding four rows to create an m×n array. Note that the empty 4×n space, because n is even, partitions into 4×2 rectangles, each of which may be filled by a shifted copy of the transpose of Figure 2 using a method analogous to that of the previous paragraph. As the shifted copies each have a row and column sum of zero, they do not change the column sums from the m×(n−4) array, and the sums of the new rows will be zero as well. Therefore, a tight shiftable SMA(m,n) exists. By strong induction on m, a shiftable SMA(m,n) always exists for m>2,n>2 even.
∎
2.2 Tight signed magic arrays with m,n both odd
Recall that a magic rectangle is defined as an m×n array whose entries are precisely the integers from [math] to mn−1 wherein the sum of each row is c and the sum of each column is r.
Lemma 4**.**
A SMA(m,n) exists if m,n are both odd and greater than 1.
Proof.
Let m,n be odd and greater than 1. Then m+n≥6. Hence by Theorem 1 there exists an m×n magic rectangle, say A, and let ar,c be the entry in row r and column c of A.
We will then construct an array B wherein br,c=ar,c−w, where w=2mn−1. As the entries in A are precisely the integers [math] through mn−1, it follows that the entries in B are precisely the integers −2mn−1 through 2mn−1, the required set of integers for a tight signed magic array. It remains to be shown that B has rows and columns summing to zero.
If the sum of column c in A is s, then the sum of column c in B is s−mw, as we subtract w from each of the m entries in the column. In particular, note that as s is constant, this entire expression is independent of c; so the sum of each column in B is the same. The sum of all of the entries in B is ∑i=−wwi=∑i=−w−1i+0+∑i=1wi=−21w(w+1)+0+21w(w+1)=0. If the sum of each column is the same, and the sum of all of the columns together is zero, then the sum of each column must be zero.
Likewise, if the sum of row r in A is s, then the sum of row r in B is s−nw, as we subtract w from each of the n entries in the row. In particular, note that as s is constant, this entire expression is independent of r; so the sum of each row in B is the same. The sum of all of the entries in B is 0, so if the sum of each row is the same, then that sum must be zero. Hence, B is an SMA(m,n), where m,n are odd and greater than 1.
∎
2.3 Tight signed magic arrays with m odd, n even
For this case, we will need to make use of an induction argument with two base cases. The base cases are given in the following lemmata.
Lemma 5**.**
An SMA(3,n) exists if n is even.
Proof.
An SMA(3,2) and an SMA(3,4) are given in Figure 5.
Now let n=2k≥6 and pj=⌈2j⌉ for 1≤j≤2k . Define a 3×n array A=[ai,j] as follows. For 1≤j≤2k,
[TABLE]
For the third row we define a3,1=−3k, a3,2k=3k and when 2≤j≤2k−1
[TABLE]
Finally, a2,j=−(a1,j+a3,j) for 1≤j≤2k (see Figure 6).
It is straightforward to see that array A is an SMA(3,n).
∎
Lemma 6**.**
An SMA(5,n) exists if n is even and greater than 2.
Proof.
If n is a multiple of 4, we first apply Lemma 5 to construct an SMA(3,n). We then adjoin two more rows to the bottom of this array, creating a 2×n space. As n is a multiple of 4, we can fill this space with shifted copies of Figure 2 such that the sum of each column remains zero and the sums of rows 4 and 5 are also zero (see Figure 7).
If n is not a multiple of 4, we again use the algorithm of Lemma 5 to first construct an
SMA(3,n), say A. This array will use numbers with absolute value 1 through 23n.
Note that the first two entries in the top row of this array will be 1 and −1, and provided n>2, the first two entries in the bottom row will be −23n and −23n+3. Using the fact that each column sums to zero gives us that the first two entries in the middle row are x1=23n−1 and x2=23n−2. Of importance is the fact that x1−x2=1.
Now we will construct an SMA(5,n) as follows. The rows of array A are placed in the first three rows of this array, with the exception that x1 and x2 are swapped; that is, the first two entries in the second row are x2,x1 instead of x1,x2. The bottom two rows, ignoring the left two columns, form a 2×(n−2) array; as n−2 is a multiple of 4, this array can be tiled with shifted copies of Figure 2, using absolute values from 23n+3 to 25n (note that this includes (25n)−(23n+3)+1=n−2 consecutive absolute values). This leaves four cells in the lower left, which may then be filled as follows:
[TABLE]
Figure 8 gives an example of this construction.
Now we will prove that the resulting array is an SMA(5,n). First, we note that we have in fact used every absolute value from 1 to 25n exactly once as a positive and once as a negative value. Now consider the sum of a given row. For row 1 and row 3, the sum is zero immediately from Lemma 5. For row 2, the sum is zero because permuting the values in a row does not change their sum. For row 4 and row 5, one may observe that the left two columns cancel each other’s values, and the rest of the row is filled with shifted copies of Figure 2 guaranteed to sum to zero.
Lastly, we consider the sums of the columns. For all but the first two columns, the sum of the first three rows will be zero from Lemma 5 and the fact that the last two values cancel each other in the corresponding copy of Figure 2. In the first column, the sum can be computed by calculating the sum of the differences from the known 3×n solution, as x2−x1+(−23n−1)+(23n+2)=−1−1+2=0. In the second column, we may similarly compute the sum to be x1−x2+(23n+1)+(−23n−2)=1+1−2=0.
This completes the proof.
∎
Lemma 7**.**
There exists an SMA(m,n) for all odd m>1 and even n>2.
Proof.
For m=3,5, we apply Lemma 5 and Lemma 6, respectively.
If m>5, assume inductively that there exists an SMA(m−4,n). We then augment this array by adjoining four rows at the bottom, leaving an empty 4×n space. Place a shifted SMA(4,n) from Lemma 3 in the 4×n empty space at the bottom of the array. Then each column of the resulting m×n array sums to zero, as the first m−4 entries in the column sum to zero by assumption, and the last four entries sum to zero due to the shiftable array. Each row also clearly sums to zero. Therefore, there exists an SMA(m,n). Hence, the statement is true by strong induction.
∎
We are now ready to state the main theorem of this section.
Theorem 4**.**
An SMA(m,n) exists precisely when m=n=1, or when m=2 and n≡0,3(mod4), or when n=2 and m≡0,3(mod4), or when m,n>2.
Proof.
Note that the transpose of a signed magic array is a signed magic array, so the existence of an
SMA(m×n) ensures that of an SMA(n×m).
The result then follows immediately from the conjunction of several lemmata, as specified in
Figure 9.
∎
3 Signed magic squares
We now turn our attention to that of a signed magic square. As in the case of a tight array, we will split the problem into several cases, which will be handled independently.
Recall that we use the notation SMS(n;t) for a signed magic square with t filled cells in each row and
t filled cells in each column. An SMS(n;t) is called
k-diagonal if its entries all belong to k consecutive diagonals. In the case where k=t, we abbreviate this to simply diagonal.
We first cover the trivial case where t<3. The proof of the following result is straightforward.
Theorem 5**.**
There exists no SMS(n;t) for t<3 apart from the trivial SMS(1;1) containing a single zero.
Now, we will split into cases based on the parities of t and n.
3.1 Signed magic squares with n,t both odd
In this case, the proof is quite complex, so we begin with two lemmata.
Lemma 8**.**
Let n≥t≥3 be odd integers. Then there exists a partition A of the set S=[−2nt−1,2nt−1] such that every set in the collection A contains exactly t elements and sums to zero.
Proof.
We will let n be an arbitrary odd integer greater than or equal to 3 and induct on t.
For the base case t=3, we demonstrate the existence of a partition A by giving it an explicit construction. Let A={Cc}, where
[TABLE]
[TABLE]
and xc is defined by xc≡2(23n−1−(c−1))−1(modn),xc∈{0,1,…,n−1}.
By construction, the sum of the elements in each set Cc is zero. Therefore, it is sufficient to show that A is a partition of S. First, we show that ∣Cc∣=3. Suppose to the contrary that ∣Cc∣<3. We have cases to consider.
Case1:(c−1)−(23n−1)=−(2n−1)+xc. In this case, note that (c−1)−(23n−1)≤−(2n−1)−1, while −(2n−1)+xc≥−(2n−1), showing that this case is impossible.
Case2:(c−1)−(23n−1)=−(c−1)+(23n−1)−xc+2n−1. This equality implies 2(23n−1−(c−1))=xc−(2n−1). Note 2(23n−1−(c−1))≥n+1, while xc−(2n−1)≤2n−1, showing that this case is impossible.
Case3:−(2n−1)+xc=−(c−1)+(23n−1)−xc+2n−1. This equality implies 2xc=(23n−1)−(c−1)+(n−1). Note that when c=n, xc=0, so xc<(23n−1)−(c−1)=(2n+1) in this case. Note that as c decreases in increments of 1, xc increases in increments of 2 until c=2n−1, at which point xc=1. It is straightforward to verify that xc<(23n−1)−(c−1) for all c>2n−1, and obviously xc<(23n−1)−(c−1) for all c≤2n−1 as well, since (23n−1)−(c−1)>n in that case. Therefore, since xc<(23n−1)−(c−1) and xc≤n−1, it follows that the equality 2xc=(23n−1)−(c−1)+(n−1) cannot hold, as required.
It remains to show that if j=k, then Cj∩Ck=∅. So suppose by way of contradiction that there exist Cj,Ck with j=k and Cj∩Ck=∅. We again have cases to consider.
Case1′:(j−1)−(23n−1)=(k−1)−(23n−1), then j=k, a contradiction.
Case2′:(j−1)−(23n−1)=−(2n−1)+xk; see Case 1 above for the same argument.
Case3′:(j−1)−(23n−1)=−(k−1)+(23n−1)−xk+2n−1; see Case 2 above for the same argument.
Case4′:−(2n−1)+xj=−(2n−1)+xk. This implies xj=xk, which means that 2(23n−1−(j−1))−1≡2(23n−1−(k−1))−1(modn). This implies 2j≡2k(modn). Since n is odd, this congruence holds if and only if j≡k(modn), which is impossible.
Case5′:−(2n−1)+xj=−(k−1)+(23n−1)−xk+2n−1, refer to Case 3 in the previous part of the proof.
Case6′:−(j−1)+(23n−1)−xj+2n−1=−(k−1)+(23n−1)−xk+2n−1. This equality implies −(j−1)−(2(23n−1−(j−1))−1)+(k−1)+(2(23n−1−(k−1))−1)≡0(modn), or equivalently j≡k(modn), which is impossible.
We conclude that A is a partition of S, so in particular the base case for t=3 holds.
We now partition the set S=[−23n−1,23n−1] into three blocks of n consecutive integers. In this case, call the three blocks D1,D2,D3, where D1=[−(23n−1),−(2n+1)] and D2 and D3 are defined in the obvious manner. We claim that the two partitions A and {D1,D2,D3} of the set S are orthogonal.
Notice that the first n consecutive integers in S appear in the sets C1,C2,…,Cn, respectively.
The next n consecutive integers appear in the sets Cn,C2n−1,…,C2n+1, respectively, where for each consecutive integer the index on Cc is increased by 2n−1 and the result is taken modulo n (here, the residues used are {1,2,…,n}). To see why this is true, note that when c=n, xc=0, and −(2n−1)+xc=−(2n−1). Moreover, when the index on Cc is increased by 2n−1 (modn), a quick computation reveals that xc is increased by one, so −(2n−1)+xc is increased by one. Since 2n−1 is coprime to n, all the sets in the partition will have exactly one representative element in this block of n integers. Finally, the last n consecutive integers appear in the set C2n+1,C2n+1+1,…,C2n−1, respectively, where for each consecutive integer the index on Cc is increased by 1 and the result is taken modulo n. To see why this is true, note that when c=2n+1, −(c−1)+(23n−1)−xc+2n−1=2n+1. Moreover, when c increases by one modulo n, xc decreases by 2 modulo n, so −(c−1)+(23n−1)−xc+2n−1 increases by 1. The only break occurs when going from c=n and xc=0 to c=1 and xc=n−2, in which case the quantity −(c−1)+(23n−1)−xc+2n−1 still increases by 1.
Hence, each block of n consecutive numbers in the set S=[−23n−1,23n−1]
contains a representative from every set in A.
We will refer to these blocks D1,D2,D3 as “shiftable” for the following reason. Suppose we add
integers α1,α2 and α3 to all of the elements in the sets D1, D2 and D3, respectively. Further, let α1,α2,α3 be chosen such that the shifted blocks D1′,D2′,D3′ are disjoint. This shift naturally induces new disjoint sets C1′,…,Cn′, where Cc′={(c−1)−(23n−1)+α1,−(2n−1)+xc+α2,−(c−1)+(23n−1)−xc+2n−1+α3}. Then it is clear that ∑x∈Cc′x=α1+α2+α3, and this constant is independent of c.
For the inductive step, suppose that there exists a partition of A of the set
S=[−2nt−1,2nt−1]
into sets C1,…,Cn, where sets of n consecutive integers form shiftable blocks D1,…,Dt. We wish to show that there exists a partition A′ of the set
S′=[−2n(t+2)−1,2n(t+2)−1] into sets C1′,…,Cn′ where sets of n consecutive integers form shiftable blocks D1′,…,Dt+2′. To begin with, shift the blocks D1,…,Dt−1 by subtracting n from each of the elements. Then, shift the block Dt by adding n to each of the elements. These shifts induce new disjoint sets C1′,…,Cn′, each of which have t elements. By construction, the elements in each of the Cc′ sum to −n(t−2). We wish to ”complete” the partition by adding two elements from the set B={(n(t−4)+1)/2,(n(t−4)+1)/2+1,…,(nt−1)/2} to each Cc′. Place the first n consecutive integers in B into C2n+1′,C1′,…,Cn′, respectively, and the next n consecutive integers in B into Cn′,C2n−1′,…,C2n+1′, respectively. Note that these patterns are mirror images of each other, and that while in the first case the index on the Cc increases by 2n+1 for each consecutive integer, in the second case it increases by 2n−1, both of course taken modulo n using residues {1,…,n}. It is routine to verify that this method ensures that the quantity n(t−2) is added to each of the Cc′s. By construction, the elements in each Cc′ will sum to 0, and we have constructed a partition A′ of the set S′=[−2n(t+2)−1,2n(t+2)−1]
into sets C1′,…,Cn′ of cardinality t+2 that all sum to 0. Note that this method also guarantees that we end up with a partition with the same property of shiftable blocks. In particular, it is easy to see in general this partitioning method involves placing the first n consecutive integers in the order C1,C2…Cn, placing the next n in the order Cn,C2n−1,…,C2n+1, and placing the following n in reverse order. This pattern of skipping by 2n−1 and then skipping by 2n+1 continues to alternate until the last n consecutive integers, which are placed C2n+1,C2n+1+1,…,C2n−1 where for each consecutive integer the index on Cc is increased by 1 and the result is taken modulo n.
∎
Lemma 9**.**
Let n≥t≥3 be odd integers, and let {Di} and {Cc} be defined as in the proof of Lemma 8. Then there exists another partition {Rr} of the set S=[−2nt−1,2nt−1] orthogonal to {Cc} such that each Rr has t entries and sums to zero.
Proof.
Let ci,j be such that Cci,j contains the jth entry, in ascending order, within Di. Then thus far, we have partitioned Cc such that that there exist ki and bi such that ci,j≡kij+bi(modn). Also, ki=1 if i=1 or t, ki=2n−1 if i is even, and ki=2n+1 otherwise. Lastly, bi=n if i=t is odd, bi=2n+1 if i is even, and bt=2n−1.
Let ji,c be such that ci,ji,c=c. Then, solving the equation c≡kiji,c+bi(modn) gives us ki−1c−ki−1bi≡ji,c(modn). We may then determine values for the coefficient and constant in this congruence via modular algebra:
[TABLE]
[TABLE]
For convenience, we will let ji,c+n=ji,c for all c and introduce some definitions.
Given t,n,i, a break is a value of c in [1,n] such that ji,c+1−ji,c=ki′ (note that as determined above, ji,c+1−ji,c≡ki′(modn)). A break is positive if ji,c+1−ji,c>ki′ and negative otherwise. The magnitude of a break is ∣ji,c+1−ji,c−ki′∣, and the signed magnitude is ji,c+1−ji,c−ki′. For example,
let t=5,n=7,i=2. Then ji,c for c∈[1,7] are the values 6,4,2,7,5,3,1. (These are congruent modulo 7 to the values −2c+1.) There are two breaks: one at c=3 where j goes from 2 to 7, and one at c=7 where j goes from 1 to 6. Both are positive breaks, as 7−2=6−1>−2.
We next determine where exactly the breaks occur given t,n,i, and what their signs and magnitudes are.
If i=1, then j1,c≡c(modn). As j1,c∈[1,n] it follows that j1,c=c for c∈[1,n]. This sequence has one negative break of magnitude n at c=n, where j1,c+1−j1,c=1−n=k1′−n.
If i is even, then ji,c≡−2c+1(modn). This sequence has two positive breaks of magnitude n. One occurs at c=n, where ji,c+1−ji,c=(n−1)−1=n−2=ki′+n. The other occurs at c=2n−1, where ji,c+1−ji,c=n−2=ki′+n.
If i=t, then jt,c≡c+2n+1(modn). This sequence has one negative break of magnitude n at c=2n−1, where jt,c+1−jt,c=1−n=kt′−n.
If i=1, i=t, and i is odd, then ji,c≡2c(modn). This sequence has two negative breaks of magnitude n. One occurs at c=n, where ji,c+1−ji,c=2−n=kt′−n. The other occurs at c=2n−1, where ji,c+1−ji,c=1−(n−1)=2−n=kt′−n.
Now we define Rr. For r∈[1,n], we define Rr as follows: for i∈[1,t], Rr contains the single value in both Di and in Cc where c≡r+2n−1(i−1)(modn). For clarity, we define the function s as s(i)=2n−1(i−1) and use s(i) from now on.
Next we define an analogous symbol j′ to j: ji,r′ is the value in [1,n] such that Rr contains the ji,r′th entry, in ascending order, within Di. Note that this value must also be in Cc such that ji,c=ji,r′. It follows that ji,r′=ji,r+s(i).
As before, for convenience, we will let ji,r+n′=ji,r′ for all r.
We may define breaks in j′ in the same manner as for breaks in j. Let βi,r be the signed magnitude of the break that occurs between ji,r′ and ji,r+1′ if one exists and 0 otherwise. In other words, βi,r=ji,r+1′−ji,r′−ki′. We again divide into cases based on i.
If i=1, then j1,r′=j1,c because s(1)=0. So β1,r=−n if r=n and 0 otherwise. Note that we can alter this solution using the modular congruence modulo n to be r=0=s(1)=s(i).
If i is even, then βi,r=n when r+s(i)=n or r+s(i)=2n−1. Solving for r, we obtain r=n−s(i) or r=2n−1−s(i). Simplifying and using the congruence modulo n, we have r=−s(i) and r=−s(i−1).
If i=t, then βi,r=−n when r+s(i)=2n−1. As before, this is equivalent to r=−s(i−1).
If i=1, i=t, and i is odd, then βi,r=−n when r+s(i)=n or r+s(i)=2n−1. As before, this is equivalent to r=−s(i) or r=−s(i−1).
Let r be chosen arbitrarily, and let z∈[1,t−1] be such that r≡−s(z). Then βz,r and βz+1,r are nonzero and are each other’s opposites. Also, this matching covers and partitions all nonzero values of βi,r. Therefore, ∑i=1tβi,r=0.
Note also that ∑i=1tki′=−1+2+−2+2+−2+⋯+2+−1=0.
Now let δi be the offset of Di such that the jth element of Di in ascending order is δi+j. Then it follows by definition that ∑Rr=∑i=1t(δi+ji,r′). We will consider the difference between two consecutive Rr:
[TABLE]
So any Rr has the same sum as Rr+1; by induction, all Rr have the same sum. As the sum of these sums is ∑i=−2tn−12tn−1i=0, each sum individually is also zero.
∎
Theorem 6**.**
Let n≥t≥3 be odd integers. Then there exists an SMS(n;t).
Proof.
Let {Cc} be defined as in Lemma 8 and {Rr} as in Lemma 9. Let B=[br,c], where br,c is the single element in Rr and Cc if they have nonempty intersection and is left blank if they do not. Then every row and every column of B sums to zero, and B has exactly t entries in each of its n rows and n columns. Thus B is the desired array (see Figure 10).
∎
3.2 Signed magic squares with n odd, t even
For most of the remaining square cases, we will need the following two lemmata.
Lemma 10**.**
For all positive integers n≥4, there exists a shiftable diagonal SMS(n;4).
Proof.
Let n be a positive integer. Define array A=[ai,j] by:
[TABLE]
and the cells are left empty otherwise. Figure 11 provides an example of such an array for n=8.
It is straightforward to verify that A contains all the entries in the set [−2n,2n] and that each of the entries appears exactly one time in the array. Moreover, by construction this array has the property that four adjacent diagonals are filled. It remains to check that rows and columns sum to 0.
For the rows, if 1≤i≤n−3, the sum of the entries in row i is i−i+(2n−i)−(2n−i)=0, as desired. If i=n−2, the sum is −(n+2)+(n−2)−(n−2)+(2n−(n−2))=0. If i=n−1, the sum is −(n−1)+(n−1)−(n−1)+(n−1)=0. Finally, the sum of the entries in the last row must be [math], because the sum of all the entries in the array is [math].
For the columns, if j=1 then the sum is 1−(n+2)−(n−1)+2n=0. If j=2 the sum is −1+2−(n+1)+n=0. If j=3, the sum is (2n−1)−2+3−2n=0. If 4≤j≤n−1, the sum is j−(j−1)+(2n−(j−2))−(2n−(j−3))=0, as required. Finally, the sum of the entries in the last column must be [math], because the sum of all the entries in the array is [math]. This completes the proof.
∎
Lemma 11**.**
Assume that there exists a k-diagonal SMS(n;t) with k≤n−4 and either t or n is even. Then there exists a (k+4)-diagonal SMS(n;t+4).
Proof.
Let A be a k-diagonal SMS(n;t) with k≤n−4 and either t or n even. Note that the entries in A can be partitioned into n diagonals, and that as k≤n−4, at least four consecutive diagonals are empty, and we may choose these four consecutive diagonals to be adjacent to the k diagonals in which A’s entries are contained.
Let B be the shiftable diagonal SMS(n;4) given by Lemma 10. Let B′ be a copy of B with the entries shifted to have absolute values in [2tn+1,2(t+4)n] rather than [1,2n] and with the columns permuted to place the four diagonals of B into the same cells as the four empty diagonals of A.
Then A and B′ do not share any filled cells, and together their entries occupy k+4 consecutive diagonals; each array has zero row and column sums; and the two arrays together use each number in [−2(t+4)n,−1] and [1,2(t+4)n] exactly once. By combining the two arrays into one, A+B′, we achieve the desired signed magic square.
∎
Now, we move on to actually considering the case where t is even and n is odd. We will prove this by an induction, one of whose base cases is complex enough to warrant another lemma.
Lemma 12**.**
Let n>6 be odd. Then there exists a shiftable diagonal SMS(n;6).
Proof.
From Lemma 4, there exists an SMS(3,n), say A, using entries in [−23n−1,23n−1]. Let ai,j′=ai,j+23n+1. Then A′ uses each number in [1,3n] exactly once, and the sum of every column of A′ is the same.
We define an array B=[bi,j] as follows. For i∈[1,3] and j∈[1,n], let i′,j′∈[1,n] with i′≡2i−1+j−1(modn) and j′=j. Then bi′,j′=ai,j′, and bi′,j′+1=−ai,j′ (using the convention that bi′,n+1=bi′,1). All other cells in B are left empty.
We will now determine the possible values i′ and j′ can take for bi′,j′ to be filled. We must have i′≡2i+j−2(modn) and j′=j+s for i∈[1,3], j∈[1,n], and s∈{0,1}.
Note that these equations imply i′−j′≡2i+j−2−j−s≡2i−s−2(modn); in fact, this is equivalent to the above conditions, because j can range from 1 to n. Therefore i′−j′ must be one of the values {2i−s−2}={−1,0,1,2,3,4}. Thus, B consists of six consecutive diagonals.
Observe that in row i′ of B, as we have defined B, the nonempty cells partition naturally into pairs of opposite entries; so the row sums to zero.
Now in column j′, there are six entries. These six entries are a1,j′, a2,j′, a3,j′, −a1,j′−1, −a2,j′−1, and −a3,j′−1 (using the convention that ai,0=ai,n). One may verify using the congruences given above that these six numbers are indeed placed in column j′. Then the sum of column j′ is the sum of these six entries. As stated earlier, a1,j′+a2,j′+a3,j′=a1,j′−1+a2,j′−1+a3,j′−1, so the column sums to zero. Thus array B has the desired properties (see Figure 12).
∎
Now, we give the full induction argument.
Theorem 7**.**
Given n>t>3 with n odd and t even, there exists a shiftable diagonal SMS(n;t).
Proof.
We prove this by induction with two base cases, the cases where t=4 and t=6, which are given by Lemma 10 and by Lemma 12, respectively.
Now assume that such arrays exist for all even t′<t greater than 3, in particular for t′=t−4. Then we may apply Lemma 11 to construct a diagonal SMS(n;t). Hence, the statement is true by induction.
∎
3.3 Signed magic squares with n,t both even
We begin with the case t or n is a multiple of 4.
Lemma 13**.**
Let t and n be even positive integers, with t≤n and either t or n divisible by 4. Then there exists an SMS(n;t).
Proof.
By the assumption 2nt is a multiple of four. By Theorem 2, this implies that there exists a tight integer 2n×t Heffter array, say A=[ai,j]. Let Ai denote the row i of A.
We will create two orthogonal partitions, {Rr} and {Cc}, of the set X=[−2nt,−1]∪[1,2nt]. Note that due to the definition of Heffter array, X is precisely the set of entries in A with their opposites.
Therefore we will let R2i−1=Ai, and let R2i contain the opposites of Ai, for i∈[1,2n]. It is apparent that E1={Rr∣r\mboxisodd} partition the set of entries in A while
E2={Rr∣r\mboxiseven} partition the set of their opposites; therefore E1∪E2 partition X. In addition, the sum of the entries in a given Rr will either be the sum of a row of A (zero, by definition), or its opposite (also zero). Lastly, we note that ∣Rr∣=t, the cardinality of a row of A.
Now we define Cc. For c∈[1,2n] and j∈[1,2t], let i∈[1,2n] be such that i−j+1≡c(mod2n). Then −ai,j,ai,j∈Cc. For c∈[2n+1,n] and j∈[2t+1,t], let i∈[1,2n] be such that i−j+1+2t+2n≡c(mod2n). Then again −ai,j,ai,j∈Cc.
Note that exactly one Cc contains each entry in A, as given j and c, where j≤2t iff c≤2n, there will be exactly one i solving the modular congruence above. As Cc contains the opposites to its elements as well, it follows that {Cc} partitions X. Also, note that Cc contains two elements from each of half of the columns of A, so ∣Cc∣=t.
Now by definition of Cc, if Cc contains x, then Cc contains −x; so the sum of each Cc is zero. Lastly, we need to prove that {Rr} and {Cc} are orthogonal partitions. Let i∈[1,2n] be arbitrary. Then R2i−1=Ai. Assume that there is some c such that Cc and Ai have two elements, namely
ai,j and ai,j′, in common. Because different Cc are used for the left and right halves of A, we can assume that j and j′ are on the same side, i.e. j,j′∈[1,2t] or j,j′∈[2t+1,t]. In the former case, we have i−j+1≡i−j′+1(mod2n); in the latter case, we have i−j+1+2t+2n≡i−j′+1+2t+2n(mod2n). In either case, canceling, j≡j′(mod2n). But this is impossible, as ∣j′−j∣ is at most 2t−1, and 2t−1<2t≤2n.
Therefore Cc and Ai=R2i−1 have at most one element in common. Because Cc contains opposites to all of its elements, we may similarly say that Cc and R2i have at most one element in common, as if they shared two elements x and x′, Cc and Ai would share −x and −x′. So {Cc} and {Rr} are orthogonal partitions.
Define array B as follows: the cell (r,c) of B contains the single element in Rr∩Cc if they have nonempty intersection and is left blank otherwise. Then every row and every column of B sums to zero, and B has exactly t entries in each of its n rows and n columns. Thus B is the desired array (see Figure 13).
∎
The rest of this case proceeds much as the case where t is even and n is odd, but with one important difference: instead of a diagonal SMS(n;6) for n even, we construct a 7-diagonal SMS(n;6) and show that this gives sufficient results.
Lemma 14**.**
Let n≡2(mod4) and n≥10. Then there exists a shiftable 7-diagonal SMS(n;6).
Proof.
In Lemma 6, we gave a construction that partitions the interval [−23m−1,23m−1] into sets of three of equal sum for any odd m≥3. Let m=n−1, and after carrying out this partition, add 23m−1+1 to every number in the partition, giving a partition of [1,3n−3] into sets of three of equal sum 29n−6. We make three other observations about this partition.
-
The numbers in [1,n−1] are placed in distinct sets, as are the numbers in [n,2n−2] and [2n−1,3n−3].
2. 2.
The number 1 is in the same set in the partition as the number 2n−3.
3. 3.
The number n−1 is in the same set in the partition as the number n.
Now define the function p as follows:
[TABLE]
Note that on the domain [1,3n−3], the range of p is [1,3n]∖{1,23n,3n}. These three remaining numbers add to S=29n+2.
We apply p to every element of our previous partition of [1,3n−3] to partition the other elements of [1,3n] into sets of three. It follows from observation 1 above that 2n−2 of these, which we will call “the first class,” now have sum 29n−6+1+1+2=29n+2, while the other 2n, which we call “the second class,” have sum 29n−6+1+2+2=29n+4.
Label every set in the partition plus {1,23n,3n} with the labels P1,P2,…,Pn, such that i∈Pi. Then from observation 2 above, p(2n−3)=2n−1∈P2. This means that P2 is of the second class as defined earlier, so ∑P2=29n+4. Also, note that from observation 3, p(n)=n+1∈Pn.
We now pair the Pi into pairs Bj, with j∈[1,2n], as follows: B1 contains P1 and P2. Then the other Bj may be chosen arbitrarily, following two constraints.
-
Each Bj, j=1, contains two Pi with equal sums. (This is possible because ∑P1=∑P2, and of the remaining (n−2) sets, exactly 2n−2 are in the first class and 2n−2 are in the second class, as defined above. Because n≡2(mod4), we know that 2n−2 is even.)
2. 2.
Pn∈B2.
Now, we define an n×n array A=[ai,j] as follows. Let j∈[1,2n] and k∈[1,3]. Then Bj contains two Pi, say Pi1 and Pi2, with i1>i2. Arrange the elements in each of these in order, so that we may refer to them as Pi,1, Pi,2, and Pi,3, for i∈{i1,i2}. We will place easily satisfied constraints on this otherwise arbitrary labeling: P1,2=1,P2,2=2,Pn,1=n,Pn,2=n+1.
For convenience, we will let the indices in A “wrap around,” so that e.g. an+1,n+3=a1,3. Then for each j,k as above, we fill the following cells:
[TABLE]
We leave the other cells in A empty.
Note that in this array, each row contains three numbers and their opposites and thus sums to zero. As for the columns, each column 2j−1 contains Pi1 and the opposite of Pi2, while column 2j contains Pi2 and the opposite of Pi1. It follows that every column sums to zero except for the first column, which sums to ∑P2−∑P1=29n+4−29n+2=1, and the second column, which sums to ∑P1−∑P2=−1.
We will make a few other observations about this array, related to which numbers are in which cells: a3,1=P2,2=2, a4,2=P1,2=1, a3,3=Pn,1=n, a3,4=−n, a5,3=Pn,2=n+1, a5,4=−(n+1), a4,3+a4,4=0.
Let A′ be defined as A with several exceptions: a3,1′=a4,2;
a4,2′=a3,1;
a3,3′=a5,3;
a4,3′=a3,3;
a5,3′=a4,3;
a4,4′=a5,4;
a5,4′=a4,4.
We see that this is a permutation, so the (multi-)set of entries used in A′ is the same as that of A: the elements [−3n,−1] and [1,3n], each exactly once.
In A′, every element is in the same column as in A with the exception of a3,1′=1 and a4,2′=2. It follows that the sum of column 1 is now 1−2+1=0, while the sum of column 2 is now −1−1+2=0.
The only rows that have changed from A to A′ are rows 3, 4, and 5.
[TABLE]
Thus, in A′, every row and every column contains six entries that sum to zero, and every number in [−3n,−1]∪[1,3n] is used exactly once. Note lastly that if k∈[1,3]:
[TABLE]
So in any filled cell in A, or equivalently in A′, the difference between the row and column indices is congruent to an element of [−1,5] modulo n. The set [−1,5] has cardinality 7, so A′ uses cells only in seven consecutive diagonals. This concludes the proof, as A′ is the array we seek. An example of this construction is given in Figure 14.
∎
Now, we apply an induction argument, as in Theorem 7.
Theorem 8**.**
Given n≥t>3 with n,t even, there exists an SMS(n;t). If t<n with t,n≡2(mod4), this square is (t+1)-diagonal.
Proof.
If t or n is a multiple of 4, we may apply Lemma 13.
If t=n, Lemma 3 gives us the desired result, as the square is tight.
Otherwise, we proceed by induction. In the base case, let t=6; then there exists a 7-diagonal
SMS(n,t) by Lemma 14.
For 6<t<n, assume there exists a (t−3)-diagonal SMS(n;t−4). Then there exists a (t+1)-diagonal SMS(n;t) by Lemma 11.
Therefore, by induction and the other cases, there exist such squares for all even t,n>2.
∎
3.4 n even, t odd
This is the most complex case, requiring several subcases of its own. We may proceed by an induction argument as in the previous cases, but the base case becomes much more complex. We give five such cases.
Lemma 15**.**
Let n≥4 be an even integer. Then there exists an SMS(n;3).
Proof.
We construct two orthogonal partitions, {Cc} and {Rr}, of the set [−23n,−1]∪[1,23n]. First, construct an SMA(3,2k), say A=[ai,j],
using the construction given in the proof of Lemma 5, where 2k=n. The first partition is {Cc}, where Cc is the set consisting of all the entries in the cth column. It is now sufficient to demonstrate the existence of a partition, {Rr}, that is orthogonal to {Cc} and consists of n sets of cardinality 3 that sum to zero. Define this partition as follows: for 1≤r≤n, let Rr=−Cr, where −Cr={−c:c∈Cr}. This collection of sets clearly partitions [−23n,−1]∪[1,23n] into n sets of cardinality 3 that sum to 0, so it remains to show that it is orthogonal to {Cc}. Note this is equivalent to proving that the opposites of the entries of a given column j in A all lie in different columns. In fact, because of the zero-sum property of the rows and columns in A, it is sufficient to show that two of the entries in each column, when negated, lie in different columns.
So fix j and consider the entries −ai,j for i=1,2,3. We must consider cases depending on the value of j. If j=1, the entries are 1,23n−1, and −3n. Note −1 lies in the second column, while 3n lies in the nth column.
Next, suppose that 1<j<n and j≡0(mod4). Then the entries in the column are −(23pj−2),−3(k−pj), and 23pj−2+3(k−pj), where pj=⌈2j⌉. Note 23pj−2=23pj−1−2 and j−1≡3(mod4). Therefore, 23pj−2 lies in column j−1. On the other hand, 3(k−pj)=3(k−pj+1+1), and j+1≡1(mod4). Thus, 3(k−pj) lies in column j+1.
Now suppose that 1<j<n and j≡1(mod4). Then the entries in the column are (23pj−1),3(k−pj+1), and −(23pj−1)−3(k−pj+1). Note −(23pj−1)=−(23pj+1−1) and j+1≡2(mod4). Therefore, −(23pj−1) lies in column j+1. On the other hand, −3(k−pj+1)=−3(k−pj−1), and j−1≡0(mod4). Thus, 3(k−pj) lies in column j−1.
Next, suppose that 1<j<n and j≡2(mod4). Then the entries in the column are −(23pj−1),−3(k−pj), and 23pj−1−3(k−pj). Note 23pj−1=23pj−1−1 and j−1≡1(mod4). Therefore, 23pj−1 lies in column j−1. On the other hand, 3(k−pj)=3(k−pj+1+1), and j+1≡3(mod4). Thus, 3(k−pj) lies in column j+1.
Finally, suppose 1<j<n and j≡3(mod4). Then the entries in the column are (23pj−2),3(k−pj+1), and −(23pj−2)−3(k−pj+1). Note −(23pj−2)=−(23pj+1−2) and j+1≡0(mod4). Therefore, −(23pj−2) lies in column j+1. On the other hand, −3(k−pj+1)=−3(k−pj−1), and j−1≡2(mod4). Thus, 3(k−pj) lies in column j−1.
It is unnecessary to check the last column because if the last column did have the property that two of its elements, when negated, were in the same column, then another column would have that same property.
Let B be the n×n array where cell (i,j) contains the element common to Ri and Cj if such an element exists, and is left blank otherwise. Then B contains 3 entries in each row and column that sum to zero, as required (see Figure 15).
∎
Lemma 16**.**
Let n=4k with k≥1. Then there exists a diagonal SMS(n;3).
Proof.
We define three finite sequences ai,bi,ci, with i∈[1,n], which together contain every integer in [−23n,−1]∪[1,23n] exactly once.
[TABLE]
[TABLE]
[TABLE]
First, we must prove that these sequences, together, contain every number in the specified range. Let x be an integer with ∣x∣∈[1,6k]=[1,23n].
If x=3y for integer y>0, we have by=x.
If x=−3y for integer y>0, either y=2k or y<2k. In the former case, x=b4k. In the latter case, x=bi where i=4k−y.
If x=3y−2 for −2k<y≤−k, then x=ai where i=1−2k−2y.
If x=3y−2 for −k<y<k, then x=ai where i=2k−2y.
If x=3k−2, then x=a4k.
If x=3y−2 for k<y≤2k, then x=ai where i=1+6k−2y.
If x=3y−1 for −2k<y≤2k, then x=ci such that x−1=ai, which is given by the previous cases.
Note that {ai}, {bi}, and {ci} are all disjoint, because ai≡1(mod3), bi≡0(mod3), and ci≡2(mod3) for all i.
As {ai}∪{bi}∪{ci}⊇[−6k,−1]∪[1,6k], and these sets both have cardinality 12k, it follows that they are the same set, so ai,bi,ci contain between them every integer in [−6k,−1]∪[1,6k] exactly once.
Now we will prove the following additional property of these sequences: letting an+1=a1, bn+1=b1, and cn+1=c1, then for all i∈[1,n], we have ai+bi+1+ci+1=ai+1+bi+1+ci=0. Note that we need only prove that the first expression is zero, as ai+1+ci=ci+1−1+ai+1=ai+ci+1.
Let i<2k with 2∤i. Then
[TABLE]
Let i<2k with 2∣i. Then
[TABLE]
Let 2k<i<4k−1 with 2∤i. Then
[TABLE]
Let 2k≤i<4k with 2∣i. Then
[TABLE]
Let i=4k−1. Then
[TABLE]
Let i=4k. Then
[TABLE]
Now we define an n×n array A as follows:
[TABLE]
with the remaining cells empty (see Figure 16). Then the ith row of A contains ci, bi+1 and ai+1, which add to 0. The jth column contains cj, bj, and aj−1 (letting a0=an), which also add to 0. The array A thus contains three consecutive diagonals filled with the integers in [−23n,−1] and [1,23n] such that the sum of the three integers in each row and in each column is zero.
∎
Lemma 17**.**
Let n=4k with k>1. Then there exists a diagonal SMS(n;5).
Proof.
We define five finite sequences ai,bi,ci,di,ei, with i∈[1,n], which together contain every integer in [−25n,−1]∪[1,25n] exactly once.
[TABLE]
[TABLE]
[TABLE]
di=bi+3 and
ei=ai+1.
First, we must prove that these sequences, together, contain every number in the specified range. Let x be an integer with ∣x∣∈[1,10k]=[1,25n].
If x=5y for integer y>0, we have cy=x.
If x=−5y for integer y>0, either y=2k or y<2k. In the former case, x=c4k. In the latter case, x=ci where i=4k−y.
If x=5y−3 for odd y such that −2k<y<−1, then x=ai where i=−2y−5.
If x=5y−3 for y=−1, then x=a4k−3.
If x=5y−3 for odd y such that −1<y<2k−1, then x=ai where i=4k−2y−2.
If x=5y−3 for y=2k−1, then x=a4k.
If x=5y−3 for even negative y, then x=ai where i=−2y−2.
If x=5y−3 for y=0, then x=a4k−2.
If x=5y−3 for even positive y, then x=ai where i=4k−2y+3.
If x=5y−2, then there is an i such that x−1=ai, per the above. Then x=ei.
If x=5y−4 for −2k<y≤−k, then x=bi where i=−2k−2y+1.
If x=5y−4 for y=−k+1, then x=b4k−1.
If x=5y−4 for y=−k+2, then x=b4k−3.
If x=5y−4 for −k+3≤y≤k+2, then x=bi where i=2k+2y−4.
If x=5y−4 for k+3≤y≤2k, then x=bi where i=6k−2y+1.
If x=5y−1, then there is an i such that x−3=bi, per the above. Then x=di.
Note that {ai}, {bi}, {ci}, {di}, and {ei} are all disjoint, because ai≡2(mod5), bi≡1(mod5), ci≡0(mod5), di≡−1(mod5), and ei≡−2(mod5) for all i.
As {ai}∪{bi}∪{ci}∪{di}∪{ei}⊇[−10k,−1]∪[1,10k], and these sets both have cardinality 20k, it follows that they are the same set, so ai,bi,ci,di,ei contain between them every integer in [−10k,−1]∪[1,10k] exactly once.
For convenience, the subscripts of these sequences will be treated as elements of Zn. For example, the notation an+7 will refer to a7.
Now consider the expression Si=ai−2+bi−1+ci+di+ei. We will compute the value of this expression for all i∈[1,n].
If i=1, then Si=ai−2+bi−1+ci+di+ei=7+5k+6+5−5k−4+3−18+1=0.
If i=2, then Si=ai−2+bi−1+ci+di+ei=10k−8−5k−4+10−5k+11+3−13+1=0.
If i=4j+3 with j≥0 and i≤2k, then Si=ai−2+bi−1+ci+di+ei=−10j−18−5k+10j+11+20j+15−5k−5(2j+1)−4+3+10k−10j−3+1=0.
If i=4j+4 with j≥0 and i≤2k, then Si=ai−2+bi−1+ci+di+ei=−10j−13−5k−5(2j+1)−4+20j+20−5k+5(2j+1)+11+3+10k−10j−18+1=0.
If i=4j+1 with j>0 and i≤2k, then Si=ai−2+bi−1+ci+di+ei=10k−10(j−1)−3−5k+5(2j−1)+11+20j+5−5k−10j−4+3−10j−18+1=0.
If i=4j+2 with j>0 and i≤2k, then Si=ai−2+bi−1+ci+di+ei=10k−10(j−1)−18−5k−10j−4+20j+10−5k+10j+11+3−10j−13+1=0.
If i=4j+1>2k with i<4k−3, then Si=ai−2+bi−1+ci+di+ei=10k−10(j−1)−3−5k+5(2j−1)+11−20k+20j+5+15k−10j−4+3−10j−18+1=0.
If i=4j+2>2k with i<4k−3, then Si=ai−2+bi−1+ci+di+ei=10k−10(j−1)−18+15k−10j−4−20k+20j+10−5k+10j+11+3−10j−13+1=0.
If i=4j+3>2k with i<4k−3, then Si=ai−2+bi−1+ci+di+ei=−10j−18−5k+10j+11−20k+20j+15+15k−5(2j+1)−4+3+10k−10j−3+1=0.
If i=4j+4>2k with i<4k−3, then Si=ai−2+bi−1+ci+di+ei=−10j−13+15k−5(2j+1)−4−20k+20j+20−5k+5(2j+1)+11+3+10k−10j−18+1=0.
If i=4k−3, then Si=ai−2+bi−1+ci+di+ei=10k−10(k−2)−3−5k+5(2k−3)+11−20k+20k−15−5k+6+3−8+1=0.
If i=4k−2, then Si=ai−2+bi−1+ci+di+ei=10k−10(k−2)−18−5k+6−20k+20k−10−5k+5(2k−2)+11+3−3+1=0.
If i=4k−1, then Si=ai−2+bi−1+ci+di+ei=−8−5k+5(2k−2)+11−20k+20k−5−5k+1+3+10k−10(k−1)−3+1=0.
If i=4k, then Si=ai−2+bi−1+ci+di+ei=−3−5k+1−10k−5k+5(2k−1)+11+3+10k−8+1=0.
So Si=0 for all i∈[1,n].
Now consider Si′=ai+bi+ci+di−1+ei−2. From the definitions of di and ei, we see that Si′=ei−1+di−3+ci+bi−1+3+ai−2+1=ei+di+ci+bi−1+ai−2=Si=0.
We will now define an n×n square array A=[ai,j] in which we fill five consecutive diagonals. Again, the indices of A will be considered as elements of Zn. For i∈[1,n], we let
ai,i+2=ai,
ai,i+1=bi,
ai,i=ci,
ai+1,i=di and
ai+2,i=ei,
with the other cells empty (see Figure 17).
Clearly this fills precisely five adjacent diagonals of A with the elements in [−10k,−1]∪[1,10k].
Now in row i of A, the five cells filled are ai,i+2=ai, ai,i+1=bi, ai,i=ci, ai,i−1=di−1, and ai,i−2=ei−2. The sum of these five cells is Si′=0.
In column i of A, the five cells filled are ai+2,i=ei, ai+1,i=di, ai,i=ci, ai−1,i=bi−1, and ai−2,i=ai−2. The sum of these five cells is Si=0.
Therefore A is a diagonal SMS(n;5), where n≡0(mod4) and n≥8.
∎
Lemma 18**.**
Let n=4k+2 with k≥1. Then there exists a diagonal SMS(n;5).
Proof.
Let n=4k+2. Define A=[ai,j] as follows.
If i=j
[TABLE]
If i≡j−2(modn)
[TABLE]
If i≡j−1(modn)
[TABLE]
If i≡j+1(modn), then ai,j=ai−1,j+1+3;
if i≡j+2(modn), then
ai,j=ai−2,j+2+1,
where for convenience we define ai+n,j=ai,j and ai,j+n=ai,j. Let all other cells be blank.
Now, for each diagonal, or congruence class of i−j(modn), this function is defined on n positive integer values for i. Hence, the function as a whole has a range R with ∣R∣≤5n. Consequently, it suffices to show that for every x∈[−25n,−1]∪[1,25n], there exists an ai,j with ai,j=x as according to the function defined above.
Let x∈[−25n,−1]∪[1,25n] be arbitrary. If x≡0(mod5), then either x=5ℓ or x=−5ℓ for some ℓ∈[1,2n]. If x>0, let i=j=ℓ. If −25n<x<0, then let i=j=n−ℓ. Finally, if x=−25n, let i=j=n.
If x≡1(mod5), we consider some cases. If −9−5k≤x<0, let i=52(x+9+5k)+5. If x<−9k−5, let i=52(x+5n−5k)+8. If 0<x<5k+1 and x=45n−26, then let i=52(x+9+5k)+5. If x≥5k+1, then let i=52(x−5k−1)+8. If x=45n−26, let i=n. For all these cases, let j≡i+1(modn).
If x≡2(mod5), we consider some cases. If x>0, then let i=n−5x−2. If x<0, let i=−(5x+3)+1.
It is routine to verify that all these choices of x yield integer values of i between 1 and n, and that for the corresponding i value ai,j=x according to the function defined above.
To cover the remaining congruence classes that x could assume, note that all of the terms ai,j satisfying i≡j−1(modn) are translates of elements of the array when i≡j−1. In particular, 3 is added to each of the entries. Hence, the fact that the function covers all values of x≡4(modn) follows from the fact that it covers all values with x≡1(modn). An analogous argument shows that the array contains all values of x when x≡3(modn). We conclude that the array contains every element in [−25n,−1]∪[1,25n] exactly once.
Now we must show that all rows and columns in the array sum to zero. First consider the rows. We again have several cases to consider.
If i=1, then ∑jai,j=5(1)−3−5(1−1)−9−5k+5(21−1)+45n−26+3+5(n−(n−1))+2+1=5−3−9−4−5(4n−2)+45n−26+3+5+3=5−3−9−4+3+5+3=0.
If i=2, ∑jai,j=5(2)−3−5(2−1)+5k+1+5(22−2)−9−5k+5(22−2)+3+5(n−n)+2+1=10−3−5+1−9+3+2+1=0.
If 2<i≤2n and i is odd, then ∑jai,j=5i−3−5(i−1)−9−5k+5(2i−1)+5k+1+5(2i−3)+3−3−5(i−3)+1=−3+5−9−10+1+3−3+15+1=0.
If 2<i≤2n and i is even, then ∑jai,j=5i−3−5(i−1)+5k+1+5(2i−2)−9−5k+5(2i−2)+3−3−5(i−3)+1=−3+5+1−10−9+3−3+15+1=0.
If 2n<i<2k+5 and i is odd, then ∑jai,j=−5(n−i)+5(n−i)+2−9−5k+5(2i−1)+5k+1+5(2i−3)+3−3−5(i−3)+1=2−9−10+1+3−3+15+1=0.
If 2n<i<2k+4 and i is even, then ∑jai,j=−5(n−i)+5(n−i)+2+5k+1+5(2i−2)−9−5k+5(2i−2)+3+3−3−5(i−3)=2+1−10−9+3−3+15+1=0.
If 2k+5≤i<n and i is odd, then ∑jai,j=−5(n−i)+5(n−i)+2−9−5k+5(2i−1)+5k+1+52i−3−5n+3+5(n−(i−2))+2+1=2−9−10+1+3+10+2+1=0.
If 2k+4≤i<n and i is even, then ∑jai,j=−5(n−i)+5(n−i)+2+5k+1+5(2i−2)−5n−9−5k+5(2i−2)+3+5(n−(i−2))+2+1=2+1−10−9+10+1+3+2=0.
If i=n, then the entries in the row must sum to zero, because all the other rows sum to zero and the sum of all entries in the array is 0.
Now we consider similar cases with the columns.
If j=1, then ∑iai,j=5(1)+5(n−(n−1))+2+45n−26−9−5k+5(21−1)+3−3−5(1−1)+1=5+5+45n−26−45(n−2)−9+3−3+1=10−4−9+2+3−3+1=0.
If j=2, then ∑iai,j=5(2)+5(n−n)+2−9−5k+5(21−1)+5k+1+(22−2)+3−3−5(1)+1=10+2−9+3−3+1−5+1=0.
If 2<j≤2n and j is odd, then ∑iai,j=5j−3−5(j−3)+5k+1+5(2j−3)−9−5k+5(2j−1)+3−3−5(j−1)+1=−3+15+1−10−9+3−3+5+1=0.
If 2<j≤2n and j is even, then ∑iai,j=5j−3−5(j−3)−9−5k+5(2j−2)+5k+1+5(2j−2)+3−3−5(j−1)+1=−3+15−9+1−10+3−3+5+1=0.
If 2n<j<2k+5 and j is odd, then ∑iai,j=−5(n−j)−3−5(j−3)+5k+1+5(2j−3)−9−5k+5(2j−1)+3+5(n−j)+2+1=−3+15+1−10−9+3+2+1=0.
If 2n<j<2k+4 and j is even, then ∑iai,j=−5(n−j)−3−5(j−3)−9−5k+5(2j−2)+5k+1+5(2j−2)+3+5(n−j)+2+1=−3+15−9−10+1+3+2+1=0.
If 2k+5≤j<n and j is odd, then ∑iai,j=−5(n−j)+5(n−(j−2))+2+5k+1+5(2j−3)−5n−9−5k+5(2j−1)+3+5(n−j)+2+1=10+2+1−10−9+3+2+1=0.
If 2k+4≤j<n and j is even, then ∑iai,j=−5(n−j)+5(n−(j−2))+2−9−5k+5(2j−2)+5k+1+5(2j−2)−5n+3+5(n−j)+2+1=10+2−9−10+1+3+2+1=0.
If i=n, then the entries in the column must sum to zero, because all the other columns sum to zero and the sum of all entries in the array is 0 (see Figure 18).
We conclude that if n≡2(mod4), there exists a diagonal SMS(n;5)
∎
Lemma 19**.**
Let n=4k+2 with k≥2. Then there exists a diagonal SMS(n;7).
Proof.
We define seven finite sequences ai,bi,ci,di,ei,fi,gi, with i∈[1,n], which together contain every integer in the required set X=[−27n,−1]∪[1,27n] exactly once.
[TABLE]
[TABLE]
[TABLE]
[TABLE]
ei=ci+5,
fi=bi+3, and
gi=ai+1.
First, we must prove that these sequences, together, contain every number in the specified range. Let x∈X.
If x=7y for integer y>0, we have cy=x.
If x=−7y for integer y>0, either y=2k+1 or y<2k+1. In the former case, x=d4k+2. In the latter case, x=di where i=4k+2−y.
If x=7y+1 for integer y such that y<−k, then x=ci where i=−2k−2y−1.
If x=7y+1 for integer y such that −k≤y<k, then x=ci where i=2k−2y+1.
If x=7k+1, then x=c4k+2.
If x=7y+1 for integer y such that k<y, then x=ci where i=6k−2y+1.
If x=7y+2 for integer y such that y<−1, then x=bi where i=4k+y+4.
If x=7y+2 for integer y such that y≥−1, then x=bi where i=y+2.
If x=7y+3 for integer y such that y<0, then x=ai where i=−y.
If x=7y+3 for integer y such that y≥0, then x=ai where i=4k−y+2.
If x=7y+4 for integer y, then there exists an i such that x−1=ai, and x=gi.
If x=7y+5 for integer y, then there exists an i such that x−3=bi, and x=fi.
If x=7y+6 for integer y, then there exists an i such that x−5=ci, and x=ei.
Note that {ai}, {bi}, {ci}, {di}, {ei}, {fi}, and {gi} are all disjoint, because ai≡3(mod7), bi≡2(mod7), ci≡1(mod7), di≡0(mod7), ei≡−1(mod7), fi≡−2(mod7), and gi≡−3(mod7) for all i.
As {ai}∪{bi}∪{ci}∪{di}∪{ei}∪{fi}∪{gi}⊇X, and these sets both have cardinality 28k+14, it follows that they are the same set, so ai,bi,ci,di,ei,f,g contain between them every integer in X exactly once.
For convenience, the subscripts of these sequences will be treated as elements of Zn. For example, the notation an+7 will refer to a7.
Now consider the expression Si=ai−3+bi−2+ci−1+di+ei+fi+gi. We will compute the value of this expression for all i∈[1,n].
If i=1, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(4k)+17−28k+7(4k+1)−26+7k+1+7−7k−6+5+7−12+3−7+3+1=0.
If i=2, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(4k+1)+17−28k+7(4k+2)−26−7k−6+14+7k−7+1+5+14−12+3−14+3+1=0.
If i=3, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(4k+2)+17+7−12+7k−7+1+21−7k−7−6+5+21−12+3−21+3+1=0.
If i=2j≤2k+1, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=−7(2j−3)+3+7(2j−2)−12−7k−7(j−1)−6+7(2j)+7k−7j+1+5+7(2j)−12+3−7(2j)+3+1=0.
If i=2j+1≤2k+1, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=−7(2j−2)+3+7(2j−1)−12+7k−7j+1+7(2j+1)−7k−7j−6+5+7(2j+1)−12+3−7(2j+1)+3+1=0.
If i=2k+2, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=−7(2k−1)+3+7(2k)−12−7k−7k−6−28k+7(2k+2)−14+7k−7(k+1)+1+5+7(2k+2)−12+3+28k−7(2k+2)+17+1=0.
If i=2k+3, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=−7(2k)+3+7(2k+1)−12+7k−7(k+1)+1−28k+7(2k+3)−14+21k−7(k+1)+8+5−28k+7(2k+3)−26+3+28k−7(2k+3)+17+1=0.
If i=2k+4, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=−7(2k+1)+3+7(2k+2)−12+21k−7(k+1)+8−28k+7(2k+4)−14+7k−7(k+2)+1+5−28k+7(2k+4)−26+3+28k−7(2k+4)+17+1=0.
If i=2j+1 with 2k+4<i<4k+2, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(2j−2)+17−28k+7(2j−1)−26+7k−7j+1−28k+7(2j+1)−14+21k−7j+8+5−28k+7(2j+1)−26+3+28k−7(2j+1)+17+1=0.
If i=2j with 2k+4<i<4k+2, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(2j−3)+17−28k+7(2j−2)−26+21k−7(j−1)+8−28k+7(2j)−14+7k−7j+1+5−28k+7(2j)−26+3+28k−7(2j)+17+1=0.
If i=4k+2, then Si=ai−3+bi−2+ci−1+di+ei+fi+gi=28k−7(4k−1)+17−28k+7(4k)−26+21k−7(2k)+8−14k−7+7k+1+5−28k+7(4k+2)−26+3+28k−7(4k+2)+17+1=0.
So Si=0 for all i∈[1,n].
Now consider Si′=ai+bi+ci+di+ei−1+fi−2+gi−3. From the definitions of ei, fi, and gi, we see that Si′=gi−1+fi−3+ei−5+di+ci−1+5+bi−2+3+ai−3+1=gi+fi+ei+di+ci−1+bi−2+ai−3=Si=0.
We will now define an n×n square array A=[ai,j] in which we fill seven consecutive diagonals. Again, the indices of a will be considered as elements of Zn. For i∈[1,n], we let
ai,i+3=ai,
ai,i+2=bi,
ai,i+1=ci,
ai,i=di,
ai+1,i=ei,
ai+2,i=fi, and
ai+3,i=gi
with the other cells empty.
Clearly this fills precisely seven adjacent diagonals of A with the elements in X (see Figure 19).
Now in row i of A, the seven cells filled are ai,i+3=ai, ai,i+2=bi, ai,i+1=ci, Ai,i=di, ai,i−1=ei−1, ai,i−2=fi−2, and ai,i−3=gi−3. The sum of these seven cells is Si′=0.
In column i of A, the seven cells filled are ai+3,i=gi, ai+2,i=fi, ai+1,i=ei, ai,i=di, ai−1,i=ci−1, ai−2,i=bi−2, and ai−3,i=ai−3. The sum of these seven cells is Si=0.
Therefore array A is a diagonal SMS(n;7).
∎
Now, we can solve the last quarter of the square case.
Theorem 9**.**
Given n>t>2 with n even and t odd, there exists an SMS(n;t). If t>3 or n is a multiple of 4, this square is also diagonal.
Proof.
If t=3 and n≡2(mod4), then we apply Lemma 15.
Otherwise, we will proceed by induction. As our base case, let t=3 with n a multiple of 4, or t=5 with n≡0 or 2(mod4), or t=7 with n≡2(mod4). In these cases, we apply Lemma 16, 17, 18, or 19, respectively.
As our inductive case, assume that there exists a diagonal SMS(n;t−4). Lemma 11 then gives us a diagonal SMS(n;t). We conclude the proof via induction on t.
∎
Lastly, we tie all five of our theorems on square arrays together into the following statement.
Theorem 10**.**
There exists an SMS(n;t) for n≥t≥1 precisely when n,t=1 or n,t>2.
Proof.
To determine whether an SMS(n;t) exists for a given t, n with n≥t, one may consult the above table for an answer as well as which theorem to apply to find it.
∎
4 Signed magic rectangles
A natural question to ask is whether the results proven above for signed magic squares extend to signed magic rectangles, i.e arrays where the number of elements in each row differs from the number of elements in each column. A particular case that seems natural to consider is an n×2n array that contains t entries in every column and 2t entries in every row.
Theorem 11**.**
Let m≥t≥3 and suppose mt≡0 or 3(mod4). Then there exists an SMA(m,2m;2t,t).
Proof.
Note that by Theorem 3 there exists an integer m×m Heffter array A=[ai,j] with t entries filled in each row and column. Let A′=[ai,j′] be the integer Heffter array, where ai,j′=−ai,j if the cell (i,j) in A is filled, otherwise the cell (i,j) is left blank. Now let B=[bi,j] be the m×2m array defined by bi,j=ai,j if j≤m and bi,j=ai,j−m′ if m<j≤2m. If the cell (i,j) in A is empty the cells (i,j),(i,m+j) in B are also empty (see Figure 11).
It is easy to see that B is an SMA(m,2m;2t,t).
∎
Lemma 20**.**
There exists a shiftable SMS(m;t) if and only if t is even and m≥t≥4.
Proof.
Suppose t is odd and that there exists an SMS(m;t). Then each row and column of the array contains t filled cells. Since t is odd, there cannot be an equal number of positive and negative entries in each row and column, and the array is not shiftable. If t=2, then clearly there does not exist an SMS(m;t).
Now suppose t≥4 is even. First we consider the case t=m and proceed with induction on t.
For the base case, note that both the 4×4 and 6×6 arrays used in the construction of Lemma 3 are shiftable. So suppose that there exists a shiftable SMS(t−4;t−4). Then we can add four columns to this array by attaching a series of shiftable 2×4 arrays to the original array. The resulting array is shiftable because 4 entries, 2 negative and 2 positive, are added to each row, and each integer is paired with its opposite in the added columns. Next, we can add four rows to this array by attaching a series of shiftable 4×2 arrays to the t−4×t array. It is easy to see that the resulting array is shiftable.
Hence, by induction, there exists a shiftable SMS(t;t).
Now we consider the case t<m. Let t≡0(mod4). We again proceed by induction on t. By Lemma 10, there exists a shiftable diagonal SMS(m;4) for all m≥4. Now let 4≤t≤m−5 and suppose there exists a shiftable SMS(m;t). We can fill four additional adjacent diagonals using the original 4-diagonal array shifted appropriately and permuting the columns as necessary. This gives an SMS(n;t+4), and this array is shiftable because we have added 2 positive and 2 negative entries to each row and column. By induction, the claim holds when t≡0(mod4).
The proof is essentially identical in structure in the cases when t≡2(mod4) and m is even, and when t≡2(mod4) and m is odd. Note that the base cases are given by Lemma 14 and Lemma 12, respectively. This completes the proof.
∎
Theorem 12**.**
Let m≥t≥3 with t even. Then there exists an SMA(m,2m;2t,t).
Proof.
By Lemma 20, there exists a shiftable SMS(m;t), say A=[ai,j].
Now, let A′=[ai,j′] be the array defined by ai,j′=ai,j+2mt if ai,j>0, ai,j′=ai,j−2mt if ai,j<0, and the cell (i,j) is left blank if and only if the corresponding cell in A is left blank. Note that because A is shiftable, A′ also has the zero-sum property in its rows and columns.
Now let B be the m×2m array where bi,j=ai,j if j≤m and bi,j=ai,j−m′ if m<j≤2m. If the cell (i,j) is empty in A, the cells (i,j) and (i,j+m) are left empty in B
(see Figure 22
It is easy to see that B is the desired array.
∎
These two theorems actually cover many of the cases for m×2m signed magic rectangles.
Figure 23 summarizes our results on signed magic rectangles of dimensions m×2m for m≥t≥3.