An n by n matrix maps vectors in R^n to vectors in R^n. If the m atrix is invertible, it maps R^n to all of R^n (the mapping is both "one-to-one" and "onto"). If it is not invertible, it maps R^n into some subspace of R^n. The "rank" of the matrix is the dimension of that subspace. Of course, that means the mapping is not "onto" and so cannot be "one-to-one".
A0= 0 for any matrix A so the one element of R^n we can be sure is in that subspace is 0. If A is not "one-to-one", more than on member of R^n (in fact, an entire subspace) is mapped to 0. That is the "nullspace" of A and its dimension is the "nullity". One can show that the sum of those two dimensions, rank+ nullity, must be n.
In the first case here,
\begin{bmatrix} 1 & 1 & 1 \\ 2 & -1 & 5 \\-1 & 0 & -2\end{bmatrix}
Finding the nullspace is the same as solving the equation
\begin{bmatrix} 1 & 1 & 1 \\ 2 & -1 & 5 \\-1 & 0 & -2\end{bmatrix}\begin{bmatrix}x \\ y \\ z\end{bmatrix}= \begin{bmatrix}0 \\ 0 \\ 0\end{bmatrix}
You could solve that, of course, by setting up an "augemented" matrix and row reducing- but since the last column will be all "0"s, you don't really need that- just row reduce the matrix itself.
If you subract twice the first row from the second and add the first row to the third you get
\begin{bmatrix}1 & 1 & 1\\ 0 & -3 & 3 \\ 0 & 1 & -1\end{bmatrix}
Now, if you divide the second row by -3, then subtract that from the third you get
\begin{bmatrix}1 & 1 & 1\\ 0 & 1 & -1 \\ 0 & 0 & 0\end{bmatrix}
We can interpret those as the equations x+ y+ z= 0, y- z= 0. From the second, z= y. Putting that into the first, x+ y+ y= x+ 2y= 0 so that x= -2y. That is, any vector in the nullspace is of the form <x, y, z>= <-2y, y, y>= y<-2, 1, 1>. The null space is 1 dimensional with basis {<-2, 1, 1>}.
We can also use that reduce matrix to say that any vector in the row space is of the form
\begin{bmatrix}x \\ y \\ z\end{bmatrix}= \begin{bmatrix}1 & 1 & 1 \\ 0 & 1 & -1\\ 0 & 0 & 0\end{bmatrix}\begin{bmatrix}u \\ v \\ w\end{bmatrix}= \begin{bmatrix}u+ v+ w \\ v- w\\ 0\end{bmatrix}
That is, a vector <x, y, z> in the row space is of the form x= u+ v+ w, y= v- w, z= 0. The first two are "independent" which means that vectors in the row space are of the form <x, y, 0>= <x, 0, 0>+ <0, y, 0>= x<1, 0, 0>+ y<0, 1, 0>. It is two-dimensional with \{<1, 0, 0>, <0, 1, 0>\} as basis.
Of course, rank+ nullity= 2+ 1= 3.