Math, asked by archusingh13, 1 year ago

how to make a magic square

Answers

Answered by arpitdesh04
2
A magic square is an NxN matrix in which every row, column, and diagonal add up to the same number. Ever wonder how to construct a magic square?

A silly way to make one is to put the same number in every entry of the matrix. So, let's make the problem more interesting--- let's demand that we use theconsecutive numbers.

I will show you a method that works when N is odd. As an example, consider a 3x3 magic square. Start with the middle entry of the top row. Place a 1 there. Now we'll move consecutively through the other squares and place the numbers 2, 3, 4, etc. It's easy: after placing a number, just remember to always move:

1. diagonally up and to the right when you can, 
2. down if you cannot.The only thing you must remember is to imagine the matrix has "wrap-around", i.e., if you move off one edge of the magic square, you re-enter on the other side.

Thus , from the 1 you move up/right (with wraparound) to the bottom right corner to place a 2. Then you move again (with wraparound) to the middle left to place the 3. Then you cannot move up/right from here, so move down to the bottom left, and place the 4. Continue...

It's that simple. Doing so will ensure that every square gets filled!

Similar questions