ISSN (Online): 2321-3418
server-injected
Engineering and Computer Science
Open Access

Development and Validation of a Matrix Diagonal Summation Method for Odd-Order Arithmetic Square Matrices

DOI: 10.18535/ijsrm/v14i09.ec06· Pages: 3111-3122· Vol. 14, No. 09, (2026)· Published: September 14, 2026
PDFAuto
Views: 26 PDF downloads: 16

Abstract

Numeric puzzles and structured matrices have become increasingly popular in the fields of recreational mathematics, educational studies, computer science, and others because of the possibility of enhancing logical reasoning and problem solving. This paper explores the recent trends in solving numerical puzzles creatively and their possible uses in different fields. Special attention will be paid to the Matrix Diagonal Summation Method (MDSM), with the help of which solution matrices possessing patterns based on arithmetic series could be created and analyzed. The paper also explores the possibility of using arithmetic series manipulation to form structured numerical relations in question and solution matrices. From the literature review presented in the paper, one can conclude that numerical matrices can be used in recreational mathematics, brain teasers and educational devices, coding and error detection, music composing, ancient cultures' traditions and symbolism, statistics, games and gambling, Sudokus and other puzzles, cryptography, art and design, and number theory. All these applications prove the wider use of numerical puzzles for mathematical reasoning development, algorithms creation, error-detection mechanism improvement, and structured problems solving. The main purpose of this study is to create an odd-order numerical square matrix where the elements will be positioned in such a way that the sums of all rows, columns, and principal diagonals will be equal. Also, this study analyzes the mathematical relation between common summations of rows, columns, and principal diagonals and the sums of two principal diagonals of the initial matrix. The relation between the sums of elements on diagonals and sums of rows and columns is also analyzed. A computer algorithm will be developed to calculate and validate identified numerical relations. Despite the fact that mathematical theories about magic matrices are well researched, their application and interpretation may be complicated for people who do not have deep knowledge in mathematics. Therefore, the Design Science Research Methodology, an algorithm development, and mathematical validation methodology are selected for this research. With its help, an approach will be developed with the help of a computer, making the mathematical process clearer and more understandable.

Keywords

Innovative approaches Diagonal Summation Method Cross-domain applications Matrix patterns Odd-order square matrix Computer-based algorithm Design Science Research

Introduction

The variety of computer games, numerical puzzles, and mathematical problem-solving activities available worldwide is extensive. In this regard, arithmetic numerical puzzles using the matrix framework offer an engaging domain for examining patterns in numbers, arithmetic relations, logic, and computation. In this study, the construction of square matrices of odd order based on the arithmetic sequence is studied. The goal of the study is to place the terms of an arithmetic sequence in a matrix of odd order such that the sum of terms in all rows, columns, and two diagonals becomes equal. Hence, the study will examine how this sum can be obtained and how the necessary arrangement can be achieved.

There are different numerical methods that could be used for creating square matrices. One of the methods includes creation of an arithmetic progression and putting its elements into the square matrix, whereas another method would include using randomly created numerical numbers and their arrangement. The current research focuses only on the creation of the matrices based on the arithmetic progressions where the numbers are defined by a first element, common difference, and number of elements needed. Particular attention is given to odd-order matrices such as (3 x 3), (5x 5), (7 x 7), (9 x 9), and (11 x 11) …etc.

While the mathematical concepts involved in creating matrices of this kind could be represented by mathematical equations and instructions for building the matrix, people who do not have an advanced knowledge of mathematics might find it complicated to comprehend and use the methods. Creating a matrix manually with many elements while at the same time ensuring that all rows, columns, and diagonals sum up to the same number could also be increasingly difficult as the size of the matrix becomes larger. Thus, a computer-based solution would help in automating the entire process of creating the matrix.

In light of the aforementioned problem, the present research is formulated according to the following research question:

What would be the necessary common summation value of arranging the elements of an arithmetic sequence in an odd-order square matrix such that the summations of all rows, columns, and diagonals become equal, and how will it be computed through computational means for the convenience of users lacking advanced mathematical background?

In order to solve the research question stated above, the algorithm design and mathematical verification approach, supplemented with computer programming implementation and experimentation, is used. Firstly, the mathematical relationship between the order of the matrix (n), first element (a), common difference (d), and resulting summations of rows, columns, and diagonals is studied. Based on the discovered relationship, the algorithm for arranging matrix is designed, and its correctness is proved theoretically using mathematical indication and numerically. Finally, the designed algorithm is computer-implemented using Python programming language allowing user to enter the necessary values and automatically compute diagonal value. This implementation is experimented for various odd-order matrix sizes and various arithmetic sequences to prove its correctness and consistency.

Literature Review

Magic squares can be defined as some of the earliest and extensively studied puzzles in mathematics involving numbers. Magic square of order (n) is a matrix which has a size of (n x n) with numbers placed within such that the sum of all the elements in each row, column, and the two diagonals is always the same. This common total is known as the magic constant or magic sum. In case of a normal magic square which consists of integers from (1) to (n2), the magic constant is

M= n( n 2 +1) 2

Thus, in the construction of a magic square, it entails finding the arrangements of numbers that satisfy certain sum conditions. Current mathematical writings have considered magic squares as matrices so as to study them using algebraic concepts, matrix theories, combinatorial studies, and computations (Loly et al., 2009; Pamplona et al., 2026). History of magic squares spans many centuries and different cultures. Early examples are commonly associated with the Chinese Lo Shu arrangement, while subsequent developments occurred in India, the Islamic world, and Europe. Over time, magic squares moved beyond their historical and symbolic associations and became an important subject within recreational mathematics and mathematical problem solving. Sesiano (2019) documents the historical development and construction of magic squares from ancient times to approximately 1600, demonstrating that methods of arranging numbers into structures with identical row, column, and diagonal totals have been investigated for centuries. Block and Tavares (2009) similarly describe the historical, recreational, mathematical, artistic, and practical dimensions of magic squares.

The basic mathematics behind magic squares consists of the equality between sums of their rows, columns, and principal diagonals. Nevertheless, research revealed that magic squares had much deeper mathematical properties. Loly et al. (2009), for example, studied magic squares using linear algebra approach, analyzing the eigenvalues, singularity, characteristic polynomials, and parametrizations of these squares. In this particular research, they differentiated between semimagic matrices which have equal sums of rows and columns and complete magic squares whose two principal diagonals also comply with the sum property. It proves that the relationship between sums of rows, columns, and diagonals may be analyzed not only using simple arithmetic but also with the use of more sophisticated matrix theories. The arithmetic structure behind normal magic squares is of particular interest. As the integers from (1) to (n2) form an arithmetic progression, their sum can be written as

1+2+3+……..+n2=n(n2+1)/2.

Since this set of numbers is distributed evenly between (n) rows of the equal sum, their total sum divided by (n) will yield magic constant

M= n( n 2 +1) 2

It provides an illustration of the direct link between the sum of arithmetic progression and magic squares construction. Thus, the rearrangement of arithmetic progressions can become a method of mathematical support for new number arrangement principles. Generalized magic squares such as semimagic squares, pandiagonal squares, bimagic squares, antimagic squares, magic cubes, etc., have been studied as well. It proves that the principles of equal or systematically related sums can be used not only for the rows, columns, and diagonals of magic squares. The extension of these possibilities has motivated scientists to develop new construction methods, algebraic structures, transformations, and computing techniques.

However, a significant part of literature has been devoted to the issue of constructing magic squares. In general, traditional methods may vary depending on the type of the order of a square (odd, singly even, and doubly even). For example, probably, one of the most common procedures for constructing odd order magic squares is the Siamese or de la Loubère method. It allows filling in cells of a matrix systematically with consecutive numbers using some rules in case of reaching its boundaries or preoccupied cell. Modern research in the field still uses this method to construct odd order magic squares (Pamplona et al., 2026).

In turn, Ku and Chen (1986) created systematic approaches to constructing higher order magic squares on the basis of expanding lower order basic squares. With such an approach, the authors managed to prove that magic square constructions can be based on combining and placing of smaller matrices, which allowed moving magic-square construction from the sphere of puzzle-solving to systematic procedures able to produce squares of different orders.

Further Kim and Yoo (2008) designed an algorithm that relies on the product operation over integer matrices. Such an approach provided an opportunity to construct an infinite family of magic squares and prove that magic-square construction can be mathematically formalized.

Moreover, Krishnappa et al. (2010) studied computational construction methods of magic squares and offered the corresponding algorithms to generate magic squares of different orders. The authors noted that different procedures are necessary to construct magic squares of different order matrices, including algorithmic and divide-and-conquer procedures. This research proves the growing link between the magic-square theory and problem solving with the help of computers.

Another step of developing computational methods of construction of magic squares was done by Duan et al. (2015) who suggested new algorithms for constructing even order magic squares. Besides, in addition to proving the correctness of the algorithms and considering the computational complexity of the procedure, the researchers showed the potential applications of magic-square algorithms in the spheres of secure communication, electronic account management, and identity authentication.

Pamplona et al. (2026), finally, modeled magic-square construction as an integer constraint satisfaction problem and offered a faster construction approach for odd, singly even, and doubly even orders. In addition, the research results proved that it is possible to construct very large magic squares computationally, with the offered method allowing to construct squares of up to 70,000 orders.

Not only are magic squares theoretically interesting, but they have been recognized as useful devices in education. The rules of magic squares are rather easy, and thus learners may begin with simple operations and progress towards more complicated ones related to algebra, number sequences, symmetry, matrix operations, logic, and mathematical proofs. As claimed by Roberts (2007), magic squares are good enough for being used as learning devices from elementary level, while providing problems that can challenge advanced mathematics learners. Therefore, magic-square problems can serve as a link between simple arithmetic and advanced mathematical reasoning. The same can be claimed about Latin-square problems as shown by Semanišinová and Trenkler (2007). De Bernardinis (2016) also identified magic squares as productive learning activities within mathematics education, particularly because game-like mathematical activities can increase learner participation while simultaneously introducing underlying mathematical principles. Recent research has continued this educational perspective. Applebaum and Freiman (2025) examined magic-square puzzles as a means of developing mathematical creativity among pre-service teachers. According to them, these techniques using magic squares will help the learners develop trial and error methods, pattern recognition skills, reflection, teamwork, and improve the strategies to solve problems. Through these experiments, we learn one of the most significant features of magic squares – while the mathematics behind these structures is very complicated, the visual grid form makes them easily understandable.

Utility of magic squares is not limited to the teaching of mathematics only. The uses of magic squares in computer sciences, cryptography, coding, security, statistics, games, artistic designs, and others have been reported in earlier research. For instance, Block and Tavares (2009) mentioned the linkages between magic squares and mathematics, Sudoku, arts, design, music, statistics, and other applications. Cryptography is one of the important computation uses of magic squares. Numeric patterns created through magic-square algorithms may be used to reorganise, encode, or transform information. Duan et al. (2015) showed that algorithms of magic-square generation may be used to facilitate secure communication and authentication of multi-user electronic account systems. Rani and Mishra (2022) also used the generation of magic squares to encrypt and decrypt information and illustrated that magic squares can act as substitution-based structures for protection of alphabets, numeric values, and symbols. These examples illustrate the computational potential of structured matrices. A magic matrix can not only be considered as a game but also can be used as an approach for organising, transforming, verifying, and validating numeric information. Hence, computerised algorithms of magic matrix creation and analysis may prove useful in both mathematical and computation studies.

In spite of the presence of multiple ways of constructing the magic square, the increasing complexity of mathematical expressions may become a problem for people who do not have a high level of mathematical education. Typical research focuses on such aspects as proving the existence, algebraic properties of magic squares, construction of certain types of magic squares, and improvements in algorithms. All these aspects are mathematically valuable, but the procedures themselves become hard for a non-specialist to understand. From the point of view of educational research, visualization, experiment, pattern discovery and puzzle-like learning help in comprehending mathematical notions (Applebaum & Freiman, 2025; Roberts, 2007). That way, using computational approaches becomes a chance to unite mathematical correctness and accessibility. In this case, it is possible not to demand from the user the derivation of each mathematical expression, but to let the computer produce a matrix, calculate the sum in its rows, columns and diagonals and compare the obtained sums. Such approach becomes especially valuable if the targeted audience includes non-mathematicians. Using computers to explore numerically the mathematical expressions becomes a way of transforming them into visible patterns.

Methodology

The current study follows the approach of developing an algorithm and validating the methodology mathematically, including the creation and application of a computer program. The purpose of the research is to identify a common value for constructing square matrices of odd-order based on a sequence of numbers, such that the sums of all rows, columns, and the principal diagonals are equal. Firstly, the mathematical properties of square matrices built on arithmetic sequences would be considered taking into account the matrix order n, the first number a, and the common difference d. Then, a systematic Diagonal Summation Method would be created following certain rules depending on the above characteristics. The correctness of the algorithm would be confirmed by means of mathematical proof and verification when the row sums, column sums, and the two principal diagonals sums will be proved to be equal to the expected common value. Having determined the mathematical base, the algorithm is to be implemented using the Python programming language where the user will be able to input the required values of n, a, and d, and thus, construct the matrix, arrange the elements according to the proposed algorithm, and perform all necessary computations of the sums. Then, the developed computer program will be tested with the help of different odd-order square matrices, including (3x3), (5x5), (7x7), (9x9), and (11x11) and different arithmetic sequences. Finally, the computation effectiveness of the algorithm would be assessed depending on the size of matrices.

The research follows the Design Science Research Methodology (DSRM) approach to methodology as the entire research is essentially concerned with designing, developing, implementing, and validating the solution to build odd-order Matrix Number Puzzles using arithmetic sequences. The primary research artifact involves the development of a mathematical construction process as well as an algorithm that would enable the placement of the elements of an arithmetic sequence into an odd-order square matrix so that the summation of each row, each column, and both diagonals becomes the same common summation number. Consequently, the methodology is a combination of mathematical modeling, algorithm development, software implementation, mathematical validation, and computational validation in line with the overall DSRM methodology.

Results and Discussion

Consider various odd-order square matrices, such as (3×3), (5×5), (7×7), (9×9), (11×11), and so on. Then, select any arithmetic sequence, such as 1,2,3,4,5, 6, 7, … or 5,10,15, 20, …, or 10, 15, 20, 25,30, ..etc. and arrange its elements sequentially in a suitable Odd-order square matrix, such as (3×3), (5x5)…….,etc.

  • (3x3) odd-order square matrices

Three arithmetic sequences are arranged in the following (3x3) odd-order square matrices, denoted as (3x3) Matrix A, (3x3) Matrix B, and (3x3) Matrix C [Figure 1].

Figure 1
Figure 1 (3×3) Matrix Constructed with Arithmetic Sequences and Elements Arranged in Sequential Order

The next step is to calculate the sums of the two principal diagonals of each matrix [Figure 1].

(3x3) Matrix A: The sum of the diagonal elements from the top-left to the bottom-right (TLBR) is 1+5+9=15, while the sum of the diagonal elements from the top-right to the bottom-left (TRBL) is 3+5+7=15.

(3x3) Matrix B: The sum of the diagonal elements from the top-left to the bottom-right (TLBR) is 5+25+45=75, while the sum of the diagonal elements from the top-right to the bottom-left (TRBL) is 15+25+35=75.

(3x3) Matrix C: The sum of the diagonal elements from the TLBR is 20+60+100=180, while the sum of the diagonal elements from the TRBL is 40+60+80=180.

Based on the above observations, it can be concluded that, for the considered (3x3) odd-order square matrices constructed from arithmetic sequences, the sums of the two principal diagonals are equal. Hence, based on the summation of both diagonals, the relationship can be expressed as:

For (3x3) Matrix top-left to the bottom-right (TLBR)= top-right to the bottom-left (TRBL)

TLBR=TRBL

After that, the elements of the arithmetic sequence are rearranged in an arbitrary order within the odd-order square matrices, denoted as (3x3) Matrix A, (3x3) Matrix B, and (3x3) Matrix C as illustrated below. Based on this arrangement, the (3×3) odd-order Matrix Number Puzzle can be developed as follows [

Figure 2].

Question: Arrange the following numbers in the (3x3) matrices A, B, and C so that the sums of all rows, columns, and principal diagonals are equal to 15, 75, and 180 respectively.

Figure 2
Figure 2 The elements are randomly arranged in a odd-order (3×3) square matrix

The solutions to the above matrix puzzles are presented in the following table [Figure 3]. However, the present study does not provide a detailed explanation of the specific arrangement procedure used to position the numerical elements so that the sums of all rows, columns, and principal diagonals are equal to the required target value. The development and formalization of such a systematic arrangement method are beyond the scope of the current research and will be investigated in future work. In addition, the proposed solution method will primarily be designed to support non-mathematicians, enabling them to solve and understand matrix number puzzles without requiring advanced mathematical knowledge.

Answer: The answer to the above question is given in the follows (3x3) matrices A, B, and C which the sums of all rows, columns, and principal diagonals are equal to 15, 75, and 180 respectively [Figure 3].

Figure 3
Figure 3 (3x3) matrices are arranged so that the sums of all rows, columns, and diagonals are equal.

(5x5) odd-order square matrices

Three arithmetic sequences are arranged in the following (5x5) odd-order square matrices, denoted as (5x5) Matrix A, (5x5) Matrix B, and (5x5) Matrix C [Figure 4].

Figure 4
Figure 4 Odd-Order (5x5) Square Matrix Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order

The next step is to calculate the sums of the two principal diagonals of each matrix.

(5x5) Matrix A: The sum of the diagonal elements from the TLBR is 1+7+13+19+25=65, while the sum of the diagonal elements from the TRBL is 5+9+13+17+21=65 [Figure 4].

(5x5) Matrix B: The sum of the diagonal elements from the TLBR is 5+35+65+100+130=335, while the sum of the diagonal elements from the TRBL is 25+45+65+90+110=335 [Figure 4].

(5x5) Matrix C: The sum of the diagonal elements from the TLBR is 20+80+140+200+260=660, while the sum of the diagonal elements from the TRBL is 60+100+140+180+220=660 [Figure 4].

Based on the above observations, it can be concluded that, for the considered (5x5) odd-order square matrices constructed from arithmetic sequences, the sums of the two principal diagonals are equal. Hence, based on the summation of both diagonals, the relationship can be expressed as:

For (5x5) matrix top-left to the bottom-right (TLBR)= top-right to the bottom-left (TRBL)

TLBR=TRBL

After that, the elements of the arithmetic sequence are rearranged in an arbitrary order within the odd-order square matrices, denoted as (5x5) Matrix A, (5x5) Matrix B, and (5x5) Matrix C, as illustrated below. Based on this arrangement, the 5x5 odd-order Matrix Number Puzzle can be developed as follows [Figure 5].

Question: Arrange the following numbers in the (5x5) matrices A, B, and C so that the sums of all rows, columns, and principal diagonals are equal to 65, 335, and 660 respectively [Figure 5].

Figure 5
Figure 5 The elements are randomly arranged in a odd-order (5×5) square matrix

The solutions to the above matrix puzzles are presented in the following table [Figure 6]. However, the present study does not provide a detailed explanation of the specific arrangement procedure used to position the numerical elements so that the sums of all rows, columns, and principal diagonals are equal to the required target value.

Figure 6
Figure 6 The elements of the (5x5) matrices are arranged so that the sums of all rows, columns, and diagonals are equal

(7x7) odd-order square matrices

Three arithmetic sequences are arranged in the following (7x7) odd-order square matrices, denoted as (7x7) Matrix A, (7x7) Matrix B, and (7x7) Matrix C. The next step is to calculate the sums of the two principal diagonals of each (7x7) square matrix.

(7x7) Matrix A: The sum of the diagonal elements from the TLBR is 1+9+17+25+33+41+49=175, while the sum of the diagonal elements from the TRBL is 7+13+19+25+31+37+43=175 [Figure 7].

Figure 7
Figure 7 Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order in (7x7) Matrix A.

(7x7) Matrix B: The sum of the diagonal elements from the TLBR is 0+16+32+48+64+80+96=336, while the sum of the diagonal elements from the TRBL is 12+24+36+48+60+72+84=336 [Figure 8].

Figure 8
Figure 8 Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order in (7x7) Matrix B.

(7x7) Matrix C: The sum of the diagonal elements from the TLBR is 0+24+48+72+96+120+144=504, while the sum of the diagonal elements from the TRBL is 18+36+54+72+90+108+126=504 [Figure 9].

Figure 9
Figure 9 Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order in (7x7) Matrix C.

Based on the above observations, it can be concluded that, for the considered (7x7) odd-order square matrices constructed from arithmetic sequences, the sums of the two principal diagonals are equal. Hence, based on the summation of both diagonals, the relationship can be expressed as:

For (7 x 7) matrix top-left to the bottom-right (TLBR)= top-right to the bottom-left (TRBL)

TLBR=TRBL

After that, the elements of the arithmetic sequence are rearranged in an arbitrary order within the odd-order square matrices, denoted as (7x7) Matrix A, (7x7) Matrix B, and (7x7) Matrix C, as illustrated below [Figure 10,11,12]. Based on this arrangement, the (7×7) odd-order Matrix Number Puzzle can be developed as follows.

Question: Arrange the following numbers in the (7x7) matrices A, B, and C so that the sums of all rows, columns, and principal diagonals are equal to 175, 336, and 504 respectively[Figure 10,11,12].

Figure 10
Figure 10 The elements are randomly arranged in a (7×7) odd-order square matrix A
Figure 11
Figure 11 The elements are randomly arranged in a (7×7) odd-order square matrix B
Figure 12
Figure 12 The elements are randomly arranged in a (7×7) odd-order square matrix C

Answer: The answer to the above question is given in the follows (7x7) matrices A, B, and C which the sums of all rows, columns, and principal diagonals are equal to 175, 336, and 504 respectively [Figure 13].

Figure 13
Figure 13 (7x7) matrices are arranged so that the sums of all rows, columns, and diagonals are equal

(9x9) odd-order square matrices

The next step is to calculate the sums of the two principal diagonals for a selected (9×9) odd-order square matrix. For this stage of the study, only two representative arithmetic sequence is considered to demonstrate and verify the proposed diagonal summation relationship.

(9x9) Matrix A: The sum of the diagonal elements from the TLBR is 1+11+21+31+41+51+61+71+81=369, while the sum of the diagonal elements from the TRBL is 9+17+25+33+41+49+57+65+73=369 [Figure 14].

Figure 14
Figure 14 Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order in (9x9) Matrix A.

(9x9) Matrix B: The sum of the diagonal elements from the TLBR is 0+20+40+60+80+100+120+140+160=720, while the sum of the diagonal elements from the TRBL is 16+32+48+64+80+96+112+128+144=720

Figure 15
Figure 15 Constructed from an Arithmetic Sequence with Elements Arranged in Sequential Order in (9x9) Matrix B.

Based on the above observations, it can be concluded that, for the considered (9x9) odd-order square matrices constructed from arithmetic sequences, the sums of the two principal diagonals are equal. Hence, the relationship can be expressed as:

For (9x9) matrix top-left to the bottom-right (TLBR)= top-right to the bottom-left (TRBL)

TLBR=TRBL

After that, the elements of the arithmetic sequence are rearranged in an arbitrary order within the odd-order square matrices, denoted as (9x9) Matrix A, and (9x9) Matrix B, as illustrated below. Puzzles questions are then created for each matrix.

Question: arrange the numbers in the (9x9) Matrix A so that the sums of all rows, columns, and principal diagonals are equal to 369 [Figure 16].

Figure 16
Figure 16 The elements are randomly arranged in an odd-order (9x9) square matrix A

Question: arrange the numbers in the (9x9) Matrix B so that the sums of all rows, columns, and principal diagonals are equal to 720 [Figure 17].

Figure 17
Figure 17 The elements are randomly arranged in an odd-order (9x9) square matrix B

Answer: The answer to the above questions is given in the follows (9x9) matrices A, and B which he sums of all rows, columns, and principal diagonals are equal to 369, and 720 respectively[Figure 18] [Figure 19].

Figure 18
Figure 18 The elements of the (9x9) matrix A, arranged so that the sums of all rows, columns, and diagonals are equal.
Figure 19
Figure 19 The elements of the (9x9) matrix B, arranged so that the sums of all rows, columns, and diagonals are equal

(11x11) odd-order square matrices

The next step is to calculate the sums of the two principal diagonals for a selected (11×11) odd-order square matrix. For this stage of the study, only two representative arithmetic sequence is considered to demonstrate and verify the proposed diagonal summation relationship.

(11x11) Matrix A: The sum of the diagonal elements from the TLBR is 1+13+25+37+49+61+73+85+97+109+121=671, while the sum of the diagonal elements from the TRBL is 11+21+31+41+51+61+71+81+91+101+111=671 [Figure 20].

Figure 20
Figure 20 Odd-Order (11x11) Square Matrix A Constructed with Arithmetic Sequence and Elements Arranged in Sequential Order.

(11x11) Matrix B: The sum of the diagonal elements from the TLBR is 0+24+48+72+96+120+144+168+192+216+240=1320, while the sum of the diagonal elements from the TRBL is 20+40+60+80+100+120+140+160+180+200+220=1320 [Figure 21].

Figure 21
Figure 21 Odd-Order (11x11) Square Matrix B Constructed with Arithmetic Sequence and Elements Arranged in Sequential Order.

Based on the above observations, it can be concluded that, for the considered (11x11) odd-order square matrices constructed from arithmetic sequences, the sums of the two principal diagonals are equal. Hence, the relationship can be expressed as:

For (11x11) matrix top-left to the bottom-right (TLBR)= top-right to the bottom-left (TRBL)

TLBR=TRBL

After that, the elements of the arithmetic sequence are rearranged in an arbitrary order within the odd-order square matrices, denoted as (11x11) Matrix A, and (11x11) Matrix B, as illustrated below. Puzzles questions are then created for each matrix.

Question: arrange the numbers in the (11x11) Matrix A so that the sums of all rows, columns, and principal diagonals are equal to 671 [Figure 22].

Figure 22
Figure 22 The elements are randomly arranged in an odd-order square (11x11) matrix A

Question: arrange the numbers in the (11x11) Matrix B so that the sums of all rows, columns, and principal diagonals are equal to 1320 [Figure 23].

Figure 23
Figure 23 The elements are randomly arranged in an odd-order (11x11) square matrix B

Answer: The answer to the above questions is given in the follows (11x11) matrices A, and B which he sums of all rows, columns, and principal diagonals are equal to 671 [Figure 24], and 1320 [Figure 25] respectively.

Figure 24
Figure 24 The elements of the (11x11) matrix A arranged so that the sums of all rows, columns, and diagonals are equal.
Figure 25
Figure 25 The elements of the (11x11) matrix B arranged so that the sums of all rows, columns, and diagonals are equal

Although this study demonstrates the proposed method using selected arithmetic sequences for (3×3), (5×5), (7×7), (9×9), and (11×11) odd-order square matrices, the underlying mathematical relationship is not limited to these specific examples. The above-developed technique is suitable for any arithmetic progression as long as the matrix is formed in accordance with the established rules for odd-order square matrices.

In the case of odd-order square matrices, which have been studied here (such as (3×3), (5×5), (7×7), (9×9), and (11×11), the sums of the two major diagonals are identical and obey the same mathematical pattern.

The relationship is demonstrated using selected odd-order square matrices such as (3x3), (5x5), (7x7), (9x9), and (11x11). Therefore, testing individual matrices establish that the formula is valid for all odd orders square matrices. Since an odd matrix order can be represented as

n=2k+1,mathematical induction can be applied by first verifying the formula for a base case and then demonstrating that, if the relationship holds for an arbitrary odd order (2k+1), it also holds for the next odd order (2k+3). In this way, the proposed relationship can be proved using the principle of mathematical induction. Therefore, based on mathematical induction, the proposed rule can be established for all odd-order (n x n) square matrices. Computation experiments using Python can also validate the formula for chosen sizes of matrices and for arithmetic sequences. Consequently, the methodological approach to verifying the applicability of the formula consists in the combination of mathematical induction and computation

It is possible to use the mathematical induction technique as theoretical backing for the above-diagonal sum relationship of odd-order square matrices. The common sum of the diagonals in the case of an odd-order (n x n) square matrix formed using arithmetic progression is given as

D=n[a+ n 2 -1 2 d]
  • D = sum of either principal diagonal

  • n = order of the square matrix

  • a = first term of the arithmetic sequence

  • d = common difference

The relevant python program to find the summation of TLBR or TRBL of the odd-order n×n square matrix

# Read values from the keyboard

import numpy as np

n = int(input("Insert the value for order of the square matrix (odd number): "))

a = int(input("Insert the first value of the arithmetic sequence (a): "))

d = int(input("Insert the common difference (d): "))

# Check whether n is odd number

if n % 2 == 0:

print("Please enter an odd value for n.")

else:

# Generate arithmetic sequence using following

numbers = [a + i * d for i in range(n * n)]

# Create the square matrix

matrix = np.array(numbers).reshape(n, n)

print("\nGenerated Matrix:")

print(matrix)

# Calculate main diagonal summation ingenerate matrix

diagonal_1 = sum(matrix[i][i] for i in range(n))

# Calculate opposite diagonal summation

diagonal_2 = sum(matrix[i][n - 1 - i] for i in range(n))

# Calculate diagonal sum using the formula using input value

formula_sum = n * (a + ((n**2 - 1) / 2) * d)

print("\nTop-left to bottom-right diagonal sum =", diagonal_1)

print("Top-right to bottom-left diagonal sum =", diagonal_2)

print("Diagonal sum using formula =", formula_sum)

# Verify the result all diagonal value

if diagonal_1 == diagonal_2 == formula_sum:

print("\nBoth diagonal sums are equal.")

print("The formula is verified, and the matrix can be arranged so that the sums of all rows, columns, and diagonals are equal:", formula_sum)

else:

print("\nThe formula is not verified.")

The output of the Python program is presented below as evidence of the computational verification of the proposed diagonal summation formula.

Insert the value for order of the square matrix (odd number): 7

Insert the first value of the arithmetic sequence (a): 2

Insert the common difference (d): 2

Generated Matrix:

[ 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 ]

Top-left to bottom-right diagonal sum = 350

Top-right to bottom-left diagonal sum = 350

Diagonal sum using formula = 350.0

Both TLBR and TRBL are equal.

The formula is verified, and the matrix can be arranged so that the sums of all rows, columns, and diagonals are equal: 350.

Research Limitation

This study has several limitations that should be considered when interpreting its findings. First, the research is limited to odd-order (n x n) square matrices constructed from arithmetic sequences. Even-order square matrices and other types of numerical patterns (Geomatical sequences) are outside the scope of the present study. A further limitation is that the development and formalization of a systematic arrangement method for positioning the numerical elements so that all row, column, and principal diagonal sums are equal are not addressed in detail within the current research. This will be explored further in future research. Also, even though the proposed solution approach is designed mainly to assist people who do not have any mathematics background solve Matrix Number Puzzles without the need for complex mathematical knowledge.

Conclusion

The study examined the mathematically significant relations of odd-order square matrices formed by arithmetic sequences as well as their use in Matrix Number Puzzles. Specifically, the study emphasized the discovery of the summing up value needed for arranging the elements of an arithmetic sequence such that the summing up of the rows, columns, and the two diagonals would become equal in value. The empirical study of (3x3), (5x5), (7x7), (9x9), and (11x11) sequential arithmetic matrices proved to have a mathematically significant relation between the two principal diagonals. As seen in all studied cases, the TLBR is equal in sum to the TRBL. Thus, for the arithmetic matrices under investigation, the relation may be presented as

TLBR=TRBL

The common diagonal summation can be determined using

D=n[a+ n 2 -1 2 d]

where (n) represents the order of the square matrix, (a) represents the first term of the arithmetic sequence, and (d) represents its common difference. After obtaining the value of this single common summation value, it becomes the fundamental target value in creating the odd-order Matrix Number Puzzle. The elements of the matrix should be arranged such that the summation of every row, every column, and each principal diagonal of the matrix should have the same common value. Hence, it takes only one target summation value to facilitate the construction of an odd-order (n x n) squire matrix. Any other summation value will not meet the required conditions using the same matrix elements since the common sum of each row, column, and diagonal is unique to the sum of the elements of the matrix and the order of the matrix.

The study has further formulated a computational procedure based on Python that receives the values of (n), (a), and (d), produces the required arithmetic matrix, computes the two principal diagonal sums and confirms the theoretical result.

In summary, the study illustrates a systematic relationship between arithmetic sequences, diagonal sums, matrix arrangement, and computational procedures. Future research may be built on the current study by extending the approach to larger even-order matrices, developing a fully automated algorithm for arranging the generated elements in a manner that satisfies the requirements of the Matrix Number Puzzle, analyzing the computational complexity as the matrix order increases, and developing intelligent Matrix Number Puzzle generators.

References

  1. Applebaum, M., & Freiman, V. (2025). Instilling creativity in pre-service teachers through investigation of mathematical puzzles: Case of magic squares. Mathematics Education Research and Practice, 28(3), 263–297. DOI ↗ Google Scholar ↗
  2. Block, S. S., & Tavares, S. A. (2009). Before Sudoku: The world of magic squares. Oxford University Press. DOI ↗ Google Scholar ↗
  3. De Bernardinis, E. (2016). Magic squares in mathematics education. Journal of Interdisciplinary Mathematics, 19(1), 207–213. DOI ↗ Google Scholar ↗
  4. Duan, Z., Liu, J., Li, J., & Tian, C. (2015). Improved even order magic square construction algorithms and their applications in multi-user shared electronic accounts. Theoretical Computer Science, 607, 391–410. DOI ↗ Google Scholar ↗
  5. Kim, Y., & Yoo, J. (2008). An algorithm for constructing magic squares. Discrete Applied Mathematics, 156(14), 2804–2809. DOI ↗ Google Scholar ↗
  6. Krishnappa, H. K., Srinath, N. K., & Ramakanth Kumar, P. (2010). Magic square construction algorithms and their applications. The IUP Journal of Computational Mathematics, 3(3), 34–50. DOI ↗ Google Scholar ↗
  7. Ku, Y. H., & Chen, N.-X. (1986). On systematic procedures for constructing magic squares. Journal of the Franklin Institute, 321(6), 337–350. DOI ↗ Google Scholar ↗
  8. Loly, P., Cameron, I., Trump, W., & Schindel, D. (2009). Magic square spectra. Linear Algebra and Its Applications, 430(10), 2659–2680. DOI ↗ Google Scholar ↗
  9. Pamplona, J. V., Pinheiro, M. E., & Santos, L.-R. (2026). Constructing magic squares: An integer constraint satisfaction problem and a fast approach. Computational and Applied Mathematics, 45, Article 332. DOI ↗ Google Scholar ↗
  10. Rani, N., & Mishra, V. (2022). Application of magic squares in cryptography. In Proceedings of the International Conference on Intelligent Vision and Computing (ICIVC 2021) (pp. 321–329). Springer. DOI ↗ Google Scholar ↗
  11. Roberts, T. (2007). Magic squares: From primary classroom to postgraduate research in ten simple exercises. Australian Primary Mathematics Classroom, 12(4), 10–13. DOI ↗ Google Scholar ↗
  12. Semanišinová, I., & Trenkler, M. (2007). Discovering the magic of magic squares. Mathematics Teacher, 101(1), 32–39. DOI ↗ Google Scholar ↗
  13. Sesiano, J. (2019). Magic squares: Their history and construction from ancient times to AD 1600. Springer. DOI ↗ Google Scholar ↗
Author details
R.M.N.B. Rathnayake
Department of Information Technology, Faculty of Social Sciences and Languages, Sabaragamuwa University of Sri Lank, Sri Lanka
✉ Corresponding Author
👤 View Profile →🔗 Is this you? Claim this publication