# Is there a technique for solving magic square-style puzzle using matrices on pen and paper?

The cells (in the puzzle below) must be filled with integers in {1,2,...,12} and they must all be distinct. The numbers on the outside indicate the sum of the cells. For example, the 1st row's cells sum to 18, and the 2nd column's cells (8,12,11) sum to 31.

My Background: I have my university entrance exam tomorrow (computer sci). This type of question might come up in it. I only have a basic calculator in the test with me. I can solve these types of puzzles given enough time (in like an hour, which might be too long in an exam with lots of questions) using trial and error and some logic. I'm familiar with systems of equations and I know the concept of matrices. I've heard that using linear algebra, these puzzles can be solved on pen and paper more systematically than with trial and error. I'm wondering if I should learn that technique in case this type of puzzle comes up in the test.

Question: Can I learn the linear algebra technique in a few hours, today? Or should I just go with my current technique and practice other topics as well today? I'm asking about the complexity of the technique here.

Puzzle:

• Linear algebra isn't that useful here. This kind of problems are usually designed to be solved by some ad hoc -technique. Mostly because you are to use every integer in the range exactly once. For example here on the 2nd row the three missing numbers must sum up to 21, which is rather high ( average seven). Commented May 26 at 18:10

Linear Algebra is definitely not the way forward here, as has been pointed out in the comments already, for the simple reason that you have $$9$$ unknowns but only $$6$$ simultaneous equations you can write down. Furthermore, these $$6$$ equations are not independent. This means that you would have to resort to trial-and-error to solve the equations you can use.
By far the simplest method is the same as that for Killer Sudoku: fill in the blank squares with all possible candidate numbers and you will see that many possibilities can be discarded quite quickly. This is actually easier than it sounds. For example, you can see that $$1$$ has to be in Column A only, and $$9$$ and $$10$$ cannot be in Row 1 or Column A. Thereafter it’s just a matter of systematically eliminating entries which can’t be in the given location.