Learn R Programming

pracma (version 1.1.6)

nullspace: Kernel or Nullspace

Description

Kernel of the linear map defined by matrix M.

Usage

nullspace(M)

Arguments

M
Numeric matrix; vectors will be considered as column vectors.

Value

  • If M is an n-by-m (operating from right on n-dimensional row vectors), then N=nullspace(M) is a k-by-n matrix whose rows define a (linearly independent) basis of the k-dimensional kernel in R^n.

    As the rank of a matrix is also the dimension of its image, the following relation is true:

    n = dim(nullspace(M)) + rank(M)

Details

The kernel (aka null space/nullspace) of a matrix M is the set of all vectors x for which Ax=0. It is computed from the QR-decomposition of the matrix.

References

Trefethen, L. N., and D. Bau III. (1997). Numerical Linear Algebra. SIAM, Philadelphia.

See Also

mrank, orth, MASS::Null

Examples

Run this code
M <- matrix(1:12, 3, 4)
mrank(M)                 #=> 2
N <- nullspace(M)
#           [,1]       [,2]      [,3]
# [1,] 0.4082483 -0.8164966 0.4082483
N
M <- magic(5)
rank(M)                  #=> 5
nullspace(M)             #=> 0 0 0 0 0

Run the code above in your browser using DataLab