Rodney Dunning's Home Page | Research and Scholarship | 3x3 Gauss-Jordan Solver
Gauss-Jordan elimination is a technique for solving a system of linear equations. It's usually one of the first things you learn in a linear algebra course. A Google search on "Gauss-Jordan elimination" will bring up thousands of pages, with examples.
The following javascript form is borrowed from Stephen R. Schmitt's example. It automates the steps of Gauss-Jordan elimination to solve a system of three equations with three unknowns.
Instructions:
- Each row of the form represents an equation. The first box should contain the coefficient of the first variable, the second box the coefficient of the second variable, and the third box the coefficient of the third variable. The fourth box contains the number on the right-hand side of the equation. Enter all the values, making sure you have the correct signs.
- Click the initialize button.
- Click the single step button to perform one step in the Gauss-Jordan algorithm. After several clicks, the next step box will read "FINISHED." If the system has no solution, you will get a pop-up warning.
Example
Suppose you've applied Kirchoff's rules to a circuit and get the following equations:
(junction rule) I1 + I2 = I3
(loop rule) -14 + I1(6.0) - 10 - I2(4.0) = 0
(loop rule) 10 - I1(6.0) - I3(2.0) = 0
The first step is to arrange the equations so that each variable (I1, I2, I3) appears in the appropriate position (first column, second column, third column), with all the other numbers moved to the other side of the equations. Like this:
I1 + I2 - I3 = 0
I1(6.0) - I2(4.0) + I3(0) = 24
- I1(6.0) + I2(0) - I3(2.0) = -10
Notice how we've explicitly included the zero coefficients for I3 in the second equation and I2 in the third equation. This will make it a bit easier to fill in the boxes in the form, which should look like this:

Start by clicking the "Initialize" button, then click the "Single Step" button until you see FINISHED in the next step window. In this case it takes several clicks, which isn't unusual. At the end, you get this:

The numbers in the right-hand column are the solution to the system:
I1 = 2
I2 = -3
I3= -1
In the context of a Kirchoff's law problem, the negative signs mean we guessed the wrong directions for I2 and I3. This is not a big deal.
Important Points
-
If you don't click the "Initialize" button first, the form won't work.
-
Each time you click the "Single Step" button, the algorithm takes one step toward isolating all the unknowns. This is roughly analogous to you making one algebraic step in an effort to work out the system by hand. But Gauss-Jordan elimination is extremely efficient. Even though it takes several clicks to get to the answer, you would need many times that number of steps (and several pages of work) to grind through a 3x3 system by hand.
-
Not all 3x3 systems have solutions. You will get a pop-up warning if your system has no solution.
-
You must enter all the numbers correctly to get the correct solution. If you make a mistake, the form will solve the system, but it will be a different system from the one you need to solve. You can check the final results by plugging them back into your original equations. If they don't work, you made a mistake entering the initial values into the form.