Example of row reducing a 3-by-3 matrix
Example: Row-reduce a 3-by-3 matrix to RREF:
$$A = \begin{pmatrix} 0 & 1 & 2 \\ 1 & 2 & 3 \\ 2 & 5 & 8 \end{pmatrix}$$
Step 1: Swap $R_1 \leftrightarrow R_2$:
$$\begin{pmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \\ 2 & 5 & 8 \end{pmatrix}$$
Step 2: $R_3 \leftarrow R_3 - 2R_1$:
$$\begin{pmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \\ 0 & 1 & 2 \end{pmatrix}$$
Step 3: $R_3 \leftarrow R_3 - R_2$:
$$\begin{pmatrix} 1 & 2 & 3 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{pmatrix}$$
Step 4: $R_1 \leftarrow R_1 - 2R_2$:
$$\begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{pmatrix}$$
This is the RREF. Rank = 2, one free variable ($x_3$).