Find the rank and nullity of the matrix
\[ A = \begin{bmatrix} 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{bmatrix} \]
library(pracma)
## Warning: package 'pracma' was built under R version 4.2.3
A <- matrix(c(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), nrow = 5, byrow = TRUE)
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
With n = 5 columns and r = 5 nonzero rows. The rank is r(A) = 5 The nullity is n(E) = 5 - 5 = 0
rref(A)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 0
## [2,] 0 1 0 0 0
## [3,] 0 0 1 0 0
## [4,] 0 0 0 1 0
## [5,] 0 0 0 0 1