Magic Square A magic square is a square matrix of distinct numbers in which the sum of the numbers in each row, column and diagonal is equal.