Find the rank and nullity of the matrix:

\[A= \begin{bmatrix} 1 & 0 & 1 \\ 1 & 2 & 2 \\ 2 & 1 & 1 \\ -1 & 0 & 1 \\ 1& 1&2 \\ \end{bmatrix}\]

We’ll do a step-by-step reduction to row echelon form:

m = matrix(c(1,1,2,-1,1,0,2,1,0,1,1,2,1,1,2), nrow=5,ncol=3)

m[2,] = m[2,] - m[1,]
m[3,] = m[3,] - m[1,]*2 
m[4,] = m[4,] + m[1,] 
m[5,] = m[5,] - m[1,] 
m[2,] = m[2,]/2
m[3,] = m[3,] -m[2,]
m[5,] = m[5,] - m[2,] 
m[3,] = m[3,] / -1.5
m[1,] = m[1,] - m[3,]
m[2,] = m[2,] - m[3,]*0.5
m[4,] = m[4,] - m[3,]*2
m[5,] = m[5,] - m[3,]*0.5

m
##      [,1] [,2] [,3]
## [1,]    1    0    0
## [2,]    0    1    0
## [3,]    0    0    1
## [4,]    0    0    0
## [5,]    0    0    0

The RREF of \(A\) is:

\[\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}\]

As there are 3 pivot cols, the rank of the matrix is \(r(A) = 3\) and by definition, \(n(A) = n - r(A) = 0\)

So the Rank is 3 and the Nullity is 0