Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Null

Null Spaces of Matrices


Description

Given a matrix, M, find a matrix N giving a basis for the (left) null space. That is crossprod(N, M) = t(N) %*% M is an all-zero matrix and N has the maximum number of linearly independent columns.

Usage

Null(M)

Arguments

M

Input matrix. A vector is coerced to a 1-column matrix.

Details

For a basis for the (right) null space {x : Mx = 0}, use Null(t(M)).

Value

The matrix N with the basis for the (left) null space, or a matrix with zero columns if the matrix M is square and of maximal rank.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

qr, qr.Q.

Examples

# The function is currently defined as
function(M)
{
    tmp <- qr(M)
    set <- if(tmp$rank == 0L) seq_len(ncol(M)) else  -seq_len(tmp$rank)
    qr.Q(tmp, complete = TRUE)[, set, drop = FALSE]
}

MASS

Support Functions and Datasets for Venables and Ripley's MASS

v7.3-54
GPL-2 | GPL-3
Authors
Brian Ripley [aut, cre, cph], Bill Venables [ctb], Douglas M. Bates [ctb], Kurt Hornik [trl] (partial port ca 1998), Albrecht Gebhardt [trl] (partial port ca 1998), David Firth [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.