A proof that every $R$-basis of $M$ has the same number of elements. Here is the proposition my professor gave to us:
Assume $R$ is commutative with unity.
Let $M$ be a finitely generated free $R$-module. Then every basis of $M$ has the same number of elements called the rank of $M.$
Here is the proof:
Let $\mathcal {B} = \{v_1, \dots , v_n\}$ and $\mathcal {B'} = \{w_1, \dots , w_r\}$ be two $R$-bases. There exist $P \in M_{r \times n}(R),Q \in M_{n \times r}(R)$ such that $$P\begin{bmatrix}
v_1 &\\
\vdots\\
v_n
\end{bmatrix} = \begin{bmatrix}
w_1 &\\
\vdots\\
w_r
\end{bmatrix}$$ and $$Q\begin{bmatrix}
w_1 &\\
\vdots\\
w_r
\end{bmatrix} = \begin{bmatrix}
v_1 &\\
\vdots\\
v_n
\end{bmatrix}.$$
Then $QP = I_{n\times n}$ and $PQ = I_{r\times r}.$
Case(1). (r > n)
Then $I_{r \times r} = [P_{r \times n} \mid Q_{r \times (r-n)}] [\frac{Q_{n \times r}}{Q_{(r-n)\times r}}],$ which is a contradiction since $\det [P_{r \times n} \mid Q_{r \times (r-n)}]=0.$
By symmetry, $r < n$ also can not occur. So $r = n.$

My question is that I do not understand why  $\det [P_{r \times n} \mid Q_{r \times (r-n)}]=0.$ Could anyone explain this to me please?
 A: The proof as you've written it is full of errors.
You say $I_{r \times r} = [P_{r \times n} \mid Q_{r \times (r-n)}] [\frac{Q_{n \times r}}{Q_{(r-n)\times r}}]$. Well, $Q_{r \times (r-n)}$ doesn't make sense since $Q$ is $n \times r$ and we're assuming $r > n$. You must have meant $I_{r \times r} = [P_{r \times n} \mid P_{r \times (r-n)}] [\frac{Q_{n \times r}}{Q_{(r-n)\times r}}]$. I'm guessing $P_{r \times (r-n)}$ means you pick off the first $r-n$ columns. In that case, $[P_{r \times n} \mid P_{r \times (r-n)}]$ does have determinant zero since it includes repeated columns. (This is where commutativity of $R$ is used.)
However, the corrected claim is $I_{r \times r} = [P_{r \times n} \mid P_{r \times (r-n)}] [\frac{Q_{n \times r}}{Q_{(r-n)\times r}}]$. The right-hand side is $P_{r \times n} Q_{n \times r} + P_{r \times (r-n)} Q_{(r-n) \times r}$. The first term is indeed $I_{r \times r}$, but I see no reason for the second term to be 0. What you want is to use $0_{(r-n) \times r}$ rather than $Q_{(r-n) \times r}$. Then it does work. You may as well have used $0_{r \times (r-n)}$ as well, which is entirely more transparent.
