Consider an $ m \times n $ matrix $ A = (a_{ij}) $. By row reduction, there exist elementary matrices $ E_1, \cdots ,E_p$ such that $ E_p \cdots E_1 A $ is a step matrix $ A' $.

[The first non-zero entry of a row, if exists, is called a pivot of that row. For an $ m \times n $ matrix $ A $, we'll denote it's rows by $ A_{1*}, \cdots, A_{m*} $ and columns by $ A_{*1}, \cdots, A_{*n} $. A matrix $ A $ is in step form when it's zero rows (if any) are at the bottom, and pivot indices $ j_1, \cdots, j_r $ of non-zero rows $ A_{1*}, \cdots , A_{r*} $ satisfy $ j_1 < j_2 < \cdots < j_r $ . Step matrices are also called row echelon matrices]

Say $ A' $ has $ r $ non-zero rows with pivot indices $ j_1 < \cdots < j_r $.

For any elementary matrix $ E $, $ A \mapsto EA $ preserves row space (i.e. span of matrix rows). So especially row rank (i.e. dimension of row space) of $ A $ is row rank of $ A' $, which is $ r $.

Now let's think of the column rank of $ A $. Here we'll be considering only columns, so let's take $ A_j $ to just mean column $ A_{*j} $. For any elementary matrix $ E $, $ ( A_{i_1}, \cdots, A_{i_k} ) $ is a basis of column space of $ A $ if and only if $ ( EA_{i_1}, \cdots, EA_{i_k} ) $ is a basis of column space of $ EA $, so we need only focus on the column space of $ A' $. But $ ( A'_{j_1}, \cdots, A'_{j_r} ) $ is a basis of column space of $ A' $, hence $ (A_{j_1}, \cdots, A_{j_r}) $ is a basis of column space of $ A $. Especially column rank of $ A $ is also $ r $.

To summarise, an elementary row operation on $ A $ preserves both row space and dimension of column space, so we need only look at row and column ranks of its step form $ A' $. But both of these are just the number of pivots of $ A' $.