Solving Linear Equation with non-invertible matrix? Find X when AX = B.
A= \begin{bmatrix}1&2&1\\2&5&4\end{bmatrix}
B = \begin{bmatrix}3&1\\5&4\end{bmatrix}
I know how to solve for x when A is invertible. I know it would just be $A^{-1}$B.
I'm confused with how to do this when A is non-invertible, I was trying to use the free variables. I can give the actual matrices if needed.
Thanks 
 A: reducing, saving a little typing
$$
\left(
\begin{array}{rrr|rr}
1 & 2 & 1 & 3 & 1 \\
2 & 5 & 4 & 5 & 4
\end{array}
\right)
$$
$$
\left(
\begin{array}{rrr|rr}
1 & 2 & 1 & 3 & 1 \\
0 & 1 & 2 & -1 & 2
\end{array}
\right)
$$
$$
\left(
\begin{array}{rrr|rr}
1 & 0 & -3 & 5 & -3 \\
0 & 1 & 2 & -1 & 2
\end{array}
\right)
$$
As Robert said from the beginning, you now have familiar augmented systems for the two columns of $X,$
$$
\left(
\begin{array}{rrr|r}
1 & 0 & -3 & 5  \\
0 & 1 & 2 & -1 
\end{array}
\right)
$$
$$
\left(
\begin{array}{rrr|r}
1 & 0 & -3 &  -3 \\
0 & 1 & 2 &  2
\end{array}
\right)
$$
A: Recall that one way to calculate matrix multiplication (in addition to the standard across-down technique) is that if 
$B=\begin{bmatrix}b_1&\cdots&b_n\end{bmatrix}$, i.e., $b_i$ is the $i$th column of $B$, we have 
$$
AB=\begin{bmatrix}Ab_1&\cdots&Ab_n\end{bmatrix}.
$$
In other words, the $i$th column of $AB$ is $Ab_i$.
Therefore, for $AX=B$ to be true, $X$ must have two columns (with three entries each).  This means that you need to solve for $X=\begin{bmatrix}x_1&x_2\end{bmatrix}$ as follows
$$
AX=\begin{bmatrix}Ax_1&Ax_2\end{bmatrix}=B.
$$
In other words, you're solving the two linear systems.
$$
\begin{bmatrix}1&2&1\\2&5&4\end{bmatrix}\begin{bmatrix}x_{11}\\x_{21}\\x_{31}\end{bmatrix}=\begin{bmatrix}3\\5\end{bmatrix}
$$
to get the first column of the matrix $X$ and 
$$
\begin{bmatrix}1&2&1\\2&5&4\end{bmatrix}\begin{bmatrix}x_{12}\\x_{22}\\x_{32}\end{bmatrix}=\begin{bmatrix}1\\4\end{bmatrix}
$$
to get the second column of the matrix $X$.
These last two systems can be solved by row reducing the augmented matrices 
$$
\begin{bmatrix}1&2&1&3\\2&5&4&5\end{bmatrix}
$$
and
$$
\begin{bmatrix}1&2&1&1\\2&5&4&4\end{bmatrix}
$$
A: Let $B_1$ and $B_2$ be the columns of $B$, $X_1$ and $X_2$ the columns of $X$.  Then you can rearrange your system as
$$ \eqalign{A X_1 &= B_1\cr
            A X_2 &= B_2\cr}$$
If you wish this can be considered as a single system in block form
$$ \pmatrix{A & 0\cr 0 & A\cr} \pmatrix{X_1\cr X_2} = \pmatrix{B_1\cr B_2}$$
but you might as well just solve the two systems for $X_1$ and $X_2$ separately.
