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!
==Method of borders== ===Bordering method for order 3=== In this method, the objective is to wrap a border around a smaller magic square which serves as a core. Consider the 3×3 square for example. Subtracting the middle number 5 from each number 1, 2, ..., 9, we obtain 0, ±1, ±2, ±3, and ±4, which we will, for lack of better words, following S. Harry White, refer to as bone numbers. The magic constant of a magic square, which we will refer to as the skeleton square, made by these bone numbers will be zero since adding all the rows of a magic square will give ''nM'' = Σ ''k'' = 0; thus ''M'' = 0. It is not difficult to argue that the middle number should be placed at the center cell: let ''x'' be the number placed in the middle cell, then the sum of the middle column, middle row, and the two diagonals give Σ ''k'' + 3 ''x'' = 4 ''M''. Since Σ ''k'' = 3 ''M'', we have ''x'' = ''M'' / 3. Here ''M'' = 0, so ''x'' = 0. Putting the middle number 0 in the center cell, we want to construct a border such that the resulting square is magic. Let the border be given by: {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:6em;height:6em;table-layout:fixed;" |- | ''u'' || ''a'' || ''v'' |- | ''b''{{sup|∗}} || 0 || ''b'' |- | ''v''{{sup|∗}} || ''a''{{sup|∗}} || ''u''{{sup|∗}} |} Since the sum of each row, column, and diagonals must be a constant (which is zero), we have : ''a'' + ''a''{{sup|∗}} = 0, : ''b'' + ''b''{{sup|∗}} = 0, : ''u'' + ''u''{{sup|∗}} = 0, : ''v'' + ''v''{{sup|∗}} = 0. Now, if we have chosen ''a'', ''b'', ''u'', and ''v'', then we have ''a''{{sup|∗}} = −''a'', ''b''{{sup|∗}} = −''b'', ''u''{{sup|∗}} = −''u'', and ''v''{{sup|∗}} = −''v''. This means that if we assign a given number to a variable, say ''a'' = 1, then its complement will be assigned to ''a''{{sup|∗}}, i.e. ''a''{{sup|∗}} = −1. Thus out of eight unknown variables, it is sufficient to specify the value of only four variables. We will consider ''a'', ''b'', ''u'', and ''v'' as independent variables, while ''a''{{sup|∗}}, ''b''{{sup|∗}}, ''u''{{sup|∗}}, and ''v''{{sup|∗}} as dependent variables. This allows us to consider a bone number ±''x'' as a single number regardless of sign because (1) its assignment to a given variable, say ''a'', will automatically imply that the same number of opposite sign will be shared with its complement ''a''{{sup|∗}}, and (2) two independent variables, say ''a'' and ''b'', cannot be assigned the same bone number. But how should we choose ''a'', ''b'', ''u'', and ''v''? We have the sum of the top row and the sum of the right column as : ''u'' + ''a'' + ''v'' = 0, : ''v'' + ''b'' + ''u''{{sup|∗}} = 0. Since 0 is an even number, there are only two ways that the sum of three integers will yield an even number: 1) if all three were even, or 2) if two were odd and one was even. Since in our choice of numbers we only have two even non-zero number (±2 and ±4), the first statement is false. Hence, it must be the case that the second statement is true: that two of the numbers are odd and one even. The only way that both the above two equations can satisfy this parity condition simultaneously, and still be consistent with the set of numbers we have, is when ''u'' and ''v'' are odd. For on the contrary, if we had assumed ''u'' and ''a'' to be odd and ''v'' to be even in the first equation, then ''u''{{sup|∗}} = −''u'' will be odd in the second equation, making ''b'' odd as well, in order to satisfy the parity condition. But this requires three odd numbers (''u'', ''a'', and ''b''), contradicting the fact that we only have two odd numbers (±1 and ±3) which we can use. This proves that the odd bone numbers occupy the corners cells. When converted to normal numbers by adding 5, this implies that the corners of a 3×3 magic square are all occupied by even numbers. Thus, taking ''u'' = 1 and ''v'' = 3, we have ''a'' = −4 and ''b'' = −2. Hence, the finished skeleton square will be as in the left. Adding 5 to each number, we get the finished magic square. {{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;" |- | 1 || −4 || 3 |- | 2 || 0 || −2 |- | −3 || 4 || −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;" |- | 6 || 1 || 8 |- | 7 || 5 || 3 |- | 2 || 9 || 4 |} {{col-end}} Similar argument can be used to construct larger squares. Since there does not exist a 2×2 magic square around which we can wrap a border to construct a 4×4 magic square, the next smallest order for which we can construct bordered square is the order 5. ===Bordering method for order 5=== Consider the fifth-order square. For this, we have a 3×3 magic core, around which we will wrap a magic border. The bone numbers to be used will be ±5, ±6, ±7, ±8, ±9, ±10, ±11, and ±12. Disregarding the signs, we have 8 bone numbers, 4 of which are even and 4 of which are odd. In general, for a square of any order ''n'', there will be 4(''n'' − 1) border cells, which are to be filled using 2(''n'' − 1) bone numbers. Let the magic border be given as {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:10em;height:10em;table-layout:fixed;" |- | ''u'' || ''a'' || ''b'' || ''c'' || ''v'' |- | ''d''{{sup|∗}} || || || || ''d'' |- | ''e''{{sup|∗}} || || || || ''e'' |- | ''f''{{sup|∗}} || || || || ''f'' |- | ''v''{{sup|∗}} || ''a''{{sup|∗}} || ''b''{{sup|∗}} || ''c''{{sup|∗}} || ''u''{{sup|∗}} |} As before, we should * ''place a bone number and its complement opposite to each other, so that the magic sum will be zero.'' It is sufficient to determine the numbers ''u, v, a, b, c, d, e, f'' to describe the magic border. As before, we have the two constraint equations for the top row and right column: : ''u'' + ''a'' + ''b'' + ''c'' + ''v'' = 0 : ''v'' + ''d'' + ''e'' + ''f'' + ''u*'' = 0. Multiple solutions are possible. The standard procedure is to * ''first try to determine the corner cells, after which we will try to determine the rest of the border.'' There are 28 ways of choosing two numbers from the set of 8 bone numbers for the corner cells ''u'' and ''v''. However, not all pairs are admissible. Among the 28 pairs, 16 pairs are made of an even and an odd number, 6 pairs have both as even numbers, while 6 pairs have them both as odd numbers. We can prove that the corner cells ''u'' and ''v'' cannot have an even and an odd number. This is because if this were so, then the sums ''u'' + ''v'' and ''v'' + ''u''{{sup|∗}} will be odd, and since 0 is an even number, the sums ''a'' + ''b'' + ''c'' and ''d'' + ''e'' + ''f'' should be odd as well. The only way that the sum of three integers will result in an odd number is when 1) two of them are even and one is odd, or 2) when all three are odd. Since the corner cells are assumed to be odd and even, neither of these two statements are compatible with the fact that we only have 3 even and 3 odd bone numbers at our disposal. This proves that ''u'' and ''v'' cannot have different parity. This eliminates 16 possibilities. Using similar type reasoning we can also draw some conclusions about the sets {''a'', ''b'', ''c''} and {''d'', ''e'', ''f''}. If ''u'' and ''v'' are both even, then both the sets should have two odd numbers and one even number. If ''u'' and ''v'' are both odd, then one of the sets should have three even numbers while the other set should have one even number and two odd numbers. As a running example, consider the case when both ''u'' and ''v'' are even. The 6 possible pairs are: (6, 8), (6, 10), (6, 12), (8, 10), (8, 12), and (10, 12). Since the sums ''u'' + ''v'' and ''v'' + ''u''{{sup|∗}} are even, the sums ''a'' + ''b'' + ''c'' and ''d'' + ''e'' + ''f'' should be even as well. The only way that the sum of three integers will result in an even number is when 1) two of them are odd and one is even, or 2) when all three are even. The fact that the two corner cells are even means that we have only 2 even numbers at our disposal. Thus, the second statement is not compatible with this fact. Hence, it must be the case that the first statement is true: two of the three numbers should be odd, while one be even. Now let ''a, b, d, e'' be odd numbers while ''c'' and ''f'' be even numbers. Given the odd bone numbers at our disposal: ±5, ±7, ±9, and ±11, their differences range from ''D'' = {±2, ±4, ±6} while their sums range from ''S'' = {±12, ±14, ±16, ±18, ±20}. It is also useful to have a table of their sum and differences for later reference. Now, given the corner cells (''u'', ''v''), we can check its admissibility by checking if the sums ''u'' + ''v'' + ''c'' and ''v'' + ''u''{{sup|∗}} + ''f'' fall within the set ''D'' or ''S''. The admissibility of the corner numbers is a necessary but not a sufficient condition for the solution to exist. For example, if we consider the pair (''u'', ''v'') = (8, 12), then ''u'' + ''v'' = 20 and ''v'' + ''u*'' = 6; and we will have ±6 and ±10 even bone numbers at our disposal. Taking ''c'' = ±6, we have the sum ''u'' + ''v'' + ''c'' to be 26 and 14, depending on the sign of ±6 taken, both of which do not fall within the sets ''D'' or ''S''. Likewise, taking ''c'' = ±10, we have the sum ''u'' + ''v'' + ''c'' to be 30 and 10, both of which again do not fall within the sets ''D'' or ''S''. Thus, the pair (8, 12) is not admissible. By similar process of reasoning, we can also rule out the pair (6, 12). As another example, if we consider the pair (''u'', ''v'') = (10, 12), then ''u'' + ''v'' = 22 and ''v'' + ''u''{{sup|∗}} = 2; and we will have ± 6 and ± 8 even bone numbers at our disposal. Taking ''c'' = ±6, we have the sum ''u'' + ''v'' + ''c'' to be 28 and 16. While 28 does not fall within the sets ''D'' or ''S'', 16 falls in set ''S''. By inspection, we find that if (''a'', ''b'') = (−7, − 9), then ''a'' + ''b'' = −16; and it will satisfy the first constraint equation. Also, taking ''f'' = ± 8, we have the sum ''v'' + ''u''{{sup|∗}} + ''f'' to be 10 and -6. While 10 does not fall within the sets ''D'' or ''S'', −6 falls in set ''D''. Since −7 and −9 have already been assigned to ''a'' and ''b'', clearly (''d'', ''e'') = (-5, 11) so that ''d'' + ''e'' = 6; and it will satisfy the second constraint equation. Likewise, taking ''c'' = ±8, we have the sum ''u'' + ''v'' + ''c'' to be 30 and 14. While 30 does not fall within the sets ''D'' or ''S'', 14 falls in set ''S''. By inspection, we find that if (''a'', ''b'') = (−5, −9), then ''a'' + ''b'' = −14. Also, taking ''f'' = ± 6, we have the sum ''v'' + ''u''{{sup|∗}} + ''f'' to be 8 and -4. While 8 does not fall within the sets ''D'' or ''S'', −4 falls in set ''D''. Clearly, (''d'', ''e'') = (−7, 11) so that ''d'' + ''e'' = 4, and the second constraint equation will be satisfied. Hence the corner pair (''u'', ''v'') = (10, 12) is admissible; and it admits two solutions: {{tmath|1=(a, b, c, d, e, f) = (-7, -9, -6, -5, 11, -8)}} and {{tmath|1=(a, b, c, d, e, f) = ( -5, -9, -8, -7, 11, -6)}}. The finished skeleton squares are given below. The magic square is obtained by adding 13 to each cells. {{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:10em;height:10em;table-layout:fixed;" |- | 10 || -7 || -9 || -6 || 12 |- | 5 || || || || -5 |- | -11 || || || || 11 |- | 8 || || || || -8 |- | -12 || 7 || 9 || 6 || -10 |} {{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;" |- | 23 || 6 || 4 || 7 || 25 |- | 18 || || || || 8 |- | 2 || || || || 24 |- | 21 || || || || 5 |- | 1 || 20 || 22 || 19 || 3 |} {{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;" |- | 10 || -5 || -9 || -8 || 12 |- | 7 || || || || -7 |- | -11 || || || || 11 |- | 6 || || || || -6 |- | -12 || 5 || 9 || 8 || -10 |} {{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;" |- | 23 || 8 || 4 || 5 || 25 |- | 20 || || || || 6 |- | 2 || || || || 24 |- | 19 || || || || 7 |- | 1 || 18 || 22 || 21 || 3 |} {{col-end}} Using similar process of reasoning, we can construct the following table for the values of ''u, v, a, b, c, d, e, f'' expressed as bone numbers as given below. There are only 6 possible choices for the corner cells, which leads to 10 possible border solutions. {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:18em;height:10em;table-layout:fixed;" |- ! ''u, v'' ! ''a, b, c'' ! ''d, e, f'' |- | 12, 10 || -6, -7, -9 || -11, 5, 8 |- | 12, 10 || -5, -8, -9 || -11, 6, 7 |- | 11, 5 || 6, -10, -12 || -9, 7, 8 |- | 10, 6 || 5, -9, -12 || -11, 7, 8 |- | 10, 6 || 7, -11, -12 || -9, 5, 8 |- | 9, 7 || 5, -10, -11 || -12, 6, 8 |- | 9, 7 || 6, -10, -12 || -11, 5, 8 |- | 8, 6 || 7, -10, -11 || -12, 5, 9 |- | 8, 6 || 9, -11, -12 || -10, 5, 7 |- | 7, 5 || 9, -10, -11 || -12, 6, 8 |} Given this group of 10 borders, we can construct 10×8×(3!)<sup>2</sup> = 2880 essentially different bordered magic squares. Here the bone numbers ±5, ..., ±12 were consecutive. More bordered squares can be constructed if the numbers are not consecutive. If non-consecutive bone numbers were also used, then there are a total of 605 magic borders. Thus, the total number of order 5 essentially different bordered magic squares (with consecutive and non-consecutive numbers) is 174,240.<ref>http://oz.nthu.edu.tw/~u9621110/IT2010/txt/0929/canterburypuzzle00dudeuoft.pdf The Canterbury Puzzles and Other Curious Problems, Henry Ernest Dudeney, 1907 </ref><ref>http://budshaw.ca/howMany.html, Bordered Square Numbers, S. Harry White, 2009</ref> See history.<ref>http://www.law05.si/iwms/presentations/Styan.pdf Some illustrated comments on 5×5 golden magic matrices and on 5×5 ''Stifelsche Quadrate'', George P. H. Styan, 2014.</ref> The number of fifth-order magic squares constructible via the bordering method is about 26 times larger than via the superposition method. ===Continuous enumeration methods=== Exhaustive enumeration of all the borders of a magic square of a given order, as done previously, is very tedious. As such a structured solution is often desirable, which allows us to construct a border for a square of any order. Below we give three algorithms for constructing border for odd, doubly even, and singly even squares. These continuous enumeration algorithms were discovered in 10th century by Arab scholars; and their earliest surviving exposition comes from the two treatises by al-Buzjani and al-Antaki, although they themselves were not the discoverers.<ref name="Sesiano2007"/> Since then many more such algorithms have been discovered. '''Odd-ordered squares''': The following is the algorithm given by al-Buzjani to construct a border for odd squares. A peculiarity of this method is that for order ''n'' square, the two adjacent corners are numbers {{tmath|1=n - 1}} and {{tmath|1=n + 1}}. Starting from the cell above the lower left corner, we put the numbers alternately in left column and bottom row until we arrive at the middle cell. The next number is written in the middle cell of the bottom row just reached, after which we fill the cell in the upper left corner, then the middle cell of the right column, then the upper right corner. After this, starting from the cell above middle cell of the right column already filled, we resume the alternate placement of the numbers in the right column and the top row. Once half of the border cells are filled, the other half are filled by numbers complementary to opposite cells. The subsequent inner borders is filled in the same manner, until the square of order 3 is filled.<ref name="Sesiano2007"/> Below is an example for 9th-order square. {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:18em;height:18em;table-layout:fixed;" |- | style="background-color: cyan"|'''8''' || 80 || 78 || 76 || 75 || '''12''' || '''14''' || '''16''' || style="background-color: cyan"|'''10''' |- | 67 || style="background-color: cyan"|'''22''' || 64 || 62 || 61 || '''26''' || '''28''' || style="background-color: cyan"|'''24''' || '''15''' |- | 69 || 55 || style="background-color: cyan"|'''32''' || 52 || 51 || '''36''' || style="background-color: cyan"|'''34''' || '''27''' || '''13''' |- | 71 || 57 || 47 || style="background-color: cyan"|'''38''' || 45 || style="background-color: cyan"|'''40''' || '''35''' || '''25''' || '''11''' |- | 73 || 59 || 49 || 43 || style="background-color: pink"|'''41''' || style="background-color: yellow"|'''39''' || style="background-color: yellow"|'''33''' || style="background-color: yellow"|'''23''' || style="background-color: yellow"|'''9''' |- | '''5''' || '''19''' || '''29''' || 42 || style="background-color: yellow"|'''37''' || 44 || 53 || 63 || 77 |- | '''3''' || '''17''' || 48 || '''30''' || style="background-color: yellow"|'''31''' || 46 || 50 || 65 || 79 |- | '''1''' || 58 || '''18''' || '''20''' || style="background-color: yellow"|'''21''' || 56 || 54 || 60 || 81 |- | 72 || '''2''' || '''4''' || '''6''' || style="background-color: yellow"|'''7''' || 70 || 68 || 66 || 74 |} '''Doubly even order''': The following is the method given by al-Antaki. Consider an empty border of order ''n'' = 4''k'' with ''k'' ≥ 3. The peculiarity of this algorithm is that the adjacent corner cells are occupied by numbers ''n'' and {{tmath|1=n - 1}}. Starting at the upper left corner cell, we put the successive numbers by groups of four, the first one next to the corner, the second and the third on the bottom, and the fourth at the top, and so on until there remains in the top row (excluding the corners) six empty cells. We then write the next two numbers above and the next four below. We then fill the upper corners, first left then right. We place the next number below the upper right corner in the right column, the next number on the other side in the left column. We then resume placing groups of four consecutive numbers in the two columns as before. Once half of the border cells are filled, the other half are filled by numbers complementary to opposite cells.<ref name="Sesiano2007"/> The example below gives the border for order 16 square. {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:38em;height:38em;table-layout:fixed;" |- | style="background-color: cyan"|'''15''' || '''1''' || 255 || 254 || '''4''' || '''5''' || 251 || 250 || '''8''' || style="background-color: pink"|'''9''' || style="background-color: pink"|'''10''' || 246 || 245 || 244 || 243 || style="background-color: cyan"|'''16''' |- | 240 || || || || || || || || || || || || || || || style="background-color: yellow"|'''17''' |- | style="background-color: yellow"|'''18''' || || || || || || || || || || || || || || || 239 |- | '''19''' || || || || || || || || || || || || || || || 238 |- | 237 || || || || || || || || || || || || || || || '''20''' |- | 236 || || || || || || || || || || || || || || || '''21''' |- | '''22''' || || || || || || || || || || || || || || || 235 |- | '''23''' || || || || || || || || || || || || || || || 234 |- | 233 || || || || || || || || || || || || || || || '''24''' |- | 232 || || || || || || || || || || || || || || || '''25''' |- | '''26''' || || || || || || || || || || || || || || || 231 |- | '''27''' || || || || || || || || || || || || || || || 230 |- | 229 || || || || || || || || || || || || || || || '''28''' |- | 228 || || || || || || || || || || || || || || || '''29''' |- | '''30''' || || || || || || || || || || || || || || || 227 |- | 241 || 256 || '''2''' || '''3''' || 253 || 252 || '''6''' || '''7''' || 249 || 248 || 247 || style="background-color: pink"|'''11''' || style="background-color: pink"|'''12''' || style="background-color: pink"|'''13''' || style="background-color: pink"|'''14''' || 242 |} For order 8 square, we just begin directly with the six cells. {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:16em;height:16em;table-layout:fixed;" |- | style="background-color: cyan"|'''7''' || style="background-color: pink"|'''1''' || style="background-color: pink"|'''2''' || 62 || 61 || 60 || 59 || style="background-color: cyan"|'''8''' |- | 56 || || || || || || || '''9''' |- | '''10''' || || || || || || || 55 |- | '''11''' || || || || || || || 54 |- | 53 || || || || || || || '''12''' |- | 52 || || || || || || || '''13''' |- | '''14''' || || || || || || || 51 |- | 57 || 64 || 63 || style="background-color: pink"|'''3''' || style="background-color: pink"|'''4''' || style="background-color: pink"|'''5''' || style="background-color: pink"|'''6''' || 58 |} '''Singly even order''': For singly even order, we have the algorithm given by al-Antaki. Here the corner cells are occupied by ''n'' and ''n'' − 1. Below is an example of 10th-order square. Start by placing 1 at the bottom row next to the left corner cell, then place 2 in the top row. After this, place 3 at the bottom row and turn around the border in anti-clockwise direction placing the next numbers, until ''n'' − 2 is reached on the right column. The next two numbers are placed in the upper corners (''n'' − 1 in upper left corner and ''n'' in upper right corner). Then, the next two numbers are placed on the left column, then we resume the cyclic placement of the numbers until half of all the border cells are filled. Once half of the border cells are filled, the other half are filled by numbers complementary to opposite cells.<ref name="Sesiano2007"/> {| class="wikitable" style="margin-left:auto;margin-right:auto;text-align:center;width:22em;height:22em;table-layout:fixed;" |- | style="background-color: cyan"|'''9''' || 100 || style="background-color: pink"|'''2''' || 98 || '''5''' || 94 || 88 || '''15''' || 84 || style="background-color: cyan"|'''10''' |- | 83 || || || || || || || || || '''18''' |- | '''16''' || || || || || || || || || 85 |- | 87 || || || || || || || || || '''14''' |- | style="background-color: yellow"|'''12''' || || || || || || || || || 89 |- | style="background-color: yellow"|'''11''' || || || || || || || || || 90 |- | 93 || || || || || || || || || style="background-color: yellow"|'''8''' |- | '''6''' || || || || || || || || || 95 |- | 97 || || || || || || || || || '''4''' |- | 91 || style="background-color: pink"|'''1''' || 99 || '''3''' || 96 || '''7''' || '''13''' || 86 || '''17''' || 92 |}
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)