Here you can perform row operations on a matrix to perform Gaussian Elimination
and Gauss-Jordon Elimination.
Row Operations
There are three basic row operations that are performed on a matrix. Any combination of these operations leaves a matrix row equivalent to the original matrix.
- Multiply a Row by a constant
To multiply a row by a constant, use the input
2*R1->R1
which multiplies row 1 by 2. Often the row on the right side of the ->
is left off such as 2*R1
. The multiplication sign *
is also optional. Note: the arrow ->
is entered as a dash -
followed by the greater than symbol >
- Multiply a row by a constant and add to another. To add rows 1 and 2 and place the result in row 2, type
R1+R2->R2
. One can also multiply rows by constants. For example, -3R1+R3->R3
or R1+(11/2)R2->R2
.
- Swap two rows To swap two rows, type the two rows to swap separated by <-> (This should look like a double-headed arrow.) For example,
R1<->R3
swaps rows 1 and 3.
Multiple Row Operations
As long as the operations are not both placed in the same row, two operations may be done at once. Each operation should be separated by a comma. For example, the following matrix:
\[ \left[ \begin{array}{rrr} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] \]
The two row operations -4R1+R2->R2, -7R1+R3->R3
will lead to the matrix:
\[ \left[ \begin{array}{rrr} 1 & 2 & 3 \\ 0 & -3 & -6 \\ 0 & -6 & -12 \end{array} \right] \]
Pivoting
When performing row operations on a matrix, it is desireable to have an 1 on some row of a column and zeros on the rest of the column.
This is often referred to as pivoting about an element. For example, if we take the matrix:
\[ \left[ \begin{array}{rrr} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] \]
and wish to get a 1 in the first row, second column, we would perform the following row operations:
- \(\frac{1}{2} R_1 \rightarrow R_1 \)
-
\(-5R_1 + R_2 \rightarrow R_2 \)
- \( -8 R_1 + R_3 \rightarrow R_3 \)
Which returns in the following matrix:
\[ \left[ \begin{array}{rrr} 1/2 & 1 & 3/3 \\ 3/2 & 0 & -3/2 \\ 3 & 0 & -3 \end{array} \right] \]
This can be done with the pivot
command which has the form: pivot(i,j)
which pivots about the ith row and jth column. For example, the above pivot can be done with the command pivot(1,2)
.
In addition, there is a pivot command called piv
that doesn't introduce more fractions into the matrix. (However, if fractions are already present, then they will remain). This performs similar row operations to that of the pivot
to get a column which is a multiple of the identity matrix. For example, we will
redo the pivot command to the matrix above
\[ \left[ \begin{array}{rrr} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right] \]
Applying piv(1,2)
, the resulting matrix is:
\[ \left[ \begin{array}{rrr} 1 & 2 & 3 \\ 1 & 0 & -1 \\ 1 & 0 & -1 \end{array} \right] \]
Converting a matrix to Decimals
The command toDecimal
will convert all the rational numbers to decimals (usually about 15 decimal places). For example starting with the matrix:
\[ \left[ \begin{array}{rr} 1/2 & 1/3 \\ 4/9 & 1/7 \end{array} \right]\]
and typing "toDecimal" in the input box results in
\[ \left[ \begin{array}{rr} 0.5 &0.4444444444444444 \\ 0.3333333333333333& 0.14285714285714285\end{array}\right]\]
Errors and Troubleshooting
A number of errors can arise from various forms of input. The main error arises from a bad parsing error.
Errors on entering a matrix
The matrix should be entered as each row on a separate line in the text box. Each element of the matrix should be separated by spaces and each element can either be an integer, rational (entered with a /
) or decimal. Its important that each row has the same number of elements.
Errors on row operations
Although the input on row operations is fairly flexible, there are a few things to keep in mind.
- All row operations use a CAPITAL R.
- On row swaps, this should be entered only as
R1<->R2
for example.
- On operations with mulitplying rows, the multiplication sign is optional. For example either
2*R1->R1
or 2R1->R1
can be used.
- If a rational number (fraction) is used as multiplication, then it should be surrounded by parentheses. For example,
(1/2)R2->R2
.
- The row on the right hand side of the arrow
->
is optional. If it is left off, it is assumed that the resultant row is the last row entered. For example, the row operations: 4R1+R3->R3
and 4R1+R3
are equivalent.