What is the logic behind filling up a magic square? I have understood the algorithm of filling up a magic square of 3*3 or 5*5. I really do not know how to derive this
2026-03-25 07:40:40.1774424440
Magic square of numbers
408 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in ELEMENTARY-NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- How do I show that if $\boldsymbol{a_1 a_2 a_3\cdots a_n \mid k}$ then each variable divides $\boldsymbol k $?
- Using only the digits 2,3,9, how many six-digit numbers can be formed which are divisible by 6?
- Algebra Proof including relative primes.
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
- algebraic integers of $x^4 -10x^2 +1$
- What exactly is the definition of Carmichael numbers?
- Number of divisors 888,888.
Related Questions in RECREATIONAL-MATHEMATICS
- Good ideas for communicating the joy of mathematics to nine and ten year olds
- Who has built the house of Mason?
- Is there any tri-angle ?
- In what position , the dogs will reside?
- existence of solutions of $a^n+b^n+c^n=6^n$
- Sushi Go! and optimal passing strategy
- Cut the letter $M$ to obtain $9$ single triangles by drawing $3$ straight lines
- Tennis balls problem from John H Conway's "Genius At Play"
- The Heegner Polynomials
- 2018 January Challenge: Prove inequality in geometry problem
Related Questions in MAGIC-SQUARE
- Why is $nM$ equal to $\sum_{i=1}^{n^2}i$?
- Can there be a magic square with equal diagonal sums different from equal row and column sums?
- Magic square variation
- finding sum of entries in magic square directly
- Squaring an $n$ magic square
- Simultaneous Linear Congruences With Two Variables
- Number Theory - Regular Magic Squares (4x4)
- What method can be used to solve a magic square problem without just guessing?
- a special problem about numbers assigned on polygons
- Looks like a magic square, but can't solve it, please help.
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
There are probably many ways of constructing magic squares. The one algorithm that I know of is based on a pair of orthogonal latin squares (aka Graeco-Latin square). IMO here is a slightly clearer description . Books on combinatorics describe their theory. They are (hopefully?) not the only route to magic squares, for example they don't exist for all $n$ (but I would guess that magic squares of all sizes exist).
I describe a construction that works when the size is a prime number $>2$. The same method can be extended to all sizes that are products of powers of primes $>2$, but that would necessitate familiarity with finite fields, and would take a bit longer.
So let $p$ be an odd prime. I begin by constructing two squares that are also orthogonal latin squares. To make the formulas a bit simpler I number them from $0$ to $p-1$. Let us pick two integers $a$ and $b$ such that $0<a<b<p$. In the first square I write in the cell at position $(i,j)$ the remainder of $ai+j$ modulo $p$, in the second I similarly use the formula $bi+j$. For example with $p=7$ and $a=1$, $b=2$ the two squares I get are $$ \begin{array}{|c|c|c|c|c|c|c|} \hline 0&1&2&3&4&5&6\\ \hline 1&2&3&4&5&6&0\\ \hline 2&3&4&5&6&0&1\\ \hline 3&4&5&6&0&1&2\\ \hline 4&5&6&0&1&2&3\\ \hline 5&6&0&1&2&3&4\\ \hline 6&0&1&2&3&4&5\\ \hline \end{array} $$ and $$ \begin{array}{|c|c|c|c|c|c|c|} \hline 0&1&2&3&4&5&6\\ \hline 2&3&4&5&6&0&1\\ \hline 4&5&6&0&1&2&3\\ \hline 6&0&1&2&3&4&5\\ \hline 1&2&3&4&5&6&0\\ \hline 3&4&5&6&0&1&2\\ \hline 5&6&0&1&2&3&4\\ \hline \end{array} $$ Them being latin squares means that each number occurs on each row and column exactly once.
Let's next write the two squares on top of each other. Then each cell will contain two numbers: the first from the table using $a$ and the second from the table using $b$. In our example case the result looks like
$$ \begin{array}{|c|c|c|c|c|c|c|} \hline 00&11&22&33&44&55&66\\ \hline 12&23&34&45&56&60&01\\ \hline 24&35&46&50&61&02&13\\ \hline 36&40&51&62&03&14&25\\ \hline 41&52&63&04&15&26&30\\ \hline 53&64&05&16&20&31&42\\ \hline 65&06&10&21&32&43&54\\ \hline \end{array} $$
The meaning of orthogonality of the two latin squares is that in this combination table all the pairs of $7\times7$ numbers appear exactly once. For example there are seven pairs with the first entry $0$ - one on each row and column, and there are no repetitions among the second entries of those pairs.
In the last step we turn this into a magic square. The idea is simply to replace the pair $(a,b)$ with the sum $pa+b$. Then because on each row and column all the $p$ possibilities for both $a$ and $b$ occur, the row and column sums will all be equal. Furthermore, because all the $(a,b)$ pairs occur exactly once, the sum $pa+b$ takes all the values from $0$ to $p^2-1$ exactly once. All this exactly as we wanted! In our example case we get the following magic square
$$ \begin{array}{|c|c|c|c|c|c|c|} \hline 0&8&16&24&32&40&48\\ \hline 9&17&25&33&41&42&1\\ \hline 18&26&34&35&43&2&10\\ \hline 27&28&36&44&3&11&19\\ \hline 29&37&45&4&12&20&21\\ \hline 38&46&5&13&14&22&30\\ \hline 47&6&7&15&23&31&39\\ \hline \end{array} $$ Here all the rows and columns have sum $168$.
If you want the numbers to be $1,2,\ldots, p^2$ instead of $0,1,2,\ldots, p^2-1$, then you can just increment all the entries of the resulting square by one.
If you want the diagonals to also have the same sums that can be achieved by not using either $1$ or $p-1$ as $a$ or $b$.
If you want more variety you can permute the numbers $0,1,\ldots,p-1$ in one or both of the latin squares any which way you want.