My definition of a magic rectangle:

Any $m \times n$ rectangle where $m \ne n$ and all the numbers $1, 2, 3,\dots, mn$ fit into the rectangle. All horizontal lines, vertical lines, and diagonal lines (albeit not the same length) add up to the same number called a "magic constant"

Do any magic rectangles exist? If so, what are some examples? Please include dimensions, magic constant, and if possible, the whole rectangle.

BONUS: How can you determine a rectangle's magic constant from its $m \times n$ dimensions?

  • 1
    $\begingroup$ How are the diagonals defined? And how many are there? $\endgroup$
    – Rob Watts
    Dec 5, 2014 at 0:55
  • 1
    $\begingroup$ The diagonals are every possible diagonal line from 1 edge to another. In the case of a 2x3 there'd be 8 (Unless I miscounted) $\endgroup$
    – warspyking
    Dec 5, 2014 at 1:00
  • $\begingroup$ @Robb Any other confusions? $\endgroup$
    – warspyking
    Dec 5, 2014 at 1:01

2 Answers 2


No such rectangle exists.

Suppose you have a rectangle with $m$ rows and $n$ columns. If every row adds up to some magic value $M$, then the number obtained by adding together every cell in the rectangle must be $m \times M$.

Likewise, if every column adds up to $M$, then the value obtained by adding together every cell in the rectangle must also equal $n \times M$.

So, $m \times M = n \times M$. This can only be true if $m = n$, which corresponds to a square.

  • 5
    $\begingroup$ Sound so obvious once you've read it, but it wouldn't have crossed my mind immediately. +1 for pointing out the obvious... $\endgroup$
    – BmyGuest
    Dec 5, 2014 at 6:46
  • 3
    $\begingroup$ In addition, even if we relax the constraint that m != n, there still exists no nontrivial magic square with the "diagonal" rule in the OP. Consider the top-left corner. It is both an element of the long diagonal going all the way to the opposite corner, and the sole element of a very short diagonal perpendicular to the other one. If the sums in both of these diagonals must be equal, then all the other elements of the long diagonal must be 0; but 0 isn't a permitted number in the square. $\endgroup$
    – lily
    Dec 5, 2014 at 12:08
  • $\begingroup$ @IstvanChung If the requirements were relaxed even further such that only diagonals of length equal to the shorter side length were considered and three different sums are permitted for horizontal, vertical, and diagonals, then it might be possible. If we completely ignore the diagonals, then it certainly is possible for m=2, n=4. And it is simple to show that m+n must be even. $\endgroup$
    – kasperd
    Dec 5, 2014 at 12:38
  • 2
    $\begingroup$ Istvan Chung, I think that is almost right, but you need to exclude the case where m = n = 1. $\endgroup$ Dec 5, 2014 at 22:37
  • 1
    $\begingroup$ @DougMcClean I think that's probably the "nontrivial" part. $\endgroup$
    – wchargin
    Dec 7, 2014 at 5:33

As the other answer notes, no two finite numbers can get a solution However, if we get into the transfinite region, we can easily say one side is infinity and the other is infinity*2, we can get a solution. This is because everything contains the same amount of points, as points are infintesimal. There are infinitely many possible solutions.

  • 4
    $\begingroup$ I don't think infinite numbers are meant to be in the scope of this question. $\endgroup$ Apr 19, 2017 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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