This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Gauss-Jordan elimination

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


linalg::gaussJordan(A, <All>)


linalg::gaussJordan(A) performs Gauss-Jordan elimination on the matrix A, i.e., it returns the reduced row echelon form of A.

The component ring R of A must be an integral domain, i.e., a domain of category Cat::IntegralDomain.

If R is a field, i.e., a domain of category Cat::Field, then the leading entries of the matrix T in reduced row echelon form are equal to one.

If R is a ring providing the method "gcd", then the components of each row of T do not have a non-trivial common divisor.

If the component ring of A is a field, then the reduced row echelon form is unique.


Example 1

We apply Gauss-Jordan elimination to the following matrix:

A := Dom::Matrix(Dom::Rational)( 
  [[1, 2, 3, 4], [-5, 0, 3, 0], [3, 5, 6, 9]] 

linalg::gaussJordan(A, All)

We see that rank(B) = 3. Because the determinant of a matrix is only defined for square matrices, the third element of the returned list is the value FAIL.

Example 2

If we consider the matrix from Example 1 as an integer matrix and apply the Gauss-Jordan elimination we get the following matrix:

B := Dom::Matrix(Dom::Integer)( 
  [[1, 2, 3, 4], [-5, 0, 3, 0], [3, 5, 6, 9]] 

Related Examples



A matrix of a domain of category Cat::Matrix



Returns a list where T is the reduced row echelon form of A and {j1, …, jr} is the set of characteristic column indices of T.

If A is not square, then the value FAIL is given instead of .

Return Values

a matrix of the same domain type as A, or the list [T, rank(A), det(A), {j_1,dots,j_r}] when the option All is given (see below).


Let T = (ti, j)1 ≤ im, 1 ≤ jn be an m×n matrix. Then T is a matrix in reduced row echelon form, if r ∈ {0, 1, …, n} and indices j1, j2, …, jr ∈ {1, …, n} exist with:

  1. j1 < j2 < ··· < jr.

  2. For each i ∈ {1, …, r}: ti, 1 = ti, 2 = ··· = ti, ji - 1 = 0. In addition, if A is defined over a field: ti, ji = 1.

  3. For each i ∈ {r + 1, …, m}: ti, j = 0 for each j ∈ {1, …, n}.

  4. For each i ∈ {1, …, r}: tk, ji = 0 for each k ∈ {1, …, i - 1}.

The indices j1, j2, …, jr are the characteristic column indices of the matrix T.

See Also

MuPAD Functions

Was this topic helpful?