*Question by lowbrasskicksass*: How do you complete a magic square with unknowns in it with matrices and linear algebra?

I have a magic matrix with 6 unknowns:

1 a -2

b 4 c

d e f

How would you get/What would the matrix be that represents this that could be row-reduced to solve?

Thank you for any help!

**Best answer:**

*Answer by Piyush*

notice that if a matrix M is a magic square, then xM+y will also be a magic square (for a and be bee two real numbers).

the 3×3 magic square is

4 9 2

3 5 7

8 1 6

with all it’s possible permutations (actually 8, 4 if you rotate the square by 90 degrees, and if you flip the matrix, 4 more)

in all these, 5 will always be in middle position, so 4x+y=5

similarly try making equations (x+y= sth and -2x+y= sth) for all these 8 cases, and the one which gives you a unique value of x and y is solution

I hope it helps

**Add your own answer in the comments!**