How do I solve the $Ax=B$ equation where $A$ is not a square matrix? Let $A=\begin{bmatrix}2&-1&2&0\\-3&0&2&1\\-4&-1&-2&-1\end{bmatrix}$.
I need to solve find $X$ in $AX=B$, where $B=\begin{bmatrix}1\\-1\\0\end{bmatrix}$. How am I supposed to do this with $X=A^{-1}B$, as I cannot inverse A since it is not square? 
 A: Your matrix equation 
$$\begin{bmatrix}2&-1&2&0\\-3&0&2&1\\-4&-1&-2&-1\end{bmatrix}\begin{bmatrix}
x_1\\
x_2\\
x_3\\
x_4
\end{bmatrix}=\begin{bmatrix}1\\-1\\0\end{bmatrix}
$$
is the same as the following system of linear equations
$$\begin{matrix}
\ 2x_1&-x_2&+2x_3 &\ \ =&1\\
-3x_1&&+2x_3 &+x_4=&-1\\
-4x_1&-x_2&-2x_3 &-x_4=&0.
\end{matrix}$$
The number of equations is one less than the number of unknowns. So, we have to choose one of the unknowns to be the parameter of the solutions. Let $u=x_1$ and consider $u$ as a known quantity.
With this we have the following system of equations:
$$\begin{matrix}
-x_2 +&2x_3 &\ \ =&1-2u\\
&2x_3 &+x_4=&3u-1\\
-x_2-&2x_3 &-x_4=&4u
\end{matrix} \tag 1$$
which is equivalent to the following matrix equation
$$\begin{bmatrix}
-1 &2 &0\\
0&2&1\\
-1&-2&-1
\end{bmatrix}
\begin{bmatrix}
x_2\\
x_3\\
x_4
\end{bmatrix}=
\begin{bmatrix}
1-2u\\
3u-1\\
4u
\end{bmatrix}
$$
You can invert the $3\times 3$ matrix above if you like inverting matrices.
I would rather solve $(1)$ directly, though. For example we would immediately get 
$$x_2=1-7u$$
by adding the second and the third equation of $(1)$.
