linalg::rank

Rank of a matrix

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

linalg::rank(A)
linalg::rank(S)

Description

linalg::rank(A) computes the rank of the matrix A.

linalg::rank(S) computes the rank of the matrix whose columns are the vectors in S.

The row rank of a matrix is the maximal number of linearly independent row vectors of that matrix. The column rank of a matrix is the maximal number of linearly independent column vectors of that matrix. For each matrix, its row rank is equal to its column rank. This number is called the rank of a matrix.

The component ring of A or of the vectors given in S must be an integral domain (a domain of category Cat::IntegralDomain).

linalg::rank replaces symbolic elements of a matrix by random integer numbers between 1 and 1010. Then the function computes the rank of the resulting numeric matrix by Gaussian elimination (see linalg::gaussElim). This approach introduces a tiny chance of getting a wrong result.

    Note:   linalg::rank does not simplify special functions and algebraic numbers. For some matrices, this approach leads to wrong results. See Example 3.

Examples

Example 1

Define the following matrix A over :

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

Compute the rank of the matrix A:

linalg::rank(A)

Example 2

Use the three vectors to define the columns of the matrix A. Compute the rank of A:

MatZ := Dom::Matrix(Dom::Integer):
S:= { MatZ([0,1,1]), MatZ([0,1,0]), MatZ([0,0,1]) }:
linalg::rank(S)

Example 3

The linalg::rank function does not use any simplification rules for special functions, algebraic numbers (radicals), and so on. If linalg::rank computes intermediate expressions that can be simplified to zero, the function can return incorrect results. For example, create the following matrices:

A := matrix([[exp(x + y), exp(x)], [exp(y), 1]]);
B := matrix([[sin(x)^2 + cos(x)^2, 1], [1, 1]]);
C := matrix([[sqrt(6), sqrt(2)], [sqrt(3), 1]])

There is only one independent row in each of these matrices. The rank of the matrices A, B, and C is 1. The linalg::rank function returns 2 because it does not simplify the expressions , sin2 + cos2 - 1, and :

linalg::rank(A), linalg::rank(B), linalg::rank(C)

Parameters

A

A matrix of a domain of category Cat::Matrix

S

A list or set of column vectors of the same dimension (a column vector is an n×1 matrix of a domain of category Cat::Matrix)

Return Values

Nonnegative integer

See Also

MuPAD Functions

Related Examples

Was this topic helpful?