M
.nullspace(M)
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)
M
is the set of
all vectors x
for which Ax=0
. It is computed from the
QR-decomposition of the matrix.mrank
, orth
, MASS::Null
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