Pandiagonal magic square

Last updated

A pandiagonal magic square or panmagic square (also diabolic square, diabolical square or diabolical magic square) is a magic square with the additional property that the broken diagonals, i.e. the diagonals that wrap round at the edges of the square, also add up to the magic constant.

Magic square arrangement of numbers (usually integers) in a square grid

In recreational mathematics and combinatorial design, a magic square is a square grid filled with distinct positive integers in the range such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. The sum is called the magic constant or magic sum of the magic square. A square grid with n cells on each side is said to have order n.

In recreational mathematics and the theory of magic squares, a broken diagonal is a set of n cells forming two parallel diagonal lines in the square. Alternatively, these two lines can be thought of as wrapping around the boundaries of the square to form a single sequence.

Magic constant

The magic constant or magic sum of a magic square is the sum of numbers in any row, column, or diagonal of the magic square. For example, the magic square shown below has a magic constant of 15. In general where is the side length of the square.

Contents

A pandiagonal magic square remains pandiagonally magic not only under rotation or reflection, but also if a row or column is moved from one side of the square to the opposite side. As such, an pandiagonal magic square can be regarded as having orientations.

Rotation (mathematics) concept originating in geometry; motion of a certain space that preserves at least one point

Rotation in mathematics is a concept originating in geometry. Any rotation is a motion of a certain space that preserves at least one point. It can describe, for example, the motion of a rigid body around a fixed point. A rotation is different from other types of motions: translations, which have no fixed points, and (hyperplane) reflections, each of them having an entire (n − 1)-dimensional flat of fixed points in a n-dimensional space. A clockwise rotation is a negative magnitude so a counterclockwise turn has a positive magnitude.

Reflection (mathematics) mapping from a Euclidean space to itself that is an isometry with a hyperplane as a set of fixed points

In mathematics, a reflection is a mapping from a Euclidean space to itself that is an isometry with a hyperplane as a set of fixed points; this set is called the axis or plane of reflection. The image of a figure by a reflection is its mirror image in the axis or plane of reflection. For example the mirror image of the small Latin letter p for a reflection with respect to a vertical axis would look like q. Its image by reflection in a horizontal axis would look like b. A reflection is an involution: when applied twice in succession, every point returns to its original location, and every geometrical object is restored to its original state.

Translation (geometry) in Euclidean geometry, a function that moves every point a constant distance in a specified direction

In Euclidean geometry, a translation is a geometric transformation that moves every point of a figure or a space by the same distance in a given direction.

3×3 pandiagonal magic squares

It can be shown that non-trivial pandiagonal magic squares of order 3 do not exist. Suppose the square

In mathematics, the adjective trivial is frequently used for objects that have a very simple structure. The noun triviality usually refers to a simple technical aspect of some proof or definition. The origin of the term in mathematical language comes from the medieval trivium curriculum. The antonym nontrivial is commonly used by mathematicians to indicate a statement or theorem that is not obvious or easy to prove.

is pandiagonally magic with magic sum . Adding sums and results in . Subtracting and we get . However, if we move the third column in front and perform the same proof, we obtain . In fact, using the symmetries of 3 × 3 magic squares, all cells must equal . Therefore, all 3 × 3 pandiagonal magic squares must be trivial.

Symmetry in mathematics symmetry in mathematics

Symmetry occurs not only in geometry, but also in other branches of mathematics. Symmetry is a type of invariance: the property that something does not change under a set of transformations.

However, if the magic square concept is generalized to include geometric shapes instead of numbers—the geometric magic squares discovered by Lee Sallows—a 3 × 3 pandiagonal magic square does exist.

Geometric magic square

A geometric magic square, often abbreviated to geomagic square, is a generalization of magic squares invented by Lee Sallows in 2001. A traditional magic square is a square array of numbers whose sum taken in any row, any column, or in either diagonal is the same target number. A geomagic square, on the other hand, is a square array of geometrical shapes in which those appearing in each row, column, or diagonal can be fitted together to create an identical shape called the target shape. As with numerical types, it is required that the entries in a geomagic square be distinct. Similarly, the eight trivial variants of any square resulting from its rotation and/or reflection, are all counted as the same square. By the dimension of a geomagic square is meant the dimension of the pieces it uses. Hitherto interest has focused mainly on 2D squares using planar pieces, but pieces of any dimension are permitted.

Lee Sallows English recreational mathematician

Lee Cecil Fletcher Sallows is a British electronics engineer known for his contributions to recreational mathematics. He is particularly noted as the inventor of golygons, self-enumerating sentences, and geomagic squares.

4×4 pandiagonal magic squares

Euler diagram of requirements of some types of 4 x 4 magic squares. Cells of the same colour sum to the magic constant. 4x4 magic square hierarchy.svg
Euler diagram of requirements of some types of 4 × 4 magic squares. Cells of the same colour sum to the magic constant.

The smallest non-trivial pandiagonal magic squares are 4 × 4 squares. All 4 × 4 pandiagonal magic squares must be translationally symmetric to the form [1]

Translational symmetry invariance with respect to addition of a constant vector to a coordinate system

In geometry, to translate a geometric figure is to move it from one place to another without rotating it. A translation "slides" a thing by a: Ta(p) = p + a.

aa + b + c + ea + c + da + b + d + e
a + b + c + da + d + ea + ba + c + e
a + b + ea + ca + b + c + d + ea + d
a + c + d + ea + b + da + ea + b + c

Since each 2 × 2 subsquare sums to the magic constant, 4 × 4 pandiagonal magic squares are most-perfect magic square. In addition, the two numbers at the opposite corners of any 3 × 3 square add up to half the magic sum. Consequently, all 4 × 4 pandiagonal magic squares that are associative must have duplicate cells.

All 4 × 4 pandiagonal magic squares using numbers 1-16 without duplicates are obtained by letting a equal 1; letting b, c, d, and e equal 1, 2, 4, and 8 in some order; and applying some translation. For example, with b = 1, c = 2, d = 4, and e = 8, we have the magic square

181312
141127
45169
151036

The number of 4 × 4 pandiagonal magic squares using numbers 1-16 without duplicates is 384 (16×24, where 16 accounts for the translation and 24 accounts for the 4! ways to assign 1, 2, 4, and 8 to b, c, d, and e).

5×5 pandiagonal magic squares

There are many 5 × 5 pandiagonal magic squares. Unlike 4 × 4 pandiagonal magic squares, these can be associative. The following is a 5 × 5 associative pandiagonal magic square:

20821142
114171023
72513119
31692215
24125186

In addition to the rows, columns, and diagonals, a 5 × 5 pandiagonal magic square also shows its magic sum in four "quincunx" patterns, which in the above example are:

17+25+13+1+9 = 65 (center plus adjacent row and column squares)
21+7+13+19+5 = 65 (center plus the remaining row and column squares)
4+10+13+16+22 = 65 (center plus diagonally adjacent squares)
20+2+13+24+6 = 65 (center plus the remaining squares on its diagonals)

Each of these quincunxes can be translated to other positions in the square by cyclic permutation of the rows and columns (wrapping around), which in a pandiagonal magic square does not affect the equality of the magic sums. This leads to 100 quincunx sums, including broken quincunxes analogous to broken diagonals.

The quincunx sums can be proved by taking linear combinations of the row, column, and diagonal sums. Consider the pandiagonal magic square

with magic sum s. To prove the quincunx sum (corresponding to the 20+2+13+24+6 = 65 example given above), we can add together the following:

3 times each of the diagonal sums and ,
The diagonal sums , , , and ,
The row sums and .

From this sum, subtract the following:

The row sums and ,
The column sum ,
Twice each of the column sums and .

The net result is , which divided by 5 gives the quincunx sum. Similar linear combinations can be constructed for the other quincunx patterns , , and .

(4n+2)×(4n+2) pandiagonal magic squares with nonconsecutive elements

No pandiagonal magic square exists of order if consecutive integers are used. But certain sequences of nonconsecutive integers do admit order-() pandiagonal magic squares.

Consider the sum 1+2+3+5+6+7 = 24. This sum can be divided in half by taking the appropriate groups of three addends, or in thirds using groups of two addends:

1+5+6 = 2+3+7 = 12
1+7 = 2+6 = 3+5 = 8

An additional equal partitioning of the sum of squares guarantees the semibimagic property noted below:

12+52+62 = 22+32+72 = 62

Note that the consecutive integer sum 1+2+3+4+5+6 = 21, an odd sum, lacks the half-partitioning.

With both equal partitions available, the numbers 1, 2, 3, 5, 6, 7 can be arranged into 6x6 pandigonal patterns A and B, respectively given by:

156732
561327
615273
156732
561327
615273
651651
165165
516516
237237
723723
372372

Then (where C is the magic square with 1 for all cells) gives the nonconsecutive pandiagonal 6x6 square:

6333648198
29415151347
40134124320
23142441714
3537321945
38730104916

with a maximum element of 49 and a pandiagonal magic sum of 150. This square is pandiagonal and semibimagic, that means that rows, columns, main diagonals and broken diagonals have a sum of 150 and, if we square all the numbers in the square, only the rows and the columns are magic and have a sum of 5150.

For 10th order a similar construction is possible using the equal partitionings of the sum 1+2+3+4+5+9+10+11+12+13 = 70:

1+3+9+10+12 = 2+4+5+11+13 = 35
1+13 = 2+12 = 3+11 = 4+10 = 5+9 = 14
12+32+92+102+122 = 22+42+52+112+132 = 335 (equal partitioning of squares; semibimagic property)

This leads to squares having a maximum element of 169 and a pandiagonal magic sum of 850, which are also semibimagic with each row or column sum of squares equal to 102,850.

(6n±1)×(6n±1) pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.

  1. Set up the first column of the square with the first natural numbers.
      1                   
      2       
      3       
      4       
      5       
      6       
      7       
  2. Copy the first column into the second column but shift it ring-wise by 2 rows.
      1   6                
      2   7      
      3   1      
      4   2      
      5   3      
      6   4      
      7   5      
  3. Continue copying the current column into the next column with ring-wise shift by 2 rows until the square is filled completely.
      1   6   4   2   7   5   3 
      2   7   5   3   1   6   4 
      3   1   6   4   2   7   5 
      4   2   7   5   3   1   6 
      5   3   1   6   4   2   7 
      6   4   2   7   5   3   1 
      7   5   3   1   6   4   2 
  4. Build a second square and copy the first square into it but mirror it diagonal. So you have to exchange rows and columns.
    A
      1   6   4   2   7   5   3 
      2   7   5   3   1   6   4 
      3   1   6   4   2   7   5 
      4   2   7   5   3   1   6 
      5   3   1   6   4   2   7 
      6   4   2   7   5   3   1 
      7   5   3   1   6   4   2 
      1   2   3   4   5   6   7 
      6   7   1   2   3   4   5 
      4   5   6   7   1   2   3 
      2   3   4   5   6   7   1 
      7   1   2   3   4   5   6 
      5   6   7   1   2   3   4 
      3   4   5   6   7   1   2 
  5. Build the final square by multiplying the second square by , adding the first square and subtract in each cell of the square.

    Example: , where B is the magic square with all cells as 1.

      1  13  18  23  35  40  45 
     37  49   5  10  15  27  32 
     24  29  41  46   2  14  19 
     11  16  28  33  38  43   6 
     47   3   8  20  25  30  42 
     34  39  44   7  12  17  22 
     21  26  31  36  48   4   9 

4n×4n pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.

  1. Put the first natural numbers into the first row and the first columns of the square.
      1   2   3   4             
            
            
            
            
            
            
            
  2. Put the next natural numbers beneath the first natural numbers in reverse. Each vertical pair must have the same sum.
      1   2   3   4             
      8   7   6   5             
            
            
            
            
            
            
  3. Copy that rectangle times beneath the first rectangle.
      1   2   3   4             
      8   7   6   5             
      1   2   3   4             
      8   7   6   5             
      1   2   3   4             
      8   7   6   5             
      1   2   3   4             
      8   7   6   5             
  4. Copy the left rectangle into the right rectangle but shift it ring-wise by one row.
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
  5. Build a second 4n×4n square and copy the first square into it but turn it by 90°.
    A
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
      1   2   3   4   8   7   6   5 
      8   7   6   5   1   2   3   4 
    B
      5   4   5   4   5   4   5   4 
      6   3   6   3   6   3   6   3 
      7   2   7   2   7   2   7   2 
      8   1   8   1   8   1   8   1 
      4   5   4   5   4   5   4   5 
      3   6   3   6   3   6   3   6 
      2   7   2   7   2   7   2   7 
      1   8   1   8   1   8   1   8 
  6. Build the final square by multiplying the second square by , adding the first square and subtract in each cell of the square.

    Example: , where C is the magic square with all cells as 1.

     33  26  35  28  40  31  38  29 
     48  23  46  21  41  18  43  20 
     49  10  51  12  56  15  54  13 
     64   7  62   5  57   2  59   4 
     25  34  27  36  32  39  30  37 
     24  47  22  45  17  42  19  44 
      9  50  11  52  16  55  14  53 
      8  63   6  61   1  58   3  60 

If we build a pandiagonal magic square with this algorithm then every square in the square will have the same sum. Therefore, many symmetric patterns of cells have the same sum as any row and any column of the square. Especially each and each rectangle will have the same sum as any row and any column of the square. The square is also a Most-perfect magic square.

(6n+3)×(6n+3) pandiagonal magic squares

A pandiagonal magic square can be built by the following algorithm.

  1. Create a rectangle with the first natural numbers so that each column has the same sum. You can do this by starting with a 3 × 3 magic square and set up the rest cells of the rectangle in meander-style. You can also use the pattern shown in the following examples.
    For 9 × 9 square
     1  2  3 
     5  6  4 
     9  7  8 
    vertical sum = 15
    For 15 × 15 square
     1  2  3 
     5  6  4 
     9  7  8 
     10  11  12 
     15  14  13 
    vertical sum = 40
    For 21 × 21 square
     1  2  3 
     5  6  4 
     9  7  8 
    10 11 12
    15 14 13
    16 17 18
    21 20 19
    vertical sum = 77
  2. Put this rectangle in the left upper corner of the square and two copies of the rectangle beneath it so that the first 3 columns of the square are filled completely.
      1   2   3 
      5   6   4 
      9   7   8 
      1   2   3 
      5   6   4 
      9   7   8 
      1   2   3 
      5   6   4 
      9   7   8                   
  3. Copy the left 3 columns into the next 3 columns, but shift it ring-wise by 1 row.
      1   2   3   9   7   8 
      5   6   4   1   2   3 
      9   7   8   5   6   4 
      1   2   3   9   7   8 
      5   6   4   1   2   3 
      9   7   8   5   6   4 
      1   2   3   9   7   8 
      5   6   4   1   2   3 
      9   7   8   5   6   4          
  4. Continue copying the current 3 columns into the next 3 columns, shifted ring-wise by 1 row, until the square is filled completely.
      1   2   3   9   7   8   5   6   4 
      5   6   4   1   2   3   9   7   8 
      9   7   8   5   6   4   1   2   3 
      1   2   3   9   7   8   5   6   4 
      5   6   4   1   2   3   9   7   8 
      9   7   8   5   6   4   1   2   3 
      1   2   3   9   7   8   5   6   4 
      5   6   4   1   2   3   9   7   8 
      9   7   8   5   6   4   1   2   3 
  5. Build a second square and copy the first square into it but mirror it diagonal. So you have to exchange rows and columns.
    A
      1   2   3   9   7   8   5   6   4 
     5  6  4  1  2  3  9  7  8 
     9  7  8  5  6  4  1  2  3 
     1  2  3  9  7  8  5  6  4 
     5  6  4  1  2  3  9  7  8 
     9  7  8  5  6  4  1  2  3 
     1  2  3  9  7  8  5  6  4 
     5  6  4  1  2  3  9  7  8 
     9  7  8  5  6  4  1  2  3 
      1   5   9   1   5   9   1   5   9 
     2  6  7  2  6  7  2  6  7 
     3  4  8  3  4  8  3  4  8 
     9  1  5  9  1  5  9  1  5 
     7  2  6  7  2  6  7  2  6 
     8  3  4  8  3  4  8  3  4 
     5  9  1  5  9  1  5  9  1 
     6  7  2  6  7  2  6  7  2 
     4  8  3  4  8  3  4  8  3 
  6. Build the final square by multiplying the second square by , adding the first square and subtract in each cell of the square.

    Example: , where B is the magic square with all cells as 1.

     1  38  75  9  43  80  5  42  76 
     14  51  58  10  47  57  18  52  62 
     27  34  71  23  33  67  19  29  66 
     73  2  39  81  7  44  77  6  40 
     59  15  49  55  11  48  63  16  53 
     72  25  35  68  24  31  64  20  30 
     37  74  3  45  79  8  41  78  4 
     50  60  13  46  56  12  54  61  17 
     36  70  26  32  69  22  28  65  21 

Related Research Articles

Magic cube

In mathematics, a magic cube is the 3-dimensional equivalent of a magic square, that is, a number of integers arranged in a n × n × n pattern such that the sums of the numbers on each row, on each column, on each pillar and on each of the four main space diagonals are equal to the same number, the so-called magic constant of the cube, denoted M3(n). It can be shown that if a magic cube consists of the numbers 1, 2, ..., n3, then it has magic constant

In mathematics, a perfect magic cube is a magic cube in which not only the columns, rows, pillars, and main space diagonals, but also the cross section diagonals sum up to the cube's magic constant.

Square pyramidal number pyramidal number

In mathematics, a pyramid number, or square pyramidal number, is a figurate number that represents the number of stacked spheres in a pyramid with a square base. Square pyramidal numbers also solve the problem of counting the number of squares in an n × n grid.

Most-perfect magic square

A most-perfect magic square of doubly even order n = 4k is a pan-diagonal magic square containing the numbers 1 to n2 with three additional properties:

  1. Each 2×2 subsquare, including wrap-round, sums to s/k, where s = n(n2 + 1)/2 is the magic sum.
  2. All pairs of integers distant n/2 along any diagonal are complementary.

In mathematics, the Kronecker product, denoted by ⊗, is an operation on two matrices of arbitrary size resulting in a block matrix. It is a generalization of the outer product from vectors to matrices, and gives the matrix of the tensor product with respect to a standard choice of basis. The Kronecker product should not be confused with the usual matrix multiplication, which is an entirely different operation.

An antimagic square of order n is an arrangement of the numbers 1 to n2 in a square, such that the sums of the n rows, the n columns and the two diagonals form a sequence of 2n + 2 consecutive integers. The smallest antimagic squares have order 4.

In recreational mathematics, a pandiagonal magic cube is a magic cube with the additional property that all broken diagonals have the same sum as each other. Pandiagonal magic cubes are extensions of diagonal magic cubes and generalize pandiagonal magic squares to three dimensions.

Magic hexagon

A magic hexagon of order n is an arrangement of numbers in a centered hexagonal pattern with n cells on each edge, in such a way that the numbers in each row, in all three directions, sum to the same magic constant M. A normal magic hexagon contains the consecutive integers from 1 to 3n2 − 3n + 1. It turns out that normal magic hexagons exist only for n = 1 and n = 3. Moreover, the solution of order 3 is essentially unique. Meng also gave a less intricate constructive proof.

In statistics, McNemar's test is a statistical test used on paired nominal data. It is applied to 2 × 2 contingency tables with a dichotomous trait, with matched pairs of subjects, to determine whether the row and column marginal frequencies are equal. It is named after Quinn McNemar, who introduced it in 1947. An application of the test in genetics is the transmission disequilibrium test for detecting linkage disequilibrium. The commonly used parameters to assess a diagnostic test in medical sciences are sensitivity and specificity. Sensitivity is the ability of a test to correctly identify the people with disease. Specificity is the ability of the test to correctly identify those without the disease. Now presume two tests are performed on the same group of patients. And also presume that these tests have identical sensitivity and specificity. In this situation one is carried away by these findings and presume that both the tests are equivalent. However this may not be the case. For this we have to study the patients with disease and patients without disease. We also have to find out where these two tests disagree with each other. This is precisely the basis of McNemar's test. This test compares the sensitivity and specificity of two diagnostic tests on the same group of patients.

In mathematics, a square matrix is said to be diagonally dominant if, for every row of the matrix, the magnitude of the diagonal entry in a row is larger than or equal to the sum of the magnitudes of all the other (non-diagonal) entries in that row. More precisely, the matrix A is diagonally dominant if

In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix. The product sometimes includes a permutation matrix as well. LU decomposition can be viewed as the matrix form of Gaussian elimination. Computers usually solve square systems of linear equations using LU decomposition, and it is also a key step when inverting a matrix or computing the determinant of a matrix. LU decomposition was introduced by mathematician Tadeusz Banachiewicz in 1938.

A Nasik magic hypercube is a magic hypercube with the added restriction that all possible lines through each cell sum correctly to where S = the magic constant, m = the order and n = the dimension, of the hypercube.

In mathematics, the Schröder number also called a large Schröder number or big Schröder number, describes the number of lattice paths from the southwest corner of an grid to the northeast corner using only single steps north, northeast, or east, that do not rise above the SW–NE diagonal.

Sriramachakra

Sriramachakra is a mystic diagram or a yantra given in Tamil almanacs as an instrument of astrology for predicting one's future. The geometrical diagram consists of a square divided into smaller squares by equal numbers of lines parallel to the sides of the square. Certain integers in well defined patterns are written in the various smaller squares. In some almanacs, for example, in the Panchangam published by the Sringeri Sharada Peetham or the Pnachangam published by Srirangam Temple, the diagram takes the form of a magic square of order 4 with certain special properties. This magic square belongs to a certain class of magic squares called strongly magic squares which has been so named and studied by T V Padmakumar, an amateur mathematician from Thiruvananthapuram, Kerala. In some almanacs, for example, in the Pambu Panchangam, the diagram consists of an arrangement of 36 small squares in 6 rows and 6 columns in which the digits 1, 2, ..., 9 are written in that order from left to right starting from the top-left corner, repeating the digits in the same direction once the digit 9 is reached.

Bernoulli's triangle is an array of partial sums of the binomial coefficients. For any non-negative integer n and for any integer k included between 0 and n, the component in row n and column k is given by:

References

  1. Ng, Louis (May 13, 2018). "Magic Counting with Inside-Out Polytopes" (PDF).