# Why does this method for solving matrix equations work?

I have this assignment:

Given:

$A = \begin{pmatrix} 2 & 4 \\ 0 & 3 \end{pmatrix}$

$C = \begin {pmatrix} -1 & 2 \\ -6 & 3 \end{pmatrix}$

Find all B that satisfy $AB = C$.

I know that one option is to say $B = \left( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \right)$ and multiply it with $A$. By making each member equal to the one in $C$, I have a system of linear equations which I can solve.

However, I also know that I can set up a system like this:

$$\left( \begin{array} {cc|cc} 2 & 4 & -1 & 2 \\ 0 & 3 & -6 & 3 \end{array} \right)$$

If I manipulate it like I would a system of linear equations (for example, by swapping rows, or adding a multiple of a row to another) to get the identity matrix $\left( \begin{smallmatrix} 1 & 0 \\ 0 & 1 \end{smallmatrix} \right)$, then what I'm looking for (matrix $B$) will appear in the right hand side, like this:

$$\left( \begin{array} {cc|cc} 1 & 0 & 7/2 & -1 \\ 0 & 1 & -2 & 1 \end{array} \right)$$

In this case, $B = \left( \begin{smallmatrix} 7/2 & -1 \\ -2 & 1\end{smallmatrix} \right)$.

My question is, quite simply, how does this work? It looks like magic to me right now.

-
It's the Gauss–Jordan elimination method. –  lhf Aug 5 '11 at 21:39

You want a matrix $B$ that satisfies $AB = C$. That is, if $A$ is invertible, you can left multiply both sides by $A^{-1}$ and get $B = A^{-1}C$.
Notice that simple row operations are just left multiplication by matrices. You may need a minute or two to convince yourself of this, but try it: left multiplying a matrix $A$ by $\begin{pmatrix}1&0 \\ 0&3\end{pmatrix}$ is just multiplying (row 2) by 3; left multiplying by $\begin{pmatrix} 1&2 \\ 0&1\end{pmatrix}$ is just adding 2*(row 2) to (row 1). So performing the same row operations to $A$ and $C$ is essentially left multiplying $A$ and $C$ by the same matrix. When you manipulate $A$ until it becomes the identity, you must have ended up left multiplying it by $A^{-1}$, so the matrix you get on the right is $A^{-1}C$, i.e. $B$.
(In the same way, if you wanted to solve $BA = C$ for $B$, you could use column operations, because right multiplication by matrices is just column operations.)