Find the rank and nullity of the Matrix A
\[ A = \left[ {\begin{array}{cc} 3 & 2 & 1 & 1 & 1\\ 2 & 3 & 0 & 1 & 1\\ -1 & 1 & 2 & 1 & 0\\ 1 & 1 & 0 & 1 & 1\\ 0 & 1 & 1 & 2 & -1\\ \end{array} } \right] \]
using the Matrix and pracma package to solve this question:
library(Matrix)
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:pracma':
##
## expm, lu, tril, triu
library(pracma)
A <-matrix(c(3,2,-1,1,0,2,3,1,1,1,1,0,2,0,1,1,1,1,1,2,1,1,0,1,-1), nrow=5,ncol=5)
A
## [,1] [,2] [,3] [,4] [,5]
## [1,] 3 2 1 1 1
## [2,] 2 3 0 1 1
## [3,] -1 1 2 1 0
## [4,] 1 1 0 1 1
## [5,] 0 1 1 2 -1
rankMatrix(A)
## [1] 5
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 1.110223e-15
nullspace(A)
## NULL
We get that the rank is 5 and the nullity is 0