orth

Orthonormal basis for range of matrix

Description

example

Q = orth(A) returns an orthonormal basis for the range of A. The columns of Q are vectors, which span the range of A. The number of columns in Q is equal to the rank of A.

Examples

collapse all

Calculate and verify the orthonormal basis vectors for the range of a full rank matrix.

Define a matrix and find the rank.

A = [1 0 1;-1 -2 0; 0 1 -1];
r = rank(A)
r = 3

Since A is a square matrix of full rank, the orthonormal basis calculated by orth(A) matches the matrix U calculated in the singular value decomposition, [U,S] = svd(A,'econ'). This is because the singular values of A are all nonzero.

Calculate the orthonormal basis for the range of A using orth.

Q = orth(A)
Q = 3×3

   -0.1200   -0.8097    0.5744
    0.9018    0.1531    0.4042
   -0.4153    0.5665    0.7118

The number of columns in Q is equal to rank(A). Since A is of full rank, Q and A are the same size.

Verify that the basis, Q, is orthogonal and normalized within a reasonable error range.

E = norm(eye(r)-Q'*Q,'fro')
E = 1.0857e-15

The error is on the order of eps.

Calculate and verify the orthonormal basis vectors for the range of a rank deficient matrix.

Define a singular matrix and find the rank.

A = [1 0 1; 0 1 0; 1 0 1];
r = rank(A)
r = 2

Since A is rank deficient, the orthonormal basis calculated by orth(A) matches only the first r = 2 columns of matrix U calculated in the singular value decomposition, [U,S] = svd(A,'econ'). This is because the singular values of A are not all nonzero.

Calculate the orthonormal basis for the range of A using orth.

Q = orth(A)
Q = 3×2

   -0.7071         0
         0    1.0000
   -0.7071         0

Since A is rank deficient, Q contains one fewer column than A.

Input Arguments

collapse all

Input matrix.

Data Types: single | double
Complex Number Support: Yes

More About

collapse all

Range

The column space, or range, of a matrix A is the collection of all linear combinations of the columns of A. Any vector, b, that is a solution to the linear equation, A*x = b, is included in the range of A since you can also write it as a linear combination of the columns of A.

Rank

The rank of a matrix is equal to the dimension of the range.

Algorithms

orth is obtained from U in the singular value decomposition, [U,S] = svd(A,'econ'). If r = rank(A), the first r columns of U form an orthonormal basis for the range of A.

Extended Capabilities

See Also

| |

Introduced before R2006a