# RowReduce

RowReduce[m]

gives the rowreduced form of the matrix m.

# 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 nondegenerate square matrix, RowReduce[m] is IdentityMatrix[Length[m]]. »
• If m is a sufficiently nondegenerate 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 all

## Basic Examples(3)

Do row reduction on a square matrix:

Do row reduction on a rectangular matrix:

Row reduce a matrix with symbolic entries:

## Scope(13)

### Basic Uses(8)

Find the row reduction of a real machine-number matrix:

Row reduce a complex machine-precision matrix:

Row reduce an arbitrary-precision matrix:

Row reduce an exact matrix:

Row reduction of a symbolic matrix:

RowReduce assumes all symbols to be independent:

Row reduction of rectangular matrices:

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

Row reduce a matrix with finite field elements:

### Special Matrices(5)

Row reduction of a sparse matrix:

Row reduction of a structured matrix:

RowReduce does not alter an identity matrix:

Row reduction of a Hilbert matrix:

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

## Options(3)

### Modulus(1)

m is a 3×3 matrix of integers between 0 and 4:

Row reduction of m in ordinary arithmetic:

Row reduction of m in arithmetic modulo 5:

### Tolerance(1)

m is an ill-conditioned matrix:

In exact arithmetic, m is clearly non-degenerate:

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

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

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

### ZeroTest(1)

By default, symbolic expressions are considered nonzero:

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

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

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

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

## Applications(13)

### Spans and Linear Independence(5)

The following three vectors are not linearly independent:

The row-reduced form has a zero row:

The following three vectors are linearly independent:

Therefore the row-reduced form is the identity matrix:

Determine if the following vectors are linearly independent or not:

As does not reduce to an identity matrix, they are not linearly independent:

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

Since the row-reduced form is an identity matrix, the dimension of the column space equals the number of columns:

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

Since the row-reduced form has three nonzero rows, that is the dimension of the subspace:

### Equation Solving and Invertibility(8)

Determine if the following system of equations has a unique solution:

Rewrite the system in matrix form:

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

Verify the result using Solve:

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

Form an augmented matrix :

Do row reduction on the augmented matrix:

The last column is the solution of :

Do it for another righthand side:

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

Find all solutions of the following system of equations:

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

Verify the rewrite:

Reduce the augmented matrix to find one solution:

Extract the last column, which forms one solution:

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

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

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

Determine if the following matrix has an inverse:

It does not reduce to an identity matrix, so it is not invertible:

Verify the result using Inverse:

Determine if the following matrix has a nonzero determinant:

Since it reduces to an identity matrix, its determinant must be nonzero:

Confirm the result using Det:

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 :

Confirm the result using Eigenvalues:

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

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

Find the inverse of the following matrix using row reduction:

Form the augmented matrix :

Row-reduce the augmented matrix:

The first three columns of are the identity matrix:

The last three columns are the inverse of :

Verify the result using Inverse:

Estimate the fraction of random 10×10 01 matrices that are invertible:

## Properties & Relations(8)

RowReduce returns the leading zeroes as exact integers, irrespective the precision of the input:

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

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

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

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

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

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

Format the row-reduced matrix:

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

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

Do row reduction on the matrix augmented with the identity matrix:

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

Get null vectors using NullSpace:

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

Wolfram Research (1988), RowReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/RowReduce.html (updated 2023).

#### Text

Wolfram Research (1988), RowReduce, Wolfram Language function, https://reference.wolfram.com/language/ref/RowReduce.html (updated 2023).

#### CMS

Wolfram Language. 1988. "RowReduce." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. 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

#### BibTeX

@misc{reference.wolfram_2024_rowreduce, author="Wolfram Research", title="{RowReduce}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/RowReduce.html}", note=[Accessed: 20-May-2024 ]}

#### BibLaTeX

@online{reference.wolfram_2024_rowreduce, organization={Wolfram Research}, title={RowReduce}, year={2023}, url={https://reference.wolfram.com/language/ref/RowReduce.html}, note=[Accessed: 20-May-2024 ]}