An $M\times N$ matrix $\mathbf{A}$ has the following form (in a system of linear equations $\mathbf{A}\mathbf{x}=\mathbf{b}$): $$ \begin{bmatrix} \ast & \ast & \ast & \ast & \ast & \ast \\ \ast & \ast & \ast & \ast & \ast & \ast \\ \ast & \ast & \ast & \ast & \ast & \ast \\ \ast & \ast & \ast & \ast & \ast & \ast \\ \ast & \ast & \ast & \ast & \ast & \ast \\ \ast & \ast & \ast & \ast & \ast & \ast \\ 0 & 1 & 0 & -1 & 0 & 0 \\ 0 & 0 & 1 & 0 & -1 & 0 \end{bmatrix} \mathbf{x}= \begin{bmatrix} \ast \\ \ast \\ \ast \\ \ast \\ \ast \\ \ast \\ 0 \\ 0 \end{bmatrix} $$ The upper part (6 rows and 6 cols marked with $\ast$) has rank 4, the additional two rows at bottom make the entire matrix be rank 6. I suppose there is a way to "merge" the last two rows into $\mathbf{A}$'s upper part to obtain a square matrix of rank 6. How to proceed?
I used some matrix library to check the rank. It employs QR Decomposition to solve the system. But, how to make a neat square matrix manually as its rank equals its dimension?