# how to make a matrix a magic square?

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.

-
There are many "matrix problems". Could you change the title to something more useful, such as "how to make a matrix a magic square" – akkkk Dec 22 '12 at 16:45
@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. – BugshotGG May 4 at 8:42

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}$$
He had the diagonals as one of the conditions, so you can see for $x$ and then have to check the last diagonal – Thomas Andrews Dec 22 '12 at 16:52