# Solving Systems of Linear Equations Using Matrices

If you need to, review matrices , matrix row operations and solving systems of linear equations before reading this page.

The matrix method of solving systems of linear equations is just the elimination method in disguise. By using matrices, the notation becomes a little easier.

Suppose you have a system of linear equations such as:

$\left\{\begin{array}{l}\hfill 3x+4y=5\\ \hfill 2x-y=7\end{array}$

The first step is to convert this into a matrix. Make sure all equations are in standard form $\left(Ax+By=C\right)$ , and use the coefficients of each equation to form each row of the matrix. It may help you to separate the right column with a dotted line.

$\left[\begin{array}{cc}\hfill 3& \hfill 4\\ \hfill 2& \hfill -1\end{array}|\begin{array}{c}\hfill 5\\ \hfill 7\end{array}\right]$

Next, we use the matrix row operations to change the $2×2$ matrix on the left side to the identity matrix . First, we want to get a zero in Row $1$ , Column $2$ . So, add $4$ times Row $2$ to Row $1$ .

$\left[\begin{array}{cc}\hfill 11& \hfill 0\\ \hfill 2& \hfill -1\end{array}|\begin{array}{c}\hfill 33\\ \hfill 7\end{array}\right]\text{\hspace{0.17em}}\text{\hspace{0.17em}}\to \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{added}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\left(4×\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}2\right)\text{to}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}1$

Next we want a $1$ in the top left corner.

$\left[\begin{array}{cc}\hfill 1& \hfill 0\\ \hfill 2& \hfill -1\end{array}|\begin{array}{c}\hfill 3\\ \hfill 7\end{array}\right]\text{\hspace{0.17em}}\text{\hspace{0.17em}}\to \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{divided}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}1\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{by}\text{\hspace{0.17em}}\text{\hspace{0.17em}}11$

Now we want a zero in the bottom left corner.

$\left[\begin{array}{cc}\hfill 1& \hfill 0\\ \hfill 0& \hfill -1\end{array}|\begin{array}{c}\hfill 3\\ \hfill 1\end{array}\right]\text{\hspace{0.17em}}\text{\hspace{0.17em}}\to \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{added}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\left(-2×\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}1\right)\text{to}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}2$

Finally, we want a $1$ in Row $2$ , Column $2$ .

$\left[\begin{array}{cc}\hfill 1& \hfill 0\\ \hfill 0& \hfill 1\end{array}|\begin{array}{c}\hfill 3\\ \hfill -1\end{array}\right]\text{\hspace{0.17em}}\text{\hspace{0.17em}}\to \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{multiplied}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{Row}\text{\hspace{0.17em}}\text{\hspace{0.17em}}2\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{by}\text{\hspace{0.17em}}\text{\hspace{0.17em}}-1$

Now that we have the $2×2$ identity matrix on the left, we can read off the solutions from the right column:

$\begin{array}{l}\hfill x=3\\ \hfill y=-1\end{array}$

The same method can be used for $n$ linear equations in $n$ unknowns; in this case you would create an $n×\left(n-1\right)$ matrix, and use the matrix row operations to get the identity $n×n$ matrix on the left side.

Important Note: If the equations represented by your original matrix represent parallel lines, you will not be able to get the identity matrix using the row operations. In this case, the solution either does not exist or there are infinitely many solutions to the system.