This article was co-authored by wikiHow staff writer, Hunter Rising. Hunter Rising is a wikiHow Staff Writer based in Los Angeles. He has more than three years of experience writing for and working with wikiHow. Hunter holds a BFA in Entertainment Design from the University of Wisconsin - Stout and a Minor in English Writing.
There are 11 references cited in this article, which can be found at the bottom of the page.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 1,138,023 times.
Learn more...
If you’re a fan of math and logic puzzles like Sudoku or Kenken, then trying to solve a magic square is the perfect little challenge to try out. A magic square is a grid of numbers where each row, column, and diagonal add up to the same sum. How you solve your magic square depends on the size of the puzzle, but they each have easy instructions for filling them in. Keep reading and we’ll walk through our solving strategies step by step to finish any odd- or even-numbered magic square.
Things You Should Know
- A magic square is a square grid of numbers where each row, column, and diagonal add up to the same total.
- Find the “magic constant” sum of each row, column, and diagonal with where n is the number of squares in each row.
- Use a solving technique based on the size of the magic square and how many boxes are in each row or column.
Steps
3 x 3 or Odd-Numbered Squares
-
Calculate the magic constant. To find the magic constant (S) for a normal magic square use the formula where equals the order, or number of rows, in the magic square. So for a 3×3 magic square, the formula would be:[2]
- S =
- S =
- S =
- S =
- S = 15
- All rows, columns, and diagonals must add up to 15.
- Normal magic squares always have the same magic constant. If solving for a non-normal square, add all the numbers together and divide by the number of rows to find the magic constant.
-
Place the number 1 in the center box on the top row. The placement is the same for any normal magic square with an odd number of columns or rows. Find the center square in the top row and write down the number 1 to get started.[3]
- Example: If you have a 3 x 3 magic square, put 1 in the second box in the top row.
- Example: For a 15 x 15 magic square, put the 1 in the eighth box of the row.
-
Follow an up-one, right-one pattern to fill in the remaining numbers. Start at the middle box in the top row where you placed the 1. Move up one row and to the right one column and write in the next number sequentially. Whenever a move takes you above the top row (like the first move will), go to the bottom row instead. If you need to move a square to the right but are already in the rightmost column, move to the leftmost column instead. Continue filling in the square following the pattern until it’s complete.[4]
- Example: In a normal 3 x 3 square, the 2 goes in the bottom right corner and the 3 goes in the left column in the center row.
- If the movement takes you to a box that is already occupied, go back to the last box that has been filled in, and place the next number directly below it. For example, when you place the 4 in a 3 x 3 magic square, it fits in the bottom left corner below the 3. Then, following the same up-one, right-one pattern, place the 5 in the center of the puzzle to continue.
4 x4 or Doubly Even Magic Square
-
Recognize a doubly even square if the sides are divisible by 4. Count the number of squares in a single row or column of your magic square. If the magic square is an order 4 square or the number is evenly divisible by 4 (8, 12, 16, etc.), then you’re working with a doubly even square.[5]
-
Calculate the magic constant. Use the formula , where equals the order, or the number of boxes per row in your magic square. So, for a 4 x 4 square, the magic constant calculation becomes:[6]
- S =
- S =
- S =
- S =
- S = 34
- All rows, columns, and diagonals must add up to 34.
-
Create Highlights A–D in the corners of the magic square. Form a mini square in each corner that has a length of on each side, where is the magic square’s order. Start in the top left corner and label the mini squares A, B, C, and D going clockwise around the magic square.[7]
- In a 4 x 4 square, only mark the 4 corner boxes as your highlights.
- For an 8 x 8 magic square, the Highlights become 2 x 2 mini squares in the corners.
- In a 12 x 12 square, each Highlight is a 3 x 3 area.
-
Create the Central Highlight. Mark all the boxes in the center of the magic square in a square area of length , where is the magic square’s order. The Central highlight will touch a 1 corner each from Highlights A–D, but it shouldn’t overlap them at all.[8]
- In a 4 x 4 square, the Central Highlight would be a 2 x 2 area in the center.
- In an 8 x 8 square, the Central Highlight would be a 4 x 4 area in the center.
-
Fill in the highlighted areas of your magic square. Start in the top left corner of your magic square. Place 1 in the top left corner and count the boxes across the top row. If a box is highlighted, fill it in with the number. Work down the entire magic square until all the highlighted areas are filled in. In an order 4 magic square, the boxes and their numbers are:[9]
- 1 in the top-left box and 4 in the top-right box
- 6 and 7 in the second and third boxes in Row 2
- 10 and 11 in the second and third boxes of Row 3
- 13 in the bottom-left box and 16 in the bottom-right box
-
Fill in the rest of the magic square by counting backward. Begin again with the top left box, but skip over all the boxes that you already filled in. Count down from the highest number in the magic square as you work across the row, and add the number to any empty box. Once you finish, your magic square is complete. In a 4x4 magic square, the boxes you fill in are:[10]
- 15 and 14 in the second and third boxes in Row 1
- 12 in the leftmost box and 9 in the rightmost box in Row 2
- 8 in the leftmost box and 5 in the rightmost box in Row 3
- 3 and 2 in the second and third boxes in Row 4
Singly Even Magic Square
-
Check if the square’s sides are divisible by 2, but not 4. Singly even magic squares have an even number of boxes in their rows and columns. If you divide the magic square’s order by 2 and get an odd number as the result, you’re working with a singly even square.[11]
- The smallest possible singly even magic square is 6 x 6 since 2 x 2 magic squares are impossible to make.
-
Calculate the magic constant. Use the formula , where n equals the magic square’s order, or the number of boxes per side. For a 6 x 6 square, your formula would look like:[12]
- S =
- S =
- S =
- S =
- S = 111
- Hence, the magic constant for a 6×6 square is 111 and all rows, columns, and diagonals will add up to this number.
-
Divide the magic square into four quadrants of equal size. Divide the magic square’s order by 2 to find out how many boxes each side of the quadrant should be. Draw lines to separate the quadrants and label them A (top left), C (top right), D (bottom left), and B (bottom right).[13]
- For a 6 x 6 square, each quadrant is 3 x 3 boxes.
-
Assign each quadrant a number range. Count the number of boxes in a single quadrant to know how many numbers are in each section. Assign Quadrant A the first quarter of numbers, Quadrant B the second quarter, Quadrant C the third quarter, and Quadrant D the final quarter. That way, you know which numbers are going into specific quadrants without accidentally reusing them.[14]
- In a 6 x 6 square, Quadrant A contains the numbers 1-9, Quadrant B has 10-18, Quadrant C has 19-27, and Quadrant D ends with 28-36.
-
Solve each quadrant using a one-up, one-right pattern. In each quadrant, put the lowest value in the center box in the top row. Move up one row and to the right one column to place your next number. If you go above the top row of the quadrant, then move to the bottom row instead. When you go past the rightmost column, add the number to the leftmost column. If there’s already a number in the next square, put the next number directly below the last one.[15]
-
Create Highlights A and D. In Quadrant A, mark all the squares in the top row to the left of the quadrant’s center square. In the second row, skip the first column and highlight the center square and remaining boxes to the left of it. Then, mark the squares in the bottom row that share a column with the boxes in the top row to finish the A highlights. Then, repeat the same process in Quadrant D for the D highlights.[16]
- In a 6 x 6 square, Highlight A-1 is the top right box, Highlight A-2 is the center box in the middle row, and Highlight A-3 is the bottom right corner of Quadrant A. The D highlights are in the same position in Quadrant D.
- If you tried to add up your columns, rows, and diagonals right now, the square isn’t considered magic since they don’t add up to the same magic constant yet.
-
Swap the positions of Highlights A and D. Simply take the number from one square and swap it with the corresponding box between Quadrant A and Quadrant D. Once you’ve done this, all the rows, columns, and diagonals in a 6 x 6 magic square will add up to the magic constant you calculated.
- Example: In a 6 x 6 magic square, 8 swaps positions with 35, 5 swaps with 32, and 4 swaps with 31.
-
Swap the right columns in B and C for magic squares larger than 6 x 6. Count the highlighted columns in the top row of Quadrant A and subtract 1. Count that number of columns in from the right side of Quadrants B and C and highlight all the squares. Move the values in Quadrant C into the corresponding squares in Quadrant B, and vice-versa to complete your magic square.[17]
- For a 10 x 10 magic square, only swap the rightmost column in quadrants B and C.
- For a 14 x 14 magic square, swap the 2 rightmost columns instead.
Community Q&A
-
QuestionHow do you solve a 7x7 magic square?wikiHow Staff EditorThis answer was written by one of our trained team of researchers who validated it for accuracy and comprehensiveness.
Staff AnswerwikiHow Staff EditorStaff AnswerPlace the first number of the magic square in the center box of the top row. Then, use an up-one, right-one pattern to add the numbers. -
QuestionHow do I solve a magic square with no known sum?wikiHow Staff EditorThis answer was written by one of our trained team of researchers who validated it for accuracy and comprehensiveness.
Staff AnswerwikiHow Staff EditorStaff AnswerMagic squares with numbers that start at 1 and are in consecutive order always have the same sum. A 3 x 3 magic square always has the sum of 15 and a 4 x 4 has a sum of 34. -
QuestionHow do you make a 4 x 4 magic square using only 0-9 digits?wikiHow Staff EditorThis answer was written by one of our trained team of researchers who validated it for accuracy and comprehensiveness.
Staff AnswerwikiHow Staff EditorStaff AnswerTypically, you can't repeat digits in a magic square so making a 4 x 4 with the digits 0-9 isn't possible unless you repeat them.
Video
Tips
References
- ↑ https://www.researchgate.net/publication/315457341_A_STUDY_ON_MAGIC_SQUARES
- ↑ https://mae.ufl.edu/~uhk/MAGIC-SQUARE.pdf
- ↑ https://math.hmc.edu/funfacts/making-magic-squares/
- ↑ https://faculty.etsu.edu/stephen/matrix-magic-squares.pdf
- ↑ https://www.researchgate.net/publication/332496561_Algorithm_for_Doubly_Even_Magic_square
- ↑ https://support.sas.com/resources/papers/proceedings09/201-2009.pdf
- ↑ https://www.1728.org/magicsq2.htm
- ↑ https://www.1728.org/magicsq2.htm
- ↑ https://www.1728.org/magicsq2.htm
- ↑ https://faculty.etsu.edu/stephen/matrix-magic-squares.pdf
- ↑ https://www.math.wichita.edu/~richardson/mathematics/magic%20squares/even-ordermagicsquares.html
- ↑ https://www.researchgate.net/publication/315457341_A_STUDY_ON_MAGIC_SQUARES
- ↑ https://www.rsisinternational.org/journals/ijrsi/digital-library/volume-5-issue-6/91-94.pdf
- ↑ https://www.1728.org/magicsq3.htm
- ↑ https://www.math.wichita.edu/~richardson/mathematics/magic%20squares/even-ordermagicsquares.html
- ↑ https://www.1728.org/magicsq3.htm
- ↑ https://www.math.wichita.edu/~richardson/mathematics/magic%20squares/even-ordermagicsquares.html
About This Article
To solve an odd-numbered magic square, start by using the formula n[(n^2+1)/2] to calculate the magic constant, or the number that all rows, columns, and diagonals must add up to. For example, in a 3 by 3 square where n=3, the magic constant is 15. Next, start your square by placing the number 1 in the center box of the top row. Then, arrange the rest of the numbers sequentially by moving up 1 row, then 1 column to the right. To learn more, including how to solve singly even magic squares and doubly even magic squares, read on.