Finding unknown values in an array given the sum totals

195 Views Asked by At

I could really use a talented mathematician's help on this.

In Image #1 I have a $5\times 5$ array with the totals calculated going diagonally. The totals are highlighted in orange and blue with corresponding colored lines showing where the values were obtained. The sums are interwoven - meaning changing one value produces a unique set of totals.

My question is if given only the totals as in Image #2 can the values within the array be recreated. Also this needs to be scaled for example to say a $10\times 10$ array or perhaps more. Without using brute force is there a formula which could accomplish this? Thank you so much in advance. As mentioned by Bram28 this method doesn't give back unique values so what if I constrained it with a third set of sums as in Image #3. Would that work?

Image #1

Image #2

Image #3

1

There are 1 best solutions below

8
On

As pointed out in the comments, there can be many solutions to a given setup, even if you restrict yourself to digits 0-9. Just for a sanity check, here is another solution to the puzzle you provided:

\begin{array}{|c|c|c|c|c|} \hline 2&2&3&2&1\\ \hline 0&2&1&5&2\\ \hline 1&4&0&6&2\\ \hline 4&0&4&6&3\\ \hline 3&3&5&1&2\\ \hline \end{array}

EDIT

Even adding the sums for the horizontals and the verticals will not guarantee a unique solution (unless, again, we would restrict ourselves to a certain interval (e.g. digits 0-9) ... in that case we could have sums that force everything to be the maximum value, for example). Look at the following:

\begin{array}{|c|c|c|c|c|} \hline 0&1&0&-1&0\\ \hline -1&0&0&0&1\\ \hline 0&0&0&0&0\\ \hline 1&0&0&0&-1\\ \hline 0&-1&0&1&0\\ \hline \end{array}

Notice that if we add this matrix to any one solution, we will get another solution!

For example, if we take your original solution:

\begin{array}{|c|c|c|c|c|} \hline 2&1&2&3&1\\ \hline 1&2&5&4&1\\ \hline 2&1&1&4&4\\ \hline 2&0&5&5&2\\ \hline 3&5&4&2&2\\ \hline \end{array}

and we add the 'change' array to it, we get:

\begin{array}{|c|c|c|c|c|} \hline 2&2&2&2&1\\ \hline 0&2&5&4&2\\ \hline 2&1&1&4&4\\ \hline 3&0&5&5&1\\ \hline 3&4&4&3&2\\ \hline \end{array}

we get another solution with the exact same sums for the diagonals, verticals, and horizontals!