# Solve a system of linear equations

$\newcommand{\Sp}{\phantom{0}}$There is a system of linear equations: \begin{alignat*}{4} &x - &&y - 2&&z = &&1, \\ 2&x + 3&&y - &&z =-&&2. \end{alignat*}

I create the matrix of the system: $$\left[\begin{array}{rrr|r} 1 & -1 & -2 & 1 \\ 2 & 3 & -1 & -2 \end{array}\right]$$ then with GEM, $$\left[\begin{array}{rrr|r} 1 & -1 & -2 & 1 \\ 0 & 5 & 3 & -4 \end{array}\right]$$

I don't know how to proceed after that? I have found the correction of this exercise but I still don't understand the way to solve it. Can someone help me please?

• Sorry, it was a 3. – rusol Jun 1 '14 at 17:10

This is the problem of finding the complete solution to $Ax=b$. To learn how to do this, you may want to watch this video or Gilbert Strang's full video lecture or notes on the topic.

The idea is that we need to find

(a) the null space $N$ of $\left[\begin{array}{rrr|r} 1 & -1 & -2 \\ 2 & 3 & -1 \end{array}\right]$ and

(b) a single solution $c$ to $\left[\begin{array}{rrr} 1 & -1 & -2 \\ 2 & 3 & -1 \end{array}\right]c = \left[\begin{array}{r} 1 \\-2 \end{array}\right]$.

Then all the solutions are exactly $x = N + c$.

Row reduction is the first step regardless of what we do next.

(a) We have $\left[\begin{array}{rrr} 1 & -1 & -2 \\ 0 & 5 & 3 \end{array}\right] \left[\begin{array}{r} 7/5 \\ -3/5 \\ 1 \end{array}\right] = \left[\begin{array}{r} 0 \\ 0 \end{array}\right]$. Thus the null-space is $N = \left[\begin{array}{r} 7/5 \\ -3/5 \\ 1 \end{array}\right]a$.

(b) Notice that $\left[\begin{array}{rrr} 1 & -1 & -2 \\ 0 & 5 & 3 \end{array}\right] \left[\begin{array}{r} 1/5 \\ -4/5 \\ 0 \end{array}\right] = \left[\begin{array}{r} 1 \\ -4 \end{array}\right]$.

Hence the solutions are exactly all $x$ such that

$$x = \left[\begin{array}{r} 7/5 \\ -3/5 \\ 1 \end{array}\right]a + \left[\begin{array}{r} 1/5 \\ -4/5 \\ 0 \end{array}\right].$$

Another way of writing this is

\begin{align*} x &= \frac{7}{5}a + \frac{1}{5} \\ y &= -\frac{3}{5}a - \frac{4}{5} \\ z &= a. \end{align*}

I would apply two more row operations and present a solution with a free variable:

\begin{align*} & \left[\begin{array}{rrr|r} 1 & -1 & -2 & 1 \\ 2 & 3 & -1 & -2 \end{array}\right] R_2+(-2)R_1 \rightarrow R_2 \\ \equiv & \left[\begin{array}{rrr|r} 1 & -1 & -2 & 1 \\ 0 & 5 & 3 & -4 \end{array}\right] \frac{1}{5}R_2 \rightarrow R_2 \\ \equiv & \left[\begin{array}{rrr|r} 1 & -1 & -2 & 1 \\ 0 & 1 & \frac{3}{5} & -\frac{4}{5} \end{array}\right] R_1+R_2 \rightarrow R_1 \\ \equiv & \left[\begin{array}{rrr|r} 1 & 0 & -\frac{7}{5} & \frac{1}{5} \\ 0 & 1 & \frac{3}{5} & -\frac{4}{5} \end{array}\right]. \end{align*}

Read the solution straight from the matrix as

\begin{align*} x &=\frac{1}{5}+\frac{7}{5}r \\ y&=-\frac{4}{5}-\frac{3}{5}r \\ z&=r, \end{align*}

with $r\in \mathbb{R}$.

Bringing the matrix in reduced row echelon form $R$ (the way other answers have shown) is the first step no matter what you do.

As for "reading off" the solutions off $R$, I think there are several techniques. The one I was taught, and which I find the easiest to use, is the following:

1. remove all zero rows

In the example this leads to $\begin{bmatrix} 1 & 0 & -\frac{7}{5} & | & \frac{1}{5} \\ 0 & 1 & \frac{3}{5} & | & -\frac{4}{5} \end{bmatrix}$, so nothing changed here, since there were no zero rows

1. then insert any additional zero rows so the matrix is square and the pivots are all on the diagonal

$\begin{bmatrix} 1 & 0 & -\frac{7}{5} & | & \frac{1}{5} \\ 0 & 1 & \frac{3}{5} & | & -\frac{4}{5} \\ 0 & 0 & 0 & | & 0 \end{bmatrix}$

1. now you can read off a special solution $\lambda$ off the right hand side

$\lambda = \begin{pmatrix}\frac{1}{5} \\ -\frac{4}{5} \\ 0\end{pmatrix}$

1. replace all zero entries on the diagonal with $-1$.

$\begin{bmatrix} 1 & 0 & -\frac{7}{5} & | & \frac{1}{5} \\ 0 & 1 & \frac{3}{5} & | & -\frac{4}{5} \\ 0 & 0 & -1 & | & 0 \end{bmatrix}$

1. the columns with $-1$ on the diagonal (the free columns) now form the basis of the null space

$N = \langle \begin{pmatrix}-\frac{7}{5} \\ \frac{3}{5} \\ -1\end{pmatrix} \rangle = \{ r\cdot \begin{pmatrix}-\frac{7}{5} \\ \frac{3}{5} \\ -1\end{pmatrix}$ }, for all $r \in \mathbb{R}$.

And then, of course, the complete solution is just $\lambda + N$, that is $L = \{ \begin{pmatrix}\frac{1}{5} \\ -\frac{4}{5} \\ 0\end{pmatrix} + r\cdot \begin{pmatrix}-\frac{7}{5} \\ \frac{3}{5} \\ -1\end{pmatrix} | r \in \mathbb{R} \}$