Recall the definitions of the kernel and range of a linear transformation $T: V \rightarrow W$
If $V$ is finite-dimensional, the dimensions of the kernel and range of $T$ are also finite.
The rank and nullity of $T$ are then defined as
$$ \text{rank}(T) := \text{dim}(\text{range}(T)) \\ \text{nullity}(T) := \text{dim(ker(}T)) $$
The pivot columns of reduced $A$ form the basis of $\text{range}(T_A)$. For example, let’s say $A$ reduced is
$$ \begin{bmatrix} 1 & 2 & 0 & 1 & 0 \\ 0 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 \\ \end{bmatrix} $$
There are pivot positions in columns 1, 3, 5. That means $\{\vec{a_1}, \vec{a_3}, \vec{a_5}\}$ are a basis for the range of $A$, and the rank of this matrix is 3.
To calculate kernel, we solve the general solution of the homogeneous problem $A\vec{x} = \vec{0}$
$$ x_2 \begin{bmatrix} -2 \\ 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} + x_4 \begin{bmatrix} -1 \\ 0 \\ -1 \\ 1 \\ 0 \end{bmatrix} $$
So,
$$ \text{ker}(T_A) = \text{span}\Bigg( \begin{bmatrix} -2 \\ 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} -1 \\ 0 \\ -1 \\ 1 \\ 0 \end{bmatrix}\Bigg) $$
And these vectors are a basis for the kernel of $T_A$
So, to calculate rank of $A$