4
$\begingroup$

Suppose I have a matrix

$$\begin{pmatrix} * & 3 & 6\\ 5 & * & 5\\ 4 & 7 & * \end{pmatrix}$$

How can I find the three numbers on the main diagonal such that the sum of the numbers on every row and every column is equal (i.e., it's a magic square). Thank you.

  • 0
    There are many "matrix problems". Could you change the title to something more useful, such as "how to make a matrix a magic square"2012-12-22
  • 1
    @palatok This is no magic square. Number 5 is not distinct... `Magic square by definition is an arrangement of distinct numbers (i.e., each number is used once), usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number.`2016-05-04

1 Answers 1

10

Let's say we put in the numbers $a$, $b$, and $c$: $$\begin{pmatrix} a & 3 & 6\\ 5 & b & 5\\ 4 & 7 & c \end{pmatrix}$$ The sums of the rows are $a+9$, $b+10$, and $c+11$. The sums of the columns are the same (indeed, if that were not the case, it'd be impossible to make it into a magic square). Thus, we want the numbers $a$, $b$, and $c$ to satisfy $$a+9=b+10=c+11.$$ Such triples of numbers are precisely those of the form $a=x$, $b=x-1$, and $c=x-2$ for some number $x$. But we also want the diagonals to add up to the same value; thus, we want $$a+b+c=4+b+6$$ $$x+(x-1)+(x-2)=4+(x-1)+6$$ $$3x-3=x+9$$ $$x=6$$ Thus, the unique entries we can put in to make the matrix a magic square are $$\begin{pmatrix} \fbox{6} & 3 & 6\\ 5 & \fbox{5} & 5\\ 4 & 7 & \fbox{4} \end{pmatrix}$$

  • 0
    He had the diagonals as one of the conditions, so you can see for $x$ and then have to check the last diagonal2012-12-22
  • 0
    Well, the question only said "such that the sum of the numbers on every row and every column is equal", but now checking on Wikipedia I see that "magic square" also requires the diagonals to sum to the same value (which I was unaware of). I'll add to my answer.2012-12-22
  • 0
    how to find the x?2012-12-22
  • 0
    sorry i forgot to tell about the diagonals.2012-12-22
  • 0
    @palatok: I've updated my answer.2012-12-22