## 17Calculus Precalculus - Solve Linear Systems of Equations Using Matrix Row Operations

### Functions

Functions

Polynomials

Rational Functions

Matrices

Systems

Trigonometry

Complex Numbers

### Practice

Calculus 1 Practice

Calculus 2 Practice

Practice Exams

### Articles

 This technique has various names including Gaussian Elimination, Gauss-Jordan Elimination and Row Reduction. We use all these terms interchangably on this site to refer to the techniques on this page. There are three main techniques for solving linear systems of equations using matrices, row reduction, inverses and Cramer's Rule. Row reduction, which is the easiest and doesn't require a lot of knowledge about matrices, is covered on this page. Using inverses to solve linear systems of equations can be found on a separate page. Finally, Cramer's Rule can also be used to solve linear systems of equations.

Basics of Matrices

If you haven't seen matrices before, no worries. You don't need to know everything about matrices to understand how to use them to solve linear systems of equations. On this page, we will give you what you need and then you can learn the more about matrices when you need to later on.

So, what is a matrix? A matrix is a table of numbers or variables, simple as that. We usually write a matrix using either brackets or parentheses. Each entry in the matrix is called an element. The position of each element is as important as the value. Here is an example.

$$\displaystyle{ A = \left[ \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ a & b & c \end{array} \right] }$$

This matrix has 4 rows and 3 columns and it is given the name A. We would say that matrix A is a 4x3 (read four by three) matrix. We always give the number of rows first, then the number of columns.

A square matrix has the same number of rows and columns. So matrix B is a 3x3 square matrix.

$$\displaystyle{ B = \left[ \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] }$$

For two matrices to be equal, all the elements must be the same AND they must be in the same location. So, matrix C is NOT equal to matrix A even though they contain the same elements. A is 4x3 and C is 3x4.

$$\displaystyle{ C = \left[ \begin{array}{ccc} 1 & 2 & 3 & a \\ 4 & 5 & 6 & b \\ 7 & 8 & 9 & c \end{array} \right] }$$

Solving Systems of Linear Equations - - An Example

To use matrices to solve systems of linear equations, we are going write our equations in certain form, set up a matrix and perform some operations on the matrix to make it look a certain way. Then we will extract the answers from the matrix. I know, this is probably not very clear at this point but it will be soon. The best way to see what is going on is to work an example. We will solve this linear system of equations as we go through this page. Then, at the end, you will get to see a video with another example.

Example - - Solve the linear system
$$2x+y=4$$
$$3y=7-x$$

Step One Write the linear system to line up the terms with variables on the left of the equal sign and the constants on the right.

In our example, it looks like this.
$$2x+y=4$$
$$x+3y=7$$
It is important to always write the same variable in each column. Otherwise this technique will give you the wrong answer.

Step Two Form the augmented matrix from the coefficients and the constants.

Augmented Matrix??? What is that? The augmented matrix is made up of the coefficients and constants. A regular matrix would include just the coefficients. An augmented matrix is usually written with the last column containing the constants and a vertical bar separating the coefficients from the constants. Here is what our augmented matrix looks like.

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

We call this an augmented matrix since we usually draw the vertical bar. This vertical bar is not regular matrix notation. It is used only in augmented matrices when using this technique to solve linear systems of equations. Note - - Not all instructors use the vertical bar but it is recommended if your instructor allows. Check with them to see what they require.

Okay, so our augmented matrix is all set up (we will just call it a matrix for the rest of the time even though it is actually an augmented matrix). Now we are going to perform some operations on it to synthesize the data we are looking for.

Valid Operations

There are some valid operations that we are allowed to perform on this matrix that will not change the answer. In order for you to see what is going on, we will perform the operations on the matrix and on the system of equations at the same time, side-by-side. This should help you visualize what is going on. First, we give a list of operations, and then explain them.

 1. Switch two rows. 2. Multiply a row by a nonzero constant. 3. Replace a row by the sum of two rows.

Operation 1 - - Switch two rows.
It should be pretty obvious why this is valid. With our system of equations, switching two rows looks like this.

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

This is exactly equivalent to writing our original system equations in a different order.

$$\displaystyle{ \begin{array}{rcrcl} 2x & + & y & = & 4 \\ x & + & 3y & = & 7 \end{array} \to \begin{array}{rcrcl} x & + & 3y & = & 7 \\ 2x & + & y & = & 4 \end{array} }$$

So our answer has not changed.
Notice something very important in the above work. We used an arrow $$\to$$ and not an equal sign between the matrices when performing operations. This is important since the matrices are not the same.

Operation 2 - - Multiply a row by a nonzero constant.
Of course, you know from basic algebra that multiplying an equation by a nonzero constant does not change the equation.

Operation 3 - - Replace a row by the sum of two rows.
This is not so obvious. However, if you think about, it makes sense.
In the equation $$x+3y=7$$, we know that $$x+3y$$ is equal to $$7$$, i.e. $$x+3y$$ is $$7$$. That is obvious.
We also know that adding the same value to both sides of an equation does not changed the equation. For example, if we take $$2x+y=4$$ and add $$-4$$ to both sides, we get $$2x+y-4=0$$. This is the same equation, nothing has changed, right? This is a fundamental rule of basic algebra. So if we take $$x+3y=7$$ and add it to $$2x+y=4$$, we get $$3x+4y=11$$.

So that's it. Those are all the operations that you need to solve the system of equations. So, we have all the tools. Now we need to know what we are trying to accomplish.

Row Echelon and Reduced Row Echelon Forms

Our goal is find values for x and y that solve the system of equations. (We will tell you that our answer for this example is $$(1,2)$$, i.e. $$x=1$$ and $$y=2$$). If we write these equations in matrix form, it looks like this.

$$\displaystyle{ \left[ \begin{array}{cc|c} 1 & 0 & 1 \\ 0 & 1 & 2 \end{array} \right] }$$

This is called reduced row echelon form. In this case, we can pull the x and y values directly from the last column. We know that $$x=1$$ because we have a one in the upper left corner and we remember that we wrote the x's in the first column. Similarly for the y value. The other form, row echelon form, will come up as we finish this example.

Now that we know where we are going, we can determine which of the valid operations we need to use and when.

Final Key

The last key thing you need to know is in what order you work. It is best to work on the first column and get a one in first position and zeroes in the rest of the column. Then go to column 2 and get one in the second position and zeroes elsewhere. If you work the problem like this, you won't mess up each column as you go. So let's continue with our example.

Step Three Get the first column in the right form.

Remember our matrix after step two was

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

To get one in the first row, first column, we could multiply the first row by $$1/2$$ and that would be fine. But something to keep in mind while performing these operations is to try to avoid fractions. It is not always possible but the longer we avoid fractions, the better. So, to avoid fractions for the moment, let's switch rows 1 and 2 to get.

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

Remember, this is equivalent to switching the order of equations.

Okay, so now we need to get a zero in the first column, second row. To do that, we multiply the first row by $$-2$$ and add it to the second row. We listed the two operations separately above but we don't want to show the multiplication in the matrix since we already have our one in the upper left corner.

$$\displaystyle{ \left[ \begin{array}{cc|c} 1 & 3 & 7 \\ 2 & 1 & 4 \end{array} \right] \to \left[ \begin{array}{cc|r} 1 & 3 & 7 \\ 0 & -5 & -10 \end{array} \right] }$$

Notation - - In order to compactly write what operation we did here, many books and instructors will write something like this: $$-2R1+R2\to R2$$. This says that we multiplied row 1 by -2: $$-2R1$$ and added it to row 2: $$-2R1+R2$$, replacing row 2 with the result $$\to R2$$. We will use this notation as we continue.

Before we go on, let's see what these operations look like when written as a regular system of equations.

$$\left[ \begin{array}{rcrcr} 2x & + & y & = & 4 \\ x & + & 3y & = & 7 \end{array} \right] \to$$ $$\left[ \begin{array}{rcrcr} x & + & 3y & = & 7 \\ 2x & + & y & = & 4 \end{array} \right] \to$$ $$\left[ \begin{array}{rcrcr} x & + & 3y & = & 7 \\ 0 & + & -5y & = & -10 \end{array} \right]$$

Note: We wrote brackets around the equations just to clearly define where they begin and end. This is not matrix notation.
Okay, so we are done with the first column. We have a one in the first position and zero in all other positions.

Step Four Work on the second column.

Our next goal is to work on the second column. First is to get a one in the second position. That is pretty easy. We just multiply the second row by $$-1/5$$. The operation code is $$-1/5R2 \to R2$$. Doing this we get

$$\displaystyle{ \left[ \begin{array}{cc|r} 1 & 3 & 7 \\ 0 & -5 & -10 \end{array} \right] \to \left[ \begin{array}{cc|r} 1 & 3 & 7 \\ 0 & 1 & 2 \end{array} \right] }$$

The system of equations is

$$\left[ \begin{array}{rcrcr} x & + & 3y & = & 7 \\ 0 & + & -5y & = & -10 \end{array} \right] \to$$ $$\left[ \begin{array}{rcrcr} x & + & 3y & = & 7 \\ 0 & + & y & = & 2 \end{array} \right]$$

Now you can see that we can read the value for y directly from the second row, last column of the matrix. In the system of equations, you can see why.

Now we are ready to discuss the difference between row echelon form and reduced row echelon form. The matrix that we have now is in row echelon form. In this form, the diagonal has all ones and zeroes appear below the ones. In the reduced row echelon form, we also need zeroes above the diagonal of ones.

So at this point we can either stop since we have one of the values and then use substitution to get the other value or we can continue on to get reduced row echelon form. The decision is made depending on the problem statement. For this problem we were not told but just to show you how it works, let's continue on to reduced row echelon form. To do that, we need to get zero in the first row, second column. So we will multiply row two by -3 and add it to row one, i.e. $$-3R2+R1\to R1$$.

$$\displaystyle{ \left[ \begin{array}{cc|r} 1 & 3 & 7 \\ 0 & 1 & 2 \end{array} \right] \to \left[ \begin{array}{cc|r} 1 & 0 & 1 \\ 0 & 1 & 2 \end{array} \right] }$$

By now you should be able to see the analogy with the system of equations. Notice that this last operation did not mess up our first column. That's because of the order we recommended. By getting a one in the correct position and focusing on getting zeros for the rest of each column and working right to left, our previous work will stand.

As promised, now we can read the answers directly from the last column. So we have the solution $$(1,2)$$.

Final Answer $$(1,2)$$

All of this may be a bit foreign to you but you will understand it soon enough. It will help to watch someone else do it, so here are a couple of videos. In the first video, he gives a quick introduction and works a two equation system. Then he starts a three equation system and finishes it in the second video.

### PatrickJMT - Row Reducing a Matrix - Systems of Linear Equations - Part 1 [9min-59secs]

video by PatrickJMT

### PatrickJMT - Row Reducing a Matrix - Systems of Linear Equations - Part 2 [5min-34secs]

video by PatrickJMT

Number of Solutions

As you learned on the main systems of equations page, it is possible to have zero, one or infinite number of solutions. If you think about the relationship between the augmented matrix and the system of equations, you will see that
- if you get a row of all zeroes, there are infinite solutions
- if you get a row with all zeroes except for the last column, there is no solution.

Okay, time for some practice problems.

Practice

Unless otherwise instructed, solve these systems using Gaussian Elimination and give your answers in reduced-row echelon form.

Basic

$$2x+y=1;$$ $$3x-2y=-16$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$2x+y=1;$$ $$3x-2y=-16$$

Solution

### 1731 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$5x-2y=-4;$$ $$x+3y=-11$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$5x-2y=-4;$$ $$x+3y=-11$$

Solution

### 1733 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$2x+y=5;$$ $$x+4y=6$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$2x+y=5;$$ $$x+4y=6$$

Solution

He goes into a lot of detail on matrix operations in this video but you can just ignore that.

### 1734 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$2x-3y=4;$$ $$4x-6y=3$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$2x-3y=4;$$ $$4x-6y=3$$

Solution

### 1735 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$2x-4y=8;$$ $$x-2y=4$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$2x-4y=8;$$ $$x-2y=4$$

Solution

### 1736 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$3x-2y=13;$$ $$4x-y=-1$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$3x-2y=13;$$ $$4x-y=-1$$

Solution

### 1744 video

video by Brightstorm

Log in to rate this practice problem and to see it's current rating.

Intermediate

$$x+2y-z=-10;$$ $$2x-3y+2z=2;$$ $$x+y+3z=0$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x+2y-z=-10;$$ $$2x-3y+2z=2;$$ $$x+y+3z=0$$

Solution

### 1730 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$4x-y+2z=0;$$ $$2x+y-z=-11;$$ $$2x-2y+z=3$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$4x-y+2z=0;$$ $$2x+y-z=-11;$$ $$2x-2y+z=3$$

Solution

### 1732 video

video by MIP4U

Log in to rate this practice problem and to see it's current rating.

$$x+3y+z=10;$$ $$x-2y-z=-6;$$ $$2x+y+2z=10$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x+3y+z=10;$$ $$x-2y-z=-6;$$ $$2x+y+2z=10$$

Solution

### 1737 video

video by PatrickJMT

Log in to rate this practice problem and to see it's current rating.

$$x+y+z=4;$$ $$2x-3y+z=2;$$ $$-x+2y-z=-1$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x+y+z=4;$$ $$2x-3y+z=2;$$ $$-x+2y-z=-1$$

Solution

### 1738 video

video by PatrickJMT

Log in to rate this practice problem and to see it's current rating.

$$x+y-z=9;$$ $$y+3z=3;$$ $$-x-2z=2$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x+y-z=9;$$ $$y+3z=3;$$ $$-x-2z=2$$

Solution

### 1740 video

video by PatrickJMT

Log in to rate this practice problem and to see it's current rating.

$$-x+3y=-4;$$ $$x-2y+3z=9;$$ $$2x-5y+5z=17$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$-x+3y=-4;$$ $$x-2y+3z=9;$$ $$2x-5y+5z=17$$

Solution

The first video gets the matrix in the row echelon form. The second one takes the result of the first video and gets the reduced-row echelon form.

### 1741 video

video by mattemath

### 1741 video

video by mattemath

Log in to rate this practice problem and to see it's current rating.

$$x-2y+3z=7;$$ $$2x+y+z=4;$$ $$-3x+2y-2z=-10$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x-2y+3z=7;$$ $$2x+y+z=4;$$ $$-3x+2y-2z=-10$$

Solution

This solution is shown in two consecutive videos.
He stopped writing the matrices with brackets and vertical line, which is NOT recommended. As you can see by the end of the second video, it is hard to see what numbers go where without investigating closely. However, check with your instructor to see what they require.

### 1743 video

Log in to rate this practice problem and to see it's current rating.

$$x+y+z=3;$$ $$x+2y+3z=0;$$ $$x+3y+4z=-2$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x+y+z=3;$$ $$x+2y+3z=0;$$ $$x+3y+4z=-2$$

Solution

### 1739 video

Log in to rate this practice problem and to see it's current rating.

$$-x+2y-z=9;$$ $$3x-7y-2z=-20;$$ $$2x+2y+z=2$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$-x+2y-z=9;$$ $$3x-7y-2z=-20;$$ $$2x+2y+z=2$$

Solution

### 1745 video

Log in to rate this practice problem and to see it's current rating.

$$x-y-z+u=0;$$ $$2x+2z=8;$$ $$-y-2z=-8;$$ $$3x-3y-2z+4u=7$$

Problem Statement

Solve the following system using Gaussian Elimination and give your answer in reduced-row echelon form. $$x-y-z+u=0;$$ $$2x+2z=8;$$ $$-y-2z=-8;$$ $$3x-3y-2z+4u=7$$

Solution

### 1742 video

video by MIT OCW

Log in to rate this practice problem and to see it's current rating.

Really UNDERSTAND Precalculus

 equations of lines systems of equations

### Trig Formulas

The Unit Circle

The Unit Circle [wikipedia]

Basic Trig Identities

Set 1 - basic identities

$$\displaystyle{ \tan(t) = \frac{\sin(t)}{\cos(t)} }$$

$$\displaystyle{ \cot(t) = \frac{\cos(t)}{\sin(t)} }$$

$$\displaystyle{ \sec(t) = \frac{1}{\cos(t)} }$$

$$\displaystyle{ \csc(t) = \frac{1}{\sin(t)} }$$

Set 2 - squared identities

$$\sin^2t + \cos^2t = 1$$

$$1 + \tan^2t = \sec^2t$$

$$1 + \cot^2t = \csc^2t$$

Set 3 - double-angle formulas

$$\sin(2t) = 2\sin(t)\cos(t)$$

$$\displaystyle{ \cos(2t) = \cos^2(t) - \sin^2(t) }$$

Set 4 - half-angle formulas

$$\displaystyle{ \sin^2(t) = \frac{1-\cos(2t)}{2} }$$

$$\displaystyle{ \cos^2(t) = \frac{1+\cos(2t)}{2} }$$

Trig Derivatives

 $$\displaystyle{ \frac{d[\sin(t)]}{dt} = \cos(t) }$$ $$\displaystyle{ \frac{d[\cos(t)]}{dt} = -\sin(t) }$$ $$\displaystyle{ \frac{d[\tan(t)]}{dt} = \sec^2(t) }$$ $$\displaystyle{ \frac{d[\cot(t)]}{dt} = -\csc^2(t) }$$ $$\displaystyle{ \frac{d[\sec(t)]}{dt} = \sec(t)\tan(t) }$$ $$\displaystyle{ \frac{d[\csc(t)]}{dt} = -\csc(t)\cot(t) }$$

Inverse Trig Derivatives

 $$\displaystyle{ \frac{d[\arcsin(t)]}{dt} = \frac{1}{\sqrt{1-t^2}} }$$ $$\displaystyle{ \frac{d[\arccos(t)]}{dt} = -\frac{1}{\sqrt{1-t^2}} }$$ $$\displaystyle{ \frac{d[\arctan(t)]}{dt} = \frac{1}{1+t^2} }$$ $$\displaystyle{ \frac{d[\arccot(t)]}{dt} = -\frac{1}{1+t^2} }$$ $$\displaystyle{ \frac{d[\arcsec(t)]}{dt} = \frac{1}{\abs{t}\sqrt{t^2 -1}} }$$ $$\displaystyle{ \frac{d[\arccsc(t)]}{dt} = -\frac{1}{\abs{t}\sqrt{t^2 -1}} }$$

Trig Integrals

 $$\int{\sin(x)~dx} = -\cos(x)+C$$ $$\int{\cos(x)~dx} = \sin(x)+C$$ $$\int{\tan(x)~dx} = -\ln\abs{\cos(x)}+C$$ $$\int{\cot(x)~dx} = \ln\abs{\sin(x)}+C$$ $$\int{\sec(x)~dx} =$$ $$\ln\abs{\sec(x)+\tan(x)}+C$$ $$\int{\csc(x)~dx} =$$ $$-\ln\abs{\csc(x)+\cot(x)}+C$$

### Topics Listed Alphabetically

Single Variable Calculus

Multi-Variable Calculus

Differential Equations

Precalculus

### Search Practice Problems

Do you have a practice problem number but do not know on which page it is found? If so, enter the number below and click 'page' to go to the page on which it is found or click 'practice' to be taken to the practice problem.

 The 17Calculus and 17Precalculus iOS and Android apps are no longer available for download. If you are still using a previously downloaded app, your app will be available until the end of 2020, after which the information may no longer be available. However, do not despair. All the information (and more) is now available on 17calculus.com for free.
 Basics of Matrices Example Valid Operations Row Echelon and Reduced Row Echelon Forms Final Key Number of Solutions Practice

When using the material on this site, check with your instructor to see what they require. Their requirements come first, so make sure your notation and work follow their specifications.

DISCLAIMER - 17Calculus owners and contributors are not responsible for how the material, videos, practice problems, exams, links or anything on this site are used or how they affect the grades or projects of any individual or organization. We have worked, to the best of our ability, to ensure accurate and correct information on each page and solutions to practice problems and exams. However, we do not guarantee 100% accuracy. It is each individual's responsibility to verify correctness and to determine what different instructors and organizations expect. How each person chooses to use the material on this site is up to that person as well as the responsibility for how it impacts grades, projects and understanding of calculus, math or any other subject. In short, use this site wisely by questioning and verifying everything. If you see something that is incorrect, contact us right away so that we can correct it.