Magic Square Puzzle

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

A magic square is a square of numbers in which the numbers in the rows, columns and both diagonals have a common sum. A completed magic square should have a solution such that each entry is unique among a given range of numbers, and the sums of the rows and columns in the square are equal.


The example presents a magic square where the numbers to be distributed in the square range from to 8, and the goal is to find a common sum for each row and column.

There is more than one solution for magic squares, since the puzzle is still valid if the rows are reversed horizontally or vertically.


Contributed by: Ajay Kumar (August 2019)
Open content licensed under CC BY-NC-SA


Snapshot 1: initial starting point for puzzle

Snapshot 2: shows answer key before attempting to complete the puzzle

Snapshot 3: shows answer key after incorrectly attempting to complete the puzzle

Diagonal sums are represented in blue.


[1] I. Moscovich, Fiendishly Difficult Math Puzzles, New York: Sterling Publishing Co., 1991.

This was a project for Advanced Topics in Mathematics II, 2018–2019, Torrey Pines High School, San Diego, CA.


Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.