Finding unknown values in matrix

2.1k Views Asked by At

First of all i hope I'm at the right place to ask for help with this problem!

Let's assume a simple 2x2 grid in where all x and y values are not known. The total values are known though.

x1       | x2      | xTotal
y1       | y2      | yTotal
____________________
xy1Total | xy2Total

xTotal = x1 + x2
yTotal = y1 + y2
xy1Total = x1 + y1
xy2Total = x2 + y2

Example numbers for the known values:
xy1Total = 13
xy2Total = 17
xTotal = 15
yTotal = 15

Is there any way of "re-calculating" the unknown values? I stumbled upon the Gaussian elimination. I'm still not sure if this method can be applied here.
Thanks in advance.

3

There are 3 best solutions below

0
On BEST ANSWER

It suffices to consider the system

  • $x_1 + x_2 =x_{Total}=13$
  • $ y_1 + y_2 = y_{Total}=17$
  • $x_1 + y_1 =xy1_{Total}=15$
  • $ x_2 + y_2 = xy2_{Total}=15$

which is in the augmented matrix form

$$\left[\begin{array}{cccc|c} 1& 1& 0& 0& 13\\ 0& 0& 1& 1& 17\\ 1& 0& 1& 0& 15\\ 0& 1& 0& 1& 15\\ \end{array}\right]$$

which can be solved by Gaussian elimination that is

$$\left[\begin{array}{cccc|c} 1& 1& 0& 0& 13\\ 1& 0& 1& 0& 15\\ 0& 1& 0& 1& 15\\ 0& 0& 1& 1& 17\\ \end{array}\right]\to \left[\begin{array}{cccc|c} 1& 1& 0& 0& 13\\ 0& -1& 1& 0& 2\\ 0& 1& 0& 1& 15\\ 0& 0& 1& 1& 17\\ \end{array}\right]\to \left[\begin{array}{cccc|c} 1& 1& 0& 0& 13\\ 0& -1& 1& 0& 2\\ 0& 0& 1& 1& 17\\ 0& 0& 1& 1& 17\\ \end{array}\right]\to \left[\begin{array}{cccc|c} 1& 1& 0& 0& 13\\ 0& -1& 1& 0& 2\\ 0& 0& 1& 1& 17\\ 0& 0& 0& 0& 0\\ \end{array}\right]$$

therefore setting $y_2=k$ as free we obtain

  • $y_1=17-k$
  • $x_2=y_1-2=15-k$
  • $x_1=13-x_1=k-2$
0
On

That is a simple linear system of equations, you could solve it in lot's of ways, one of them being Gaussian elimination. In your example you have $$\begin{cases}x_1+x_2=15\\ y_1+y_2=15\\ x_1+y_1=13\\ x_2+y_2=17\end{cases}$$ four equations in four unknowns, to know from the start if the system has infinite, no or one solution you could use Rouchè-Capelli theorem. Gaussian elimination is a pretty involved process to find solutions to linear system of equations (it cannot be applied on non linear), in cases like this one you could simply use substitution, addition, subtraction, multiplication between rows etc.

If you really want to use gaussian elimination the system of equations can be put in matrix form like this $$\left(\begin{matrix}1&1&0&0&15\\0&0&1&1&15\\1&0&1&0&13\\0&1&0&1&17\end{matrix}\right)$$ Your system seems like having infinite solutions, in this case you just choose one variable to explicit the others as a function of that

0
On

The sums of the rows have a grand total, equal to the sum of all the $x_i$ and $y_i$. That must equal the grand total of all the column sums. Here, 13+17=15+15 so you are okay. If not, there will be no solutions.

Suppose the grand totals match, and you have a matrix with $M$ rows and $N$ columns. You can put in any numbers you like except for the last row and last column. Then work out numbers in the last column to make the row sums right, and numbers in the last row to make column sums right.