Wednesday, July 13, 2016

Magic Square

A magic square is a square array of numbers, usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number, called the "magic constant."

  The earliest known magic square is Chinese, recorded around 2800 B.C. Fuh-Hi described the "Loh-Shu", or "scroll of the river Loh". It is a typical 3x3 magic square except that the numbers were represented by patterns not numerals.
 
   A magic square has the same number of rows and columns, and in conventional math notation, "n" stands for the number of rows or columns it has. Thus, a magic square always contains n2 numbers, and its size is described as being "of order n". Magic squares can be classified into three types: odd (i.e: 3x3, 5x5) , doubly even (n divisible by four, i.e: 4x4, 8x8) and singly even (n even, but not divisible by four, i.e: 6x6, 10x10).

 To solve a magic square you can go through the following steps:
  1. Calculate the magic constant using formula:  Magic constant = [n(n2 + 1)] / 2 .
  2. Consider the last row at the top of the upper row (as an imaginary row ) and the first column at the right side of the last column (as an imaginary column ).
  3. You've to start from the center box of the upper row. So, put the number 1 in the box.
  4. Fill the boxes crosswise to the upper row serially with the numbers one by one.
  5. Drag the number placed in the imaginary box to it's equivalent real box.
  6. If the box is already filled or there is no box (real or imaginary) then put the next serial number to the box at the bottom.
  7. Then again proceed filling the boxes crosswise to the upper row serially with the numbers one by one.
Suppose, we have a 5x5 magic square, then 5x5=25 boxes will have to fill up by the above process like as follows:



I hope you've already understood the process, now start solving 3x3 magic square and test yourself.

Solution of 3x3 magic square:

You can add up any row, column or the diagonals. The sum is equal to the magic constant 15.

0 comments:

Post a Comment