wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time.
This article has been viewed 28,591 times.
Learn more...
If you have ever taken an algebra course in middle or high school, you’ve probably encountered a problem like this one: solve for and
These problems are called systems of equations. They often require you to manipulate one of the equations in such a way that you can obtain the values of the other variables. But what if you have 5 equations? Or 50? Or over 200,000, like many problems encountered in real life? That becomes a much more daunting task. Another way to tackle this problem is Gauss-Jordan elimination, or row-reduction.
Steps
Setting Up the Matrix
-
1Determine if row-reduction is right for the problem. A system of two variables is not very difficult to solve, so row-reducing doesn't have any advantages over substitution or normal elimination. However, this process becomes much slower as the number of equations goes up. Row-reduction allows you to use the same techniques, but in a more systematic way. Below, we consider a system of 4 equations with 4 unknowns.
- It is helpful, for purposes of clarity, to align the equations such that by looking from top to bottom, the coefficients of each variable are easily recognized, especially since the variables are only differentiated by subscripts.
-
2Understand the matrix equation. The matrix equation is the basic foundation of row-reduction. This equation says that a matrix acting on a vector produces another vector
- Recognize that we can write the variables and constants as these vectors. Here, where is a column vector. The constants can be written as a column vector
- What's left is the coefficients. Here, we put the coefficients into a matrix Make sure that every row in the matrix corresponds to an equation, and every column corresponds to a variable.
Advertisement -
3Convert your equations into augmented matrix form. As shown, a vertical bar separates the coefficients, written as a matrix from the constants, written as a vector The vertical bar signals the presence of the augmented matrix
Row-Echelon Form
-
1Understand elementary row operations. Now that we have the system of equations as a matrix, we need to manipulate it so that we get the desired answer. There are three row operations that we can perform on the matrix without changing the solution. In this step, a row of a matrix will be denoted by where a subscript will tell us which row it is.
- Row swapping. Simply swap two rows. This is useful in some situations, which we'll get to a bit later. If we want to swap rows 1 and 4, we denote it by
- Scalar multiple. You can replace a row with a scalar multiple of it. For example, if you want to replace row 2 with 5 times itself, you write
- Row addition. You can replace a row with the sum of itself and a linear combination of the other rows. If we want to replace row 3 with itself plus twice row 4, we write If we want to replace row 2 with itself, plus row 3, plus twice row 4, we write
- We can do these row operations at the same time, and among the three row operations, the latter two will be the most useful.
-
2Identify the first pivot. A pivot is the leading coefficient of each row. It is unique to each row and column, and identifies a variable with its equation. Let's see how this works.
- In general, the first pivot will always be the top left number, so has "its" equation. In our case, the first pivot is the 1 on the top left.
- If the top left number is a 0, swap rows until it is not. In our case, we don't need to.
-
3Row-reduce so that everything to the left and bottom of the pivot is 0. When this happens after we have identified all of our pivots, the matrix will be in row-echelon form. The row in which the pivot rests does not change.
- Replace row 2 with itself minus twice row 1. This guarantees that the element in row 2, column 1 will be a 0.
- Replace row 3 with itself minus row 1. This guarantees that the element in row 3, column 1 will be a 0.
- Replace row 4 with itself minus twice row 1. The element in row 4, column 1 will be a 0. Since these row operations pertain to different rows, we can do them simultaneously. There is no need to write out four matrices as part of showing your work.
- These row operations can be summarized below.
-
4Identify the second pivot and row-reduce accordingly.
- The second pivot can be anything from the second column except that in the first row, because the first pivot already makes it unavailable. Let's choose the element in row 2, column 2. Bear in mind that if a pivot not on the diagonal is chosen, you must row swap so that it is.
- Perform the following row operations such that everything below the pivot is 0.
-
5Identify the third pivot and row-reduce accordingly.
- The third pivot cannot be from the first or second rows. Let's choose the element in row 3, column 3. Notice a pattern here. We are choosing pivots along the diagonal of the matrix.
- Perform the following row operation. After doing so, the fourth pivot automatically comes out as the lower right element of the matrix.
- This matrix is in row-echelon form now. The pivots have been identified, and everything to the left and below the pivots is 0. Keep in mind that this is a row-echelon form - they are not unique, for different row operations may yield a matrix that looks nothing like the one above.
- You can immediately net and proceed to substitute to get all other variables. This is called back substitution, and is what computers use after reaching row-echelon form to solve systems of equations. However, we will continue to row-reduce until there stands nothing but the pivots and the constants.
Reduced Row-Echelon Form
-
1Understand what reduced row-echelon form (RREF) is. Unlike ordinary row-echelon, RREF is unique to the matrix, because it requires two additional conditions:
- The pivots are 1.
- The pivots are the only non-zero entry in their respective columns.
- Then, if the system of equations has one unique solution, the resulting augmented matrix will look like where is the identity matrix. This is our end goal for this part.
-
2Row-reduce to RREF. Unlike obtaining row-echelon form, there is not a systematic process by which we identify pivots and row-reduce accordingly. We just have to do it. It is helpful to simplify before proceeding, however - we can divide row 4 by 4. Doing so makes the arithmetic easier.
-
3Row-reduce such that the third row is all zeroes except for the pivot.
-
4Row-reduce such that the second row is all zeroes except for the pivot.
- then Then simplify the second row.
-
5Row-reduce such that the first row is all zeroes except for the pivot.
- then
-
6Divide so that each pivot is 1.
- This is RREF, and as expected, it immediately gives us the solution to our original equation as We are now done.
No Unique Solutions
-
1Understand the case of inconsistency. The example we went through above had one unique solution. In this part, we go through cases where you encounter a row of 0's in the coefficient matrix.
- After row-reducing as best as you can to row-echelon form, you may encounter a matrix similar to below. The important part is the row with the 0's, but also notice that we lack a pivot in the third row.
- That row of 0's says that the linear combination of the variables with coefficients of 0 add up to 1. This is never true, so the system is inconsistent and has no solution. If you reach this point, you are done.
-
2Understand the case of dependency. Perhaps in the row of 0's, the constant element in that row is also a 0, like so:
- This signals the presence of a dependent solution - a solution set with infinitely many solutions. Some may ask you to stop here, but not every is a solution. To see what the actual solution is, row-reduce to RREF.
- The third column lacks a pivot after reducing to RREF, so what does this matrix say exactly? Remember that the pivot "assigns" a row to that variable as its equation, so since the first two rows have pivots, we can identify and
- The first equation is the equation for while the second equation is the one for Now, solve for both.
- This is where "dependency" comes from. Both and rely on but is arbitrary here - it is a free variable. No matter what it is, the resulting pair of and will be a valid solution to the system. To account for this, reparameterize the free variable by setting
- Of course, plugging in a value for and presenting the resulting as a solution does not give the general solution. Rather, the general solution is
- In general, you may encounter free variables. In this case, all that is required is that you reparameterize dependent variables.
Community Q&A
-
QuestionHow can I know if the solution is unique or non-unique?Community AnswerDo the row reduction as usual. If the system has a unique solution, you will get ones along the diagonal and zeros everywhere else. Unique solutions require at least as many equations as unknowns (or columns as rows). If there are infinite solutions, you will find yourself unable to clear one of the columns because there's no pivot for it. This generally happens when you have more unknowns than equations, but can also happen when you thought you had enough equations for a unique solution, but they weren't independent and row reduction simplified one of the equations to 0x + 0y + 0z = 0.