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.


enter image description here

  • 1
    $\begingroup$ 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). $\endgroup$ Commented May 26 at 18:10

1 Answer 1


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.

I won’t go through the whole process as you say you know how to solve it anyway, but forget about the Linear Algebra approach. A pencil and eraser is all you need.

  • $\begingroup$ 1st column is 8 : only 2 ways to get 8, it is 1+2+5 or 1+3+4 ; last column is 25, it can be 10+9+6 ; no other option ; For row n°2, you need to obtain 21 (reather high), and you cannot have 9 and 10, only one of those 2 numbers. So for example 10+7+4, 10+6+5 or 9+7+5 ; no other option. I think we are very close to the final result. $\endgroup$
    – Lourrran
    Commented May 26 at 21:45
  • $\begingroup$ @Lourrran I don’t think solving it is actually the issue here. (Left to right starting at the top, it’s 1,3,6, 5,7,9, 2,4,10). The issue is whether to bother with equations and algebra or not… $\endgroup$ Commented May 26 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .