Skip to Main Content Skip to Search
Product Documentation

null - Null space

Syntax

Z = null(A)
Z = null(A,'r')

Description

Z = null(A) is an orthonormal basis for the null space of A obtained from the singular value decomposition. That is, A*Z has negligible elements, size(Z,2) is the nullity of A, and Z'*Z = I.

Z = null(A,'r') is a "rational" basis for the null space obtained from the reduced row echelon form. A*Z is zero, size(Z,2) is an estimate for the nullity of A, and, if A is a small matrix with integer elements, the elements of the reduced row echelon form (as computed using rref) are ratios of small integers.

The orthonormal basis is preferable numerically, while the rational basis may be preferable pedagogically.

Examples

Example 1

Compute the orthonormal basis for the null space of a matrix A.

A = [1     2     3
     1     2     3
     1     2     3];

Z = null(A);
A*Z

ans =
  1.0e-015 *
     0.2220    0.2220
     0.2220    0.2220
     0.2220    0.2220

Z'*Z

ans =
    1.0000   -0.0000
   -0.0000    1.0000

Example 2

Compute the 1-norm of the matrix A*Z and determine that it is within a small tolerance.

norm(A*Z,1) < 1e-12
ans =
    1

Example 3

Compute the rational basis for the null space of the same matrix A.

ZR = null(A,'r')

ZR =
    -2    -3
     1     0
     0     1

A*ZR

ans =

     0     0
     0     0
     0     0

See Also

orth | rank | rref | svd

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS