Main Content

rref

Reduced row echelon form of matrix (Gauss-Jordan elimination)

Syntax

Description

example

rref(A) computes the reduced row echelon form of the symbolic matrix A. If the elements of a matrix contain free symbolic variables, rref regards the matrix as nonzero.

To solve a system of linear equations, use linsolve.

Examples

collapse all

Compute the reduced row echelon form of the magic square matrix.

rref(sym(magic(4)))
ans =
[ 1, 0, 0,  1]
[ 0, 1, 0,  3]
[ 0, 0, 1, -3]
[ 0, 0, 0,  0]

Compute the reduced row echelon form of the following symbolic matrix.

syms a b c
A = [a b c; b c a; a + b, b + c, c + a];
rref(A)
ans =
[ 1, 0, -(- c^2 + a*b)/(- b^2 + a*c)]
[ 0, 1, -(- a^2 + b*c)/(- b^2 + a*c)]
[ 0, 0,                            0]

See Also

| | |

Introduced before R2006a