Magic Cubes - The Basics


On this page we show features or characteristics common to all magic cubes. Many special magic cubes contain features that are unique to that type of cube. These features will be presented as we discuss the appropriate cubes.


A demonstration of different methods to present a magic cube on paper.

Basic Parts

Rows, columns, pillars, triagonals, diagonals, squares

Orthogonal (planar) squares

The 3m planes that are parallel to the sides of the cube

Associated magic cubes

The 3 dimensional equivalent of the associated magic square.

Pan & Semi-pan magic cubes

Compares features of pan and semi-pan squares and cubes.

Oblique squares

Six square arrays in a magic cube that are not often discussed.

Basic magic squares

Introducing the concept of aspects, normalizing, and indexing

Basic cubes and aspects

The 48 aspects of a magic cube, and how to obtain the basic one


Coordinates in a magic cube array, and their uses


Placement of even and odd numbers in order 3 magic hypercubes.


This is the traditional method. It was used by W.S. Andrews and others circa 1900. [1] [2]
In recent years, the grid is often not used, so just the cell numbers are presented.

The horizontal planes of the cube are shown, in reverse order, from top to bottom (plane 1 on the bottom). For smaller order cubes, the m planes are usually printed side by side to conserve vertical space on the page.

This graphic illustration gives a clearer picture of the relationship of the numbers in the cube.

This method of presentation is very good for cubes of low orders. However, for orders higher then 5 or 6, it is time consuming to prepare, and it becomes increasingly harder to follow the pillars and triagonals in the diagram.

This method was used by early investigators and is currently favored by
 M. Trenkler. [3] (However, he also uses the first method, show above.)

Notice that this displays vertical, instead of horizontal planes.

Two pages on representation for all dimensions of hypercubes is here.

[1] W. S. Andrews, Magic Squares & Cubes, Open Court, 1908, 193+ pages.
[2] Hermann Schubert, Mathematical Essays and Recreations. Translated from German to English by Thomas J. McCormack, Open Court, 1899. 143+ pages.
Marián Trenkler, A construction of magic cubes,   The Mathematical Gazette, 84(2000), 36-41,.

Basic parts

There are 3m2 rows, columns and pillars in a magic cube. All are required to sum to the magic constant.
There are 4 triagonals. All 4 must sum to the correct constant.

These are the minimum requirements for a simple magic cube.

There may be some diagonals that sum correctly, but that is not a requirement for a simple magic cube.

This cube in this illustration is the basis for other diagrams on this page.

Orthogonal (planar) squares

The rows, columns, pillars, and triagonals may be considered the primary building blocks of a magic cube. They are the elements we are usually concerned with when constructing a magic cube.

However, when we wish to construct a cube with more advanced features, there is another element we must consider. That is the square arrays within the cube.
There are 2 types of square arrays. The first type are parallel to the sides of the cube and are often called orthogonal or planar squares. There are 3m squares of this type in a magic cube.
If each of the 2 diagonals of one of these squares sum correctly, that square is magic.

The 2nd type of square array goes on the diagonal from the junction of 2 faces, through the center of the cube, to the junction of the opposite 2 faces. These will be discussed a little further down the page.

I have chosen to illustrate the planar squares by showing the central square in each direction. Obviously, there are central squares only if the cube is of odd order.

Each cell in the cube is common to 3 squares. Here the 14 is common to all 3 central squares. The 20, for instance, is common to the top horizontal square, the front vertical square, and the central square parallel to the sides.

In this order 3 cube, the only cells not included in the 3 central planar squares are the 8 corners of the cube. As the order of the cube increases the number of cells not included in the central planes becomes an ever greater percentage of the total cells.

The horizontal planes are often used to present a magic cube on paper in text only format. For larger orders, it is much more practical then using the grid diagram.

Associated magic cubes

Reproduced here is the central horizontal plane of the above magic cube.

Notice that the rows and columns sum correctly to 42.
Check the pair of numbers on opposite sides of the central 14. In all cases the pair sums to 28 which is equal to m3 + 1 and 28 + 14 = 42, the magic constant of this cube. Because the pairs we checked include the 2 diagonals, this plane is an associated magic square.

This feature is common to the 3 central planes of all odd order associated magic hypercubes, regardless of order or dimension. So, if an odd order magic cube is associated, it contains at least 3 magic squares.

BTW. Order 3 hypercubes of all dimensions are associated. i.e squares, tesseracts, etc
Associated magic squares, cubes, etc., are center-symmetric. Magic hypercubes of higher dimensions have other types of symmetry as well.
There is much more information on these and other types of symmetrical cubes on my Self-similar cubes page.

Pandiagonal and semi-pandiagonal magic squares and cubes

Both main diagonals must sum correctly in order for a square to be considered magic.
The four main triagonals of a cube must sum correctly in order for the cube to be considered magic.
Pandiagonal and semi-pandiagonal are extra features a magic square or cube may have.

Pandiagonal magic squares

01  08  13  12
15  10  03  06
04  05  16  09
14  11  02  07
Order 4 pandiagonal

01  07  25  19  13
20  14  03  06  22
08  21  17  15  04
12  05  09  23  16
24  18  11  02  10
Order 5 pandiagonal


If all the broken diagonals in a magic square also sum correctly, the square is classed as pandiagonal.
The equivalent in a magic cube is when all the broken triagonals sum correctly. The cube is then called pantriagonal.

In a magic square, the broken diagonals consist of 2 segments. In a magic cube, the broken triagonals may consist of 2 or 3 segments.

In each of these pandiagonal magic square examples, I highlight a main diagonal in red, and 2 broken diagonal pairs in blue and violet.

A pandiagonal magic square has the feature that a row or column may be moved from one edge to the opposite edge and the square remains magic.
A pantriagonal magic cube has the feature that an entire plane may be moved from one edge to the opposite edge and the cube remains magic.

Semi-pandiagonal m. s.

03  06  13  12
10  15  08  01
16  09  02  07
05  04  11  14
Order 4 semi-pandiagonal

12  01  20  09  23
21  15  04  18  07
10  24  13  02  16
19  08  22  11  05
03  17  06  25  14
Order 5 semi-pandiagonal


This is another broad classification for magic hypercubes.

In this case, we consider a broken diagonal pair where each of two parallel segments have an equal number of cells. For an even order square or cube, each segment contains m/2 cells that together sum to S.

An odd order square or cube there are several combinations that sum to S:
The two segments that each contain m-1 cells sum to S when the center cell is added.
The two segments that each contain m+1 cells sum to S when the center cell is subtracted.

If both segments of each broken diagonal pair of an even order square sum to S/2, then that is a bent diagonal square. It is not associated. Some even order and all odd order semi-pandiagonal magic squares are associated.
The same characteristics apply to semi-pantriagonal magic cubes.

Pandiagonal and semi-pandiagonal magic squares and cubes are covered in much more detail and examples on my c_semi-pan.htm page.
My c_groups.htm page shows the relationships between simple, associated, pandiagonal/pantriagonal and semi-pan squares and cubes of order 4.

Oblique squares

Besides the 3m orthogonal squares, a second type of square array goes on the diagonal from the junction of 2 faces, through the center of the cube, to the junction of the opposite 2 faces.
There are 6 squares of this type in any cube, regardless of the order.

Reproduced from top of page

Above are the 3 pairs of oblique squares, with the complete grid shown for 1 square of each pair.

The most significant lines in these square arrays are the red lines. They are diagonals in these squares but are the triagonals of the cube. Actually, each triagonal appears as a diagonal in 3 oblique squares (6 squares times 2 = 12 and 12/3 = 4 triagonals).
The green lines are rows, columns or pillars in the orthogonal square arrays.

The oblique squares (planes) are not nearly as significant as the orthogonal ones are. However, they are another feature of a magic cube, and contribute to the total count of magic squares within the cube.

Broken oblique planes
Each of the six oblique planes has m-1 parallel planes that consist of two segments. these are analogous to the broken diagonals of a magic square.
And just as these broken diagonals sum correctly in a pandiagonal magic square, so are the planes correct (i.e. magic squares) in a perfect magic cube. In fact a perfect magic cube contains 9m pandiagonal magic squares.

To review characteristics of a magic cube.

  • There are 3m orthogonal square arrays. Rows and columns and pillars must sum correctly, but diagonals need not.
    However in an odd order associated magic cube, the 3 central planes will have correct diagonals, meaning that these cubes contain at least 3 magic squares.
  • There are 6 oblique square arrays in any type, and any order, of magic cube.
    Diagonals of these squares must sum correctly (they are the triagonals of the cube). Rows and columns of these arrays need not sum correctly.
  • Higher types of magic cubes (not yet discussed) will contain varying numbers and types of magic squares.

Basic magic squares

There is 1 basic magic square of order 3. However, it may be shown in 7 other 'disguised' versions that are obtained by rotations and reflections. These 8 variations of the magic square are called aspects and are all considered equivalent when enumerating or comparing magic squares. Before 1675, Frénicle de Bessy listed all 880 basic solutions for the order 4 magic squares. To do so, he devised a method to determine which of the 8 aspects of each square should be called the basic square. There are only two simple rules to determine the basic square:

  1. Rotate the magic square so that the cell in the top left corner of the square (the first cell of row 1) is the lowest value of all the corner cells.
  2. If necessary, reflect the square around the leading diagonal so that the cell to the right of the top left corner is a lower value then the first cell of row 2.
Because there is just 1 order 3 square, indexing is rather irrelevant. Therefore, which is the basic magic square of this order is not important. However, for higher orders, this is an important concept!

BTW Note that the order 3 magic square is associated, as per the statement made previously, that all order 3 hypercubes are associated.

Basic cubes and aspects

The order 3 magic square has 1 basic solution and 8 variations (aspects).
The order 3 magic cube has 4 basic solutions and 48 variations (aspects).

There are 8 possible corners of a magic cube, that may be placed lower, front, left. There are 3 rays extending from that corner which may be labeled in 6 different ways. That gives 8 times 6 = 48 variations due to rotations and reflections. [1]

The index for an order 3 cube consists of 4 numbers.
To normalize a magic cube to the standard position, there are 2 rules (actually 4 steps).

  1. Rotate the cube so the smallest corner is in the bottom left front position.
  2. Rotate/reflect as necessary so the 3 adjacent numbers to this corner are in the adjacent x, y, and z cells in increasing order of size.
This variation of the basic cube is simply a roll 90 degrees forward.
What was the face is now
the bottom. What was the back is now the top.

The 4 red numbers in the bottom left of the basic cube are the numbers in the index, written 1, 15, 17, 23.

Note that the center number remains constant (for odd orders) when the cube is rotated or reflected.

For all practical purposes, a cube is just as magic if it is a variation, rather then the basic cube. The value of basic position only becomes important when you wish to count or list the different cubes of a particular order.

Four numbers are required to define any of the 4 basic cubes of order 3. In fact, partly because order 3 is associated, it is possible to reconstruct the entire cube, if given these 4 initial numbers!
As the order becomes larger, more cell values will have to be included in the index string. However, no one yet has determined how many basic cubes there are even for order 4, so developing an index for higher orders has not yet become a necessity.

[1] John R. Hendricks, Inlaid Magic Squares and Cubes, 2nd edition, self-published, 2000, 0-9684700-3-3, p. 134-136


This diagram illustrates the coordinates of some of the cells in an order 3 cube array.
The coordinates serve as place names for specifying individual cells.
Examples are shown of lines that must sum correctly, and an example diagonal, which need not sum correctly.

Note that for rows, columns and pillars, 1 coordinate varies as you move along the line.
For diagonals, 2 coordinates vary, and for triagonals, 3 coordinates vary as you move along the line.

The underlined coordinates (in the lower left corner) are the locations for the 4 numbers of the index string.

One method of constructing magic cubes is to use coordinates in conjunction with modular equations.
This is a favored method of John R. Hendricks and is explained in many of his books. [1]
It uses modular equations to form the m digits of a base m number for each cell. Each number is then converted to decimal and 1 is added to get the final value for each cell.

These 3 modular equations will give an order 3 cube.
D2 ≡ x + y + 2z (mod 3)
D1 ≡ x + y + z + 1 (mod 3)
D0 ≡ x + 2y + z (mod 3)
These 3 modular equations will give an order 5 cube.
D2 ≡ x + y + 2z (mod 5)
D1 ≡ x + 4y + 2z + 1 (mod 5)
D0 ≡ 4x +4y + 2z + 1 (mod 5)

(Your browser may show a ? after the D2, D1, D0. If so, the symbol should be that used for congruent equations.)

[1] John R. Hendricks, Magic Squares to Tesseracts by Computer, self-published, 1998, 0-9684700-0-9


Species is a consideration of how even and odd numbers are placed in order 3 normal magic hypercubes.
There is only 1 order 3 basic magic square, and so only 1 species, with the even numbers appearing at the 4 corners.

There are 4 basic order 3 magic cubes, but again there is only 1 species, because the magic cube must have all even numbers on 2 edges of 3 faces. Or just remember that 2 outside parallel faces (planes) each have 5 even numbers on 2 edges. The central parallel plane has the remaining 3 even numbers on one of its diagonals.
Or still another way to look at it. Each of the six faces has 1 odd number and 3 even numbers.

Species 1 of 1 for magic square and cube

However, when we look at the 58 tesseracts (4-D hypercubes) we find that there are 3 different ways the even numbers are arranged. The example shown here, which John Hendricks has labeled species #1, appears in only 2 tesseracts. Species #2 is found in 24 tesseracts, with the remaining 32 tesseracts having species #3 .

No one has determined how many species there are for any of the order 4 hypercubes. A quick scan of order 4 magic squares seems to indicate that there are always 2 odd and 2 even numbers in the corners, making just two species; O, E, O, E and O, O, E, E.

[1] John R. Hendricks, Species of Third-Order Magic Squares and Cubes, JRM 6:3,1973, pp190-192.
[2] H.D. Heinz and J.R. Hendricks, Magic Square Lexicon: Illustrated, Self-published, 2000, 0-9687985-0-0

This page was originally posted December 2002
It was last updated December 03, 2009
Harvey Heinz
Copyright © 1998-2009 by Harvey D. Heinz