Solve a written problem with matrix I have the following problem described here:
The government attributes an allocation to the children who benefits child-care services. The children are splitted inside 3 groups: preschool, first cycle and second cycle. The allocation is different for each group, 2$ for the first cycle and the others are unknowns, lets name them x and y. On the other hand, we analysed the following data from 3 different school
Rainbow School: 43 preschool children, 160 first cycle children and 140 second cycle. Total allocation: 589$
Cumulus School: 50, 170, 160 total: k(unknown)
Nimbus School: 100, 88, 80 total: 556$
Now, I must represent the following problem with a matrix equation, I have tried the following:
$$
M = \begin{array}{cccc} 43x & 320 & 140y & 589 \\ 50x & 340 & 160y & k \\ 100x & 176 & 80y & 556 \end{array}
$$
I'm not sure that it make sense and I'm not sure how to solve it either. What now?
 A: There's an easier solution, I think.  Take the Rainbow and Nimbus schools alone. This yields a system of equations:
$$
43x+320+140y=589\\
100x+176+80y=556.
$$
Two variables and two equations means you can find the solutions for $x$ and $y$. Following that, you can plug those values into your formula for Cumulus and find $k$.
EDIT: if you know that $x$ and $y$ are integers, you can plug in some low values and probably find $x,y$ without solving the system properly.
A: Actually what you have is an equations system:
$$\left\{\begin{array}{cc}43x+320+140y=589 \\ 50x+340+160y=k \\ 100x+176+80y=556\end{array}\right.$$
You have three equations and three unknowns, which is basically a good thing since you want one solution.
The first thing you have to do is put the unknowns on the left hand side of the system and the constants on the other side:
$$\left\{\begin{array}{cc}43x+140y=589-320=269 \\ 50x+160y-k=-340 \\ 100x+80y=556-176=380\end{array}\right.$$
The next step is to write this as a vector equation:
$$\left(\begin{array}{cc}43x+140y \\ 50x+160y-k \\ 100x+80y\end{array}\right)=\left(\begin{array}{cc}269\\-340\\380\end{array}\right)$$
Which can also be written in matrix form:
$$\left[\begin{array}{cc}43 & 140 & 0 \\ 50 & 160 & -1 \\ 100 & 80 & 0\end{array}\right]\left(\begin{array}{cc}x\\y\\k\end{array}\right)=\left(\begin{array}{cc}269\\-340\\380\end{array}\right)$$
You can also choose to leave $k$ aside while finding $x$ and $y$ and substituting them back into the equation to get $k$. This would give you:
$$\left[\begin{array}{cc}43 & 140 \\ 100 & 80\end{array}\right]\left(\begin{array}{cc}x\\y\end{array}\right)=\left(\begin{array}{cc}269\\380\end{array}\right)$$
Either way, the method is the same. Write your equation as:
$$AX=B$$
Where $A=\left[\begin{array}{cc}43 & 140 \\ 100 & 80\end{array}\right]$, $X=\left(\begin{array}{cc}x\\y\end{array}\right)$ and $B=\left(\begin{array}{cc}269\\380\end{array}\right)$. (Or the 3 dimension versions)
Now the solution $X$ of your equation is:
$$X=A^{-1}B$$
if $A$ is non-singular (invertible)
