I'm stuck with this math puzzle, tried many strategies but can't solve it. I have to fill a 4x4 magic square that sums up to 38 (row, column, and both diagonals) with these given numbers: 4, 6, 7, 7, 8, 8, 11, 12, 12, 13, 14, 10, 10, 10, 10, 10 .There should be more than one solution, what's the best way to think about it?

  • 1
    $\begingroup$ Welcome to Puzzling.SE! Where did you get this puzzle from? If it's from another website, you'll need to provide the original source. Feel free to take the tour and visit the help center to learn more about the site, and I hope you enjoy your stay! $\endgroup$
    – F1Krazy
    Commented Apr 3, 2018 at 15:14
  • $\begingroup$ Hi F1Krazy thanks for the warm welcome, this puzzle comes from a book, should I write its title? This website is really amazing! $\endgroup$
    – Albert_ITA
    Commented Apr 3, 2018 at 15:50

4 Answers 4


Here's how I would go about it:

Firstly, we want to split the numbers in two groups, each having 8 numbers with a total of 76. We are going to use one of the groups for the diagonals, and the other for the edges. To be able to construct the diagonals, at least one of the groups needs to be further splittable into two equal parts of 4 numbers of total 38.

Before that, I'd check on a couple of constraints based on parity, symmetry, and the smallest and largest values.

Parity constraints

Since all the sums are even, there are only a couple of possible ways to place the four odd numbers:

  1. one in each corner
  2. in the four centre squares
  3. at the corners of a 3x3 square
  4. in a small square in one corner
  5. pairwise on opposing edges


A magic square has, in addition to the obvious mirroring and rotating, a couple of other symmetries we can use to further prune our search tree.

Looking closely at the possible shapes made by the odd numbers, we'll notice that the first option is actually equivalent with the second one. That's because one can be transformed into the other while every sum still contains exactly the same numbers:

a b c d        f e h g
e f g h    ->  b a d c
i j k l        n m p o
m n o p        j i l k

(Each quadrant independently rotated 180 degrees)

Therefore, if a solution exists for configuration 1, a symmetrical solution is guaranteed to exist for configuration 2.

Similarly, case 3 is equivalent with case 4:

a b c d        a c b d
e f g h    ->  i k j l
i j k l        e g f h
m n o p        m o n p

(Middle rows swapped, then middle columns swapped)

So it's enough to test for odd number configurations 2, 4 and 5, we won't be missing any solutions by ignoring the other cases. (I'm making all this up as I go, so there is the distinct possibility that I have missed some other possible configuration for the odd numbers. Let's hope not.)

Applying the mirror and rotational symmetries in addition to these, and pruning any duplicates, the remaining search tree starts to look pretty approachable.

(By the way, using these same symmetries, any answer we find can later be transformed into other solutions.)

Extreme values

Still, before starting, I'd check for extreme values. On average, each number needs to be 9.5. That makes 4 the most difficult fit; it always requires 34 from its three companions. Since we cannot find three distinct triplets summing up to 34 in our number set, it's clear that we cannot put 4 on a diagonal. For the same reason, 14 wants to go on an edge, and probably 6 and 13 too. (EDIT: I must have been very tired when I wrote this. Such triplets do exist, even for placing 4 on a diagonal.)

So, finally, let's try picking numbers for a first split:

Trial and error

I started with putting all the extreme numbers 4, 6, 13 and 14 in the same group. Since 4 and 6 are very small, I wanted to separate them from both of the sevens, so I needed to put 11 in the same group with 13 to even up the groups' parity. We still need three other numbers summing up to 28, and there's only one way to do that (EDIT: oops, there are actually two. The other one won't work at all though), so the first split attempt becomes

4, 6, 7, 7, 8, 8, 11, 12, 12, 13, 14, 10, 10, 10, 10, 10

The emboldened group contains the 4, so that group will go to the edges. The rest will go to the diagonals.

Now that there are odd numbers both on and off the diagonals, the "small square in a corner" is the only configuration for the odd numbers we need to check. Starting from from there, and constructing the diagonals first, we get:

7  11     d   (a,b,c,d: 8,10,10,10 in some order)
13  7  c      (remaining edges: 4,6,8,10,10,14)
    b 12
 a       12   

Our split forced the sevens onto a diagonal in the corner, which in turn forced the twelves on the same diagonal. By mirror symmetry, it won't matter which way we place 11 and 13. The other diagonal is almost entirely tens, and it's easy to check all possibilities, particularly since a and c cannot bot be tens (we would immediately run out of eights on the edges if they were):

7  11    10      7 11    10
13  7 10  8     13  7  8 10
10 10 12 XX      8 10 12 XX
 8       12     10       12

Both cases end in a conflict at "XX", and there are no other arrangements to try, so the initial split was wrong.

Backtrack and regroup

Keeping in line with the earlier assumptions, I'd then try swapping (11, 13) to the other group. (12,12) is the only pair in the other group with the same sum, so that's what comes back from there. Again, the bold numbers go to the edges.

4, 6, 7, 7, 8, 8, 11, 12, 12, 13, 14, 10, 10, 10, 10, 10.

Since all the odd numbers are now on the diagonals, we can put them all in the centre without any loss of generality. The sevens are adjacent, since the diagonal group doesn't have big enough numbers for a diagonal with both sevens in it. The corners are then tens, except for one corner that's an 8. Fitting 14 and 4 to the most likely places (the 4 needs to be grouped with the biggest numbers it can possibly get), and noticing that this choice forces tens in the adjacent corners, the rest of the numbers have their places forced, and we get:

  10 12  6 10     
  14  7  7 10     
   4 11 13 10      
  10  8 12  8               

Yay! It works!

So we have a working solution. But we're not quite done yet.

Apply symmetries to the solution(s)

Applying the transformations from earlier, we get the following set of equivalent solutions (and their mirrors and rotations, of course):

  10 12  6 10      7 14 10  7     10  6 12 10     13  4 10 11
  14  7  7 10     12 10 10  6      4 13 11 10      6 10 10 12
   4 11 13 10      8 10  8 12     14  7  7 10     12 10  8  8
  10  8 12  8     11  4 10 13     10 12  8  8      7 14 10  7

There may be some other symmetries I missed, and by no means is this solution guaranteed to be unique, (in fact, in NetJohn's solution has a 12 on a diagonal, so it's different from this one), but continuing along with the same kind of reasoning, there are not utterly impossibly many options left, so it should be possible to do an exhaustive search even by hand. (EDIT: after proofreading this answer and realising how many mistakes I made, I really have to recommend using a computer though..)

  • $\begingroup$ Wow!! Bravo!! Thanks a lot for your great reply, I learned a lot from it $\endgroup$
    – Albert_ITA
    Commented Apr 4, 2018 at 12:19

One thing to consider is that there are only 4 odd numbers in the puzzle: 7, 7, 11, 13.

Which means every row/column/diagonal that has one of those four numbers must have exactly two of them (you can't have all 4 in the same row for example, because then each column would have an odd sum).

  • $\begingroup$ Thanks Adam, what a brilliant observation and I think that's the main point about these math puzzles, to make these observations just like you did $\endgroup$
    – Albert_ITA
    Commented Apr 3, 2018 at 22:19

Here is an article that I found helpful Right here. It goes through the steps of how to start filling out certain part. A good way to practice is doing a 3x3 box where each row and column add up to 15. You may start by separating the largest number of 7,8,9 and smaller numbers of 1,2,3 and the middle numbers of 4,5,6. This would separate it so each row as an equal number(which is what you want).

For your puzzle you might want to split an even mix of large and small numbers. You might mix a 13,10,8,7 which has one of the largest numbers and one of the smallest numbers.


Here's one solution, in case you want to see how one worked. Please try to get it yourself, first!

10 6 10 12
10 13 11 4
10 7 7 14
8 12 10 8

I started like how Adam S. suggested, and played around until the sums worked. A little Excel work to auto-sum (and count the usage) helped.


Not the answer you're looking for? Browse other questions tagged or ask your own question.