RowReduce
✖
RowReduce

Details and Options

- RowReduce performs a version of Gaussian elimination, adding multiples of rows together so as to produce zero elements when possible. The final matrix is in reduced row echelon form.
- If m is a non‐degenerate square matrix, RowReduce[m] is IdentityMatrix[Length[m]]. »
- If m is a sufficiently non‐degenerate rectangular matrix with
rows and more than
columns, then the first
columns of RowReduce[m] will form an identity matrix. »
- RowReduce works on both numerical and symbolic matrices.
- The following options can be given:
-
Method Automatic method to use Modulus 0 integer modulus to use Tolerance Automatic numerical tolerance to use ZeroTest Automatic function to test whether matrix elements should be considered to be zero - RowReduce[m,Modulus->n] performs row reduction modulo n. »
- RowReduce[m,ZeroTest->test] evaluates test[m[[i,j]]] to determine whether matrix elements are zero.
- Possible settings for the Method option include "CofactorExpansion", "DivisionFreeRowReduction", and "OneStepRowReduction". The default setting of Automatic switches among these methods depending on the matrix given.
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Do row reduction on a square matrix:

https://wolfram.com/xid/0bdpror66-m92umj


https://wolfram.com/xid/0bdpror66-f6kasv

Do row reduction on a rectangular matrix:

https://wolfram.com/xid/0bdpror66-fhd1p4


https://wolfram.com/xid/0bdpror66-emcpsc

Row reduce a matrix with symbolic entries:

https://wolfram.com/xid/0bdpror66-liw

Scope (13)Survey of the scope of standard use cases
Basic Uses (8)
Find the row reduction of a real machine-number matrix:

https://wolfram.com/xid/0bdpror66-dop1ob

Row reduce a complex machine-precision matrix:

https://wolfram.com/xid/0bdpror66-2b1ovr

Row reduce an arbitrary-precision matrix:

https://wolfram.com/xid/0bdpror66-xlybxy


https://wolfram.com/xid/0bdpror66-h6bw9s


https://wolfram.com/xid/0bdpror66-1jo8f0

Row reduction of a symbolic matrix:

https://wolfram.com/xid/0bdpror66-uz5jo1

RowReduce assumes all symbols to be independent:

https://wolfram.com/xid/0bdpror66-ufegpu

Row reduction of rectangular matrices:

https://wolfram.com/xid/0bdpror66-iokqlf


https://wolfram.com/xid/0bdpror66-yp2wra


https://wolfram.com/xid/0bdpror66-llv4dh

The row reduction of a large numerical matrix is computed efficiently:

https://wolfram.com/xid/0bdpror66-q5hq5k

Row reduce a matrix with finite field elements:

https://wolfram.com/xid/0bdpror66-iewnv1

Special Matrices (5)
Row reduction of a sparse matrix:

https://wolfram.com/xid/0bdpror66-g0dm1x


https://wolfram.com/xid/0bdpror66-nu6n3h

Row reduction of a structured matrix:

https://wolfram.com/xid/0bdpror66-iowxff


https://wolfram.com/xid/0bdpror66-1abtx1


https://wolfram.com/xid/0bdpror66-d2yyup


https://wolfram.com/xid/0bdpror66-86r02y

RowReduce does not alter an identity matrix:

https://wolfram.com/xid/0bdpror66-khu8el


https://wolfram.com/xid/0bdpror66-uexgus

Row reduction of a Hilbert matrix:

https://wolfram.com/xid/0bdpror66-1famjs

Compute the row reduction of a matrix of univariate polynomials of degree
:

https://wolfram.com/xid/0bdpror66-cupbp5

https://wolfram.com/xid/0bdpror66-j0guy7

Options (3)Common values & functionality for each option
Modulus (1)
m is a 3×3 matrix of integers between 0 and 4:

https://wolfram.com/xid/0bdpror66-pnrqj
Row reduction of m in ordinary arithmetic:

https://wolfram.com/xid/0bdpror66-h1pw1v

Row reduction of m in arithmetic modulo 5:

https://wolfram.com/xid/0bdpror66-b1ntk1

Tolerance (1)
m is an ill-conditioned matrix:

https://wolfram.com/xid/0bdpror66-b22du7
In exact arithmetic, m is clearly non-degenerate:

https://wolfram.com/xid/0bdpror66-cs7883

With machine arithmetic, the default is to consider elements that are too small as zero:

https://wolfram.com/xid/0bdpror66-d2wixt

With zero tolerance, even small terms may be taken into account:

https://wolfram.com/xid/0bdpror66-nxde1


With an augmented matrix, you can see how possible solution components are amplified:

https://wolfram.com/xid/0bdpror66-knkwre

ZeroTest (1)
By default, symbolic expressions are considered nonzero:

https://wolfram.com/xid/0bdpror66-qbboav

In this case, RowReduce is missing the special case that produces a singular matrix:

https://wolfram.com/xid/0bdpror66-sn6sll

Write a function that tests if an expression might be zero:

https://wolfram.com/xid/0bdpror66-tvt4xd

Pass test[k] as the value of ZeroTest to get a more symbolic reduction:

https://wolfram.com/xid/0bdpror66-i17ylx

This catches the special case at , but gives a non-reduced matrix for other values of
:

https://wolfram.com/xid/0bdpror66-dxezeu

Applications (13)Sample problems that can be solved with this function
Spans and Linear Independence (5)
The following three vectors are not linearly independent:

https://wolfram.com/xid/0bdpror66-gocnsl

The row-reduced form has a zero row:

https://wolfram.com/xid/0bdpror66-l8nbp1

The following three vectors are linearly independent:

https://wolfram.com/xid/0bdpror66-keoxxm

Therefore the row-reduced form is the identity matrix:

https://wolfram.com/xid/0bdpror66-8mo3ba

Determine if the following vectors are linearly independent or not:

https://wolfram.com/xid/0bdpror66-qnovlz
As does not reduce to an identity matrix, they are not linearly independent:

https://wolfram.com/xid/0bdpror66-sotoh0

Find the dimension of the column space of the following matrix:

https://wolfram.com/xid/0bdpror66-fq6172
Since the row-reduced form is an identity matrix, the dimension of the column space equals the number of columns:

https://wolfram.com/xid/0bdpror66-oi7hun

Find the dimension of the subspace spanned by the following vectors:

https://wolfram.com/xid/0bdpror66-shxd3q
Since the row-reduced form has three nonzero rows, that is the dimension of the subspace:

https://wolfram.com/xid/0bdpror66-xieslj

Equation Solving and Invertibility (8)
Determine if the following system of equations has a unique solution:

https://wolfram.com/xid/0bdpror66-upikkb
Rewrite the system in matrix form:

https://wolfram.com/xid/0bdpror66-zs7ify

The coefficient matrix reduces to the identity matrix, so the system has a unique solution:

https://wolfram.com/xid/0bdpror66-6x59zk

Verify the result using Solve:

https://wolfram.com/xid/0bdpror66-tqujfz

Solve the system , with
a matrix and
a vector, using row reduction:

https://wolfram.com/xid/0bdpror66-buxhv5

https://wolfram.com/xid/0bdpror66-h39qlj

Do row reduction on the augmented matrix:

https://wolfram.com/xid/0bdpror66-ch7flo

The last column is the solution of :

https://wolfram.com/xid/0bdpror66-fx0g7j


https://wolfram.com/xid/0bdpror66-cyllwf

Do it for another right‐hand side:

https://wolfram.com/xid/0bdpror66-m0dbv4

There is no solution to since there is a leading 1 in the last column; confirm using Solve:

https://wolfram.com/xid/0bdpror66-3bnz5d

Find all solutions of the following system of equations:

https://wolfram.com/xid/0bdpror66-1c6b95

First, write the coefficient matrix , variable vector
and constant vector
:

https://wolfram.com/xid/0bdpror66-vokjmu

https://wolfram.com/xid/0bdpror66-se2owl

Reduce the augmented matrix to find one solution:

https://wolfram.com/xid/0bdpror66-t9fy4h

Extract the last column, which forms one solution:

https://wolfram.com/xid/0bdpror66-eq2hnc

Since there is a zero row, the null space is nonempty. Row reduce the augmented matrix :

https://wolfram.com/xid/0bdpror66-8znf02

The last half of the last row is an element of the null space:

https://wolfram.com/xid/0bdpror66-1nr4du

The general solution is the sum of and any multiple of
:

https://wolfram.com/xid/0bdpror66-hns0cu


https://wolfram.com/xid/0bdpror66-lntm8c

Determine if the following matrix has an inverse:

https://wolfram.com/xid/0bdpror66-soeczx
It does not reduce to an identity matrix, so it is not invertible:

https://wolfram.com/xid/0bdpror66-1itznp

Verify the result using Inverse:

https://wolfram.com/xid/0bdpror66-sfsjp9


Determine if the following matrix has a nonzero determinant:

https://wolfram.com/xid/0bdpror66-1q7xab
Since it reduces to an identity matrix, its determinant must be nonzero:

https://wolfram.com/xid/0bdpror66-0wktjf

Confirm the result using Det:

https://wolfram.com/xid/0bdpror66-xxnsh

is an eigenvalue of
if
does not reduce to an identity matrix. A matrix is deficient if it has an eigenvalue whose multiplicity is greater than the number of zero rows in the row-reduced form. Show that
is an eigenvalue for the following matrix
:

https://wolfram.com/xid/0bdpror66-5fmzho

https://wolfram.com/xid/0bdpror66-qf2h5t

Confirm the result using Eigenvalues:

https://wolfram.com/xid/0bdpror66-x53b0b

The matrix is deficient because 2 appears twice, but the row-reduced form only has one zero row:

https://wolfram.com/xid/0bdpror66-dxfyw9

Confirm the result with Eigensystem, which indicates deficiency by padding the eigenvector list with zeros:

https://wolfram.com/xid/0bdpror66-qbcxdp

Find the inverse of the following matrix using row reduction:

https://wolfram.com/xid/0bdpror66-i3avq8

https://wolfram.com/xid/0bdpror66-cv2gta

Row-reduce the augmented matrix:

https://wolfram.com/xid/0bdpror66-d3xqrz
The first three columns of are the identity matrix:

https://wolfram.com/xid/0bdpror66-j22xfu

The last three columns are the inverse of :

https://wolfram.com/xid/0bdpror66-frdvwp

Verify the result using Inverse:

https://wolfram.com/xid/0bdpror66-bu7tod

Estimate the fraction of random 10×10 0–1 matrices that are invertible:

https://wolfram.com/xid/0bdpror66-hlp98e

Properties & Relations (8)Properties of the function, and connections to other functions
RowReduce returns the leading zeroes as exact integers, irrespective the precision of the input:

https://wolfram.com/xid/0bdpror66-bv80bf

A square matrix m is invertible iff RowReduce[m] is IdentityMatrix[Length[m]]:

https://wolfram.com/xid/0bdpror66-engn9v

https://wolfram.com/xid/0bdpror66-c8uzqb


https://wolfram.com/xid/0bdpror66-jyqipe

Indeed, the inverse can be found by inverting the augmented matrix form by m and the identity matrix:

https://wolfram.com/xid/0bdpror66-v6i4s

For a square matrix, m reduces to an identity matrix if and only if Det[m]!=0:

https://wolfram.com/xid/0bdpror66-wdl5f0

https://wolfram.com/xid/0bdpror66-m3c6cz


https://wolfram.com/xid/0bdpror66-jdbcx4

For a square matrix, m reduces to an identity matrix if and only if the null space is empty:

https://wolfram.com/xid/0bdpror66-3raccb

https://wolfram.com/xid/0bdpror66-kllj5x


https://wolfram.com/xid/0bdpror66-fy748r

For a square matrix, m reduces to an identity matrix iff LinearSolve[m,b] has a solution for a generic b:

https://wolfram.com/xid/0bdpror66-xhqrgz

https://wolfram.com/xid/0bdpror66-et9y08


https://wolfram.com/xid/0bdpror66-yp8nl0


An matrix
with
has rank
iff the first
columns of RowReduce[m] form an identity matrix:

https://wolfram.com/xid/0bdpror66-dvvup

https://wolfram.com/xid/0bdpror66-d4rv7


https://wolfram.com/xid/0bdpror66-2yc2bx

Format the row-reduced matrix:

https://wolfram.com/xid/0bdpror66-lh5cu0

MatrixRank[m] equals the number of nonzero rows in RowReduce[m]:

https://wolfram.com/xid/0bdpror66-r3i6g7

https://wolfram.com/xid/0bdpror66-tqbxyq


https://wolfram.com/xid/0bdpror66-ji740x

The null space of a square matrix m can be computed using RowReduce:

https://wolfram.com/xid/0bdpror66-7t2yz
Do row reduction on the matrix augmented with the identity matrix:

https://wolfram.com/xid/0bdpror66-4u780

The augmented half of a row is in the null space if the row has a leading 1 in the augmented half:

https://wolfram.com/xid/0bdpror66-lbltst

Get null vectors using NullSpace:

https://wolfram.com/xid/0bdpror66-bu1n0y

Even though the vectors are not the same, they are a basis for the same space:

https://wolfram.com/xid/0bdpror66-dwlnqi

Wolfram Research (1988), RowReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/RowReduce.html (updated 2024).
Text
Wolfram Research (1988), RowReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/RowReduce.html (updated 2024).
Wolfram Research (1988), RowReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/RowReduce.html (updated 2024).
CMS
Wolfram Language. 1988. "RowReduce." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/RowReduce.html.
Wolfram Language. 1988. "RowReduce." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/RowReduce.html.
APA
Wolfram Language. (1988). RowReduce. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RowReduce.html
Wolfram Language. (1988). RowReduce. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RowReduce.html
BibTeX
@misc{reference.wolfram_2025_rowreduce, author="Wolfram Research", title="{RowReduce}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/RowReduce.html}", note=[Accessed: 16-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_rowreduce, organization={Wolfram Research}, title={RowReduce}, year={2024}, url={https://reference.wolfram.com/language/ref/RowReduce.html}, note=[Accessed: 16-April-2025
]}