: rank (A)
: rank (A, tol)

Compute the rank of matrix A, using the singular value decomposition.

The rank is taken to be the number of singular values of A that are greater than the specified tolerance tol. If the second argument is omitted, it is taken to be

tol = max (size (A)) * sigma(1) * eps;

where eps is machine precision and sigma(1) is the largest singular value of A.

The rank of a matrix is the number of linearly independent rows or columns and equals the dimension of the row and column space. The function orth may be used to compute an orthonormal basis of the column space.

For testing if a system A*x = b of linear equations is solvable, one can use

rank (A) == rank ([A b])

In this case, x = A \ b finds a particular solution x. The general solution is x plus the null space of matrix A. The function null may be used to compute a basis of the null space.

Example:

A = [1 2 3
     4 5 6
     7 8 9];
rank (A)
  ⇒ 2

In this example, the number of linearly independent rows is only 2 because the final row is a linear combination of the first two rows:

A(3,:) == -A(1,:) + 2 * A(2,:)

See also: null, orth, sprank, svd, eps.

Package: communications