Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Magic square
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Special methods of construction== Over the millennia, many ways to construct magic squares have been discovered. These methods can be classified as general methods and special methods, in the sense that general methods allow us to construct more than a single magic square of a given order, whereas special methods allow us to construct just one magic square of a given order. Special methods are specific algorithms whereas general methods may require some trial-and-error. Special methods are the most simple ways to construct magic squares. They follow certain algorithms which generate regular patterns of numbers in a square. The correctness of these special methods can be proved using one of the general methods given in later sections. After a magic square has been constructed using a special method, the transformations described in the previous section can be applied to yield further magic squares. Special methods are usually referred to using the name of the author(s) (if known) who described the method, for e.g. De la Loubere's method, Starchey's method, Bachet's method, etc. Magic squares are believed to exist for all orders, except for order 2. Magic squares can be classified according to their order as odd, doubly even (''n'' divisible by four), and singly even (''n'' even, but not divisible by four). This classification is based on the fact that entirely different techniques need to be employed to construct these different species of squares. Odd and doubly even magic squares are easy to generate; the construction of singly even magic squares is more difficult but several methods exist, including [[John Horton Conway]]'s [[LUX method for magic squares]] and the [[Strachey method for magic squares]]. ===A method for constructing a magic square of order 3=== In the 19th century, [[Édouard Lucas]] devised the general formula for order 3 magic squares. Consider the following table made up of positive integers ''a'', ''b'' and ''c'': {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:26em;height:6em;table-layout:fixed;" |- | ''c'' − ''b'' || ''c'' + (''a'' + ''b'') || ''c'' − ''a'' |- | ''c'' − (''a'' − ''b'') || ''c'' || ''c'' + (''a'' − ''b'') |- | ''c'' + ''a'' || ''c'' − (''a'' + ''b'') || ''c'' + ''b'' |} These nine numbers will be distinct positive integers forming a magic square with the magic constant 3''c'' so long as 0 < ''a'' < ''b'' < ''c'' − ''a'' and ''b'' ≠ 2''a''. Moreover, every 3×3 magic square of distinct positive integers is of this form. In 1997 [[Lee Sallows]] discovered that leaving aside rotations and reflections, then every distinct [[parallelogram]] drawn on the [[Argand diagram]] defines a unique 3×3 magic square, and vice versa, a result that had never previously been noted.<ref name=lost-theorem/> ===A method for constructing a magic square of odd order=== {{See also|Siamese method}} [[File:Yanghui magic square.GIF|thumb|right|300px|[[Yang Hui]]'s construction method]] A method for constructing magic squares of odd order was published by the French diplomat de la Loubère in his book, ''A new historical relation of the kingdom of Siam'' (Du Royaume de Siam, 1693), in the chapter entitled ''The problem of the magical square according to the Indians''.<ref>''Mathematical Circles Squared'' By Phillip E. Johnson, Howard Whitley Eves, p. 22</ref> The method operates as follows: The method prescribes starting in the central column of the first row with the number 1. After that, the fundamental movement for filling the squares is diagonally up and right, one step at a time. If a square is filled with a multiple of the order ''n'', one moves vertically down one square instead, then continues as before. When an "up and to the right" move would leave the square, it is wrapped around to the last row or first column, respectively. {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 1 |- | ||1 || |- | || || |- | || || |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 2 |- | ||1 || |- | || || |- | || ||2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 3 |- | ||1 || |- | 3 || || |- | || || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 4 |- | || 1 || |- | 3 || || |- | 4 || || 2 |} {{col-end}} {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 5 |- | ||1 || |- | 3 || 5 || |- | 4 || || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 6 |- | || 1 || 6 |- | 3 || 5 || |- | 4 || || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 7 |- | || 1 || 6 |- | 3 || 5 || 7 |- | 4 || || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 8 |- | 8 || 1 || 6 |- | 3 || 5 || 7 |- | 4 || || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ step 9 |- | 8 || 1 || 6 |- | 3 || 5 || 7 |- | 4 || 9 || 2 |} {{col-end}} Starting from other squares rather than the central column of the first row is possible, but then only the row and column sums will be identical and result in a magic sum, whereas the diagonal sums will differ. The result will thus be a semimagic square and not a true magic square. Moving in directions other than north east can also result in magic squares. {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- |+ Order 3 |- | 8 || 1 || 6 |- | 3 || 5 || 7 |- | 4 || 9 || 2 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:10em;height:10em;table-layout:fixed;" |- |+ Order 5 |- | 17 || 24 || 1 || 8 || 15 |- | 23 || 5 || 7 || 14 || 16 |- | 4 || 6 || 13 || 20 || 22 |- | 10 || 12 || 19 || 21 || 3 |- | 11 || 18 || 25 || 2 || 9 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:18em;height:18em;table-layout:fixed;" |- |+ Order 9 |- | 47 || 58 || 69 || 80 || 1 || 12 || 23 || 34 || 45 |- | 57 || 68 || 79 || 9 || 11 || 22 || 33 || 44 || 46 |- | 67 || 78 || 8 || 10 || 21 || 32 || 43 || 54 || 56 |- | 77 || 7 || 18 || 20 || 31 || 42 || 53 || 55 || 66 |- | 6 || 17 || 19 || 30 || 41 || 52 || 63 || 65 || 76 |- | 16 || 27 || 29 || 40 || 51 || 62 || 64 || 75 || 5 |- | 26 || 28 || 39 || 50 || 61 || 72 || 74 || 4 || 15 |- | 36 || 38 || 49 || 60 || 71 || 73 || 3 || 14 || 25 |- | 37 || 48 || 59 || 70 || 81 || 2 || 13 || 24 || 35 |} {{col-end}} ===A method of constructing a magic square of doubly even order=== [[Doubly even]] means that ''n'' is an even multiple of an even integer; or 4''p'' (e.g. 4, 8, 12), where ''p'' is an integer. '''Generic pattern''' All the numbers are written in order from left to right across each row in turn, starting from the top left hand corner. Numbers are then either retained in the same place or interchanged with their diametrically opposite numbers in a certain regular pattern. In the magic square of order four, the numbers in the four central squares and one square at each corner are retained in the same place and the others are interchanged with their diametrically opposite numbers. '''A construction of a magic square of order 4''' Starting from top left, go left to right through each row of the square, counting each cell from 1 to 16 and filling the cells along the diagonals with its corresponding number. Once the bottom right cell is reached, continue by going right to left, starting from the bottom right of the table through each row, and fill in the non-diagonal cells counting up from 1 to 16 with its corresponding number. As shown below: {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | style="background-color: silver;"|1 || || || style="background-color: silver;"|4 |- | || style="background-color: silver;"|6 || style="background-color: silver;"|7 || |- | || style="background-color: silver;"|10 || style="background-color: silver;"|11 || |- | style="background-color: silver;"|13 || || || style="background-color: silver;"|16 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | style="background-color: silver;"|1 ||15 ||14 || style="background-color: silver;"|4 |- |12 || style="background-color: silver;"|6 || style="background-color: silver;"|7 ||9 |- | 8 || style="background-color: silver;"|10 || style="background-color: silver;"|11 ||5 |- | style="background-color: silver;"|13 || 3 || 2 || style="background-color: silver;"|16 |} {{col-end}} '''An extension of the above example for Orders 8 and 12''' First generate a pattern table, where a '1' indicates selecting from the square where the numbers are written in order 1 to n<sup>2</sup> (left-to-right, top-to-bottom), and a '0' indicates selecting from the square where the numbers are written in reverse order ''n''<sup>2</sup> to 1. For ''M'' = 4, the pattern table is as shown below (third matrix from left). With the unaltered cells (cells with '1') shaded, a criss-cross pattern is obtained. {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | 1 || 2 || 3 || 4 |- | 5 || 6 || 7 || 8 |- | 9 ||10 || 11 || 12 |- | 13 || 14 || 15 || 16 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | 16 ||15 ||14 || 13 |- |12 || 11 || 10 ||9 |- | 8 || 7 || 6 ||5 |- | 4 || 3 || 2 || 1 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:8em;height:8em;table-layout:fixed;" |- |+ ''M'' = Order 4 |- | style="background-color: silver;"|1 ||15 ||14 || style="background-color: silver;"|4 |- |12 || style="background-color: silver;"|6 || style="background-color: silver;"|7 ||9 |- | 8 || style="background-color: silver;"|10 || style="background-color: silver;"|11 ||5 |- | style="background-color: silver;"|13 || 3 || 2 || style="background-color: silver;"|16 |} {{col-end}} The patterns are a) there are equal number of '1's and '0's in each row and column; b) each row and each column are "palindromic"; c) the left- and right-halves are mirror images; and d) the top- and bottom-halves are mirror images (c and d imply b). The pattern table can be denoted using [[hexadecimals]] as (9, 6, 6, 9) for simplicity (1-nibble per row, 4 rows). The simplest method of generating the required pattern for higher ordered doubly even squares is to copy the generic pattern for the fourth-order square in each four-by-four sub-squares. For M = 8, possible choices for the pattern are (99, 66, 66, 99, 99, 66, 66, 99); (3C, 3C, C3, C3, C3, C3, 3C, 3C); (A5, 5A, A5, 5A, 5A, A5, 5A, A5) (2-nibbles per row, 8 rows). {{col-begin|width=auto;margin:0.5em auto}} {{col-break|valign=bottom}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:16em;height:16em;table-layout:fixed;" |- |+ ''M'' = Order 8 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 |- | style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 || style="background-color: silver;"|1 || 0 || 0 || style="background-color: silver;"|1 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:16em;height:16em;table-layout:fixed;" |- |+ ''M'' = Order 8 |- | style="background-color: silver;"|1 || || || style="background-color: silver;"|4 || style="background-color: silver;"|5 || || || style="background-color: silver;"|8 |- | || style="background-color: silver;"|10 || style="background-color: silver;"|11 || || || style="background-color: silver;"|14 || style="background-color: silver;"|15 || |- | || style="background-color: silver;"|18 || style="background-color: silver;"|19 || || || style="background-color: silver;"|22 || style="background-color: silver;"|23 || |- | style="background-color: silver;"|25 || || || style="background-color: silver;"|28 || style="background-color: silver;"|29 || || || style="background-color: silver;"|32 |- | style="background-color: silver;"|33 || || || style="background-color: silver;"|36 || style="background-color: silver;"|37 || || || style="background-color: silver;"|40 |- | || style="background-color: silver;"|42 || style="background-color: silver;"|43 || || || style="background-color: silver;"|46 || style="background-color: silver;"|47 || |- | || style="background-color: silver;"|50 || style="background-color: silver;"|51 || || || style="background-color: silver;"|54 || style="background-color: silver;"|55 || |- | style="background-color: silver;"|57 || || || style="background-color: silver;"|60 || style="background-color: silver;"|61 || || || style="background-color: silver;"|64 |} {{col-break|valign=bottom|gap=1em}} {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:16em;height:16em;table-layout:fixed;" |- |+ ''M'' = Order 8 |- | style="background-color: silver;"|1 || 63 || 62 || style="background-color: silver;"|4 || style="background-color: silver;"|5 || 59 || 58 || style="background-color: silver;"|8 |- | 56 || style="background-color: silver;"|10 || style="background-color: silver;"|11 || 53 || 52 || style="background-color: silver;"|14 || style="background-color: silver;"|15 || 49 |- | 48 || style="background-color: silver;"|18 || style="background-color: silver;"|19 || 45 || 44 || style="background-color: silver;"|22 || style="background-color: silver;"|23 || 41 |- | style="background-color: silver;"|25 || 39 || 38 || style="background-color: silver;"|28 || style="background-color: silver;"|29 || 35 || 34 || style="background-color: silver;"|32 |- | style="background-color: silver;"|33 || 31 || 30 || style="background-color: silver;"|36 || style="background-color: silver;"|37 || 27 || 26 || style="background-color: silver;"|40 |- | 24 || style="background-color: silver;"|42 || style="background-color: silver;"|43 || 21 || 20 || style="background-color: silver;"|46 || style="background-color: silver;"|47 || 17 |- | 16 || style="background-color: silver;"|50 || style="background-color: silver;"|51 || 13 || 12 || style="background-color: silver;"|54 || style="background-color: silver;"|55 || 9 |- | style="background-color: silver;"|57 || 7 || 6 || style="background-color: silver;"|60 || style="background-color: silver;"|61 || 3 || 2 || style="background-color: silver;"|64 |} {{col-end}} For M = 12, the pattern table (E07, E07, E07, 1F8, 1F8, 1F8, 1F8, 1F8, 1F8, E07, E07, E07) yields a magic square (3-nibbles per row, 12 rows.) It is possible to count the number of choices one has based on the pattern table, taking rotational symmetries into account.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)