The Dimension of the Image Space and the Kernel of a Linear Transformation

Given a linear transformation
$T$
dimension of the image space is the number of non zero rows in the row reduced form of the matrx and the dimension of the kernel is the number of zero rows in the row reduced form
Example:
$\mathbf{M} = \left( \begin{array}{ccc} 1 & 2 & 1 \\ 1 & -1 & 0 \\ -1 & -2 & -1 \\ 2 & 1 & 1 \end{array} \right)$

$\left( \begin{array}{ccc} 1 & 2 & 1 \\ 0 & -3 & -1 \\ 0 & 0 & 0 \\ 0 & 3 & -1 \end{array} \right) \begin{array}{c} \\ R2-R1 \\ R3+R1 \\R4-2*R1 \end{array}$

$\left( \begin{array}{ccc} 1 & 2 & 1 \\ 0 & -3 & -1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{array} \right) \begin{array}{c} \\ \\ \\R4-R2 \end{array}$

There are two non zero rows so the dimension of the image space is 2 and there are two zero rows so the dimension of the kernel is 2.