\HeaderA{Null}{Null Spaces of Matrices}{Null}
\keyword{algebra}{Null}
\begin{Description}\relax
Given a matrix, \code{M}, find a matrix \code{N} giving a basis for the
null space.  That is \code{t(N) \%*\% M}
is the zero and \code{N} has the maximum number of linearly
independent columns.
\end{Description}
\begin{Usage}
\begin{verbatim}
Null(M)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{M}] Input matrix.  A vector is coerced to a 1-column matrix.

\end{ldescription}
\end{Arguments}
\begin{Value}
The matrix \code{N} with the basis for the null space, or an empty
vector if the matrix \code{M} is square and of maximal rank.
\end{Value}
\begin{References}\relax
Venables, W. N. and Ripley, B. D. (2002)
\emph{Modern Applied Statistics with S.} Fourth edition.  Springer.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{qr}{qr}}, \code{\LinkA{qr.Q}{qr.Q}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# The function is currently defined as
function(M)
{
        tmp <- qr(M)
        set <- if(tmp$rank == 0) 1:ncol(M) else  - (1:tmp$rank)
        qr.Q(tmp, complete = TRUE)[, set, drop = FALSE]
}
\end{ExampleCode}
\end{Examples}

