# Documentation

### This is machine translation

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

# `linalg`::`gaussElim`

Gaussian elimination

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

For Gaussian Elimination in MATLAB®, see the Symbolic Math Toolbox™ `rref` function.

## Syntax

```linalg::gaussElim(`A`, <All>)
```

## Description

`linalg::gaussElim(A)` performs Gaussian elimination on the matrix A to reduce A to a similar matrix in upper row echelon form.

A row echelon form of `A` returned by `linalg::gaussElim` is not unique. See `linalg::gaussJordan` for computing the reduced row echelon form.

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`, ordinary Gaussian elimination is used. Otherwise, `linalg::gaussElim` applies fraction-free Gaussian elimination to `A`.

`linalg::gaussElim` serves as an interface function for the method `"gaussElim"` of the matrix domain of `A`, i.e., one may call `A::dom::gaussElim(A)` directly instead of `linalg::gaussElim(A, All)`

Refer to the help page of `Dom::Matrix` for details about the computation strategy of `linalg::gaussElim`.

## Examples

### Example 1

We apply Gaussian elimination to the following matrix:

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

which reduces `A` to the following row echelon form:

`linalg::gaussElim(A)`

### Example 2

We apply Gaussian elimination to the matrix:

```B := Dom::Matrix(Dom::Integer)( [[1, 2, -1], [1, 0, 1], [2, -1, 4]] )```

and get the following result:

`linalg::gaussElim(B, All)`

We see that rank(B) = 3 and .

## Parameters

 `A` A matrix of a domain of category `Cat::Matrix`

## Options

 `All` Returns a list where T is a 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).

## Algorithms

Let T = (ti, j)1 ≤ im, 1 ≤ jn be an m×n matrix. Then T is a matrix in an upper 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.

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

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