Let $A$ and $B$ be $5\times5$ matrices. For each $k$, $0\leq k\leq5$, find all possible values for $Rank(BA)$ given that $Rank(AB)=k$. Prove your statement.
My attempt:
Using the following two theorems,
$1.$ $Rank(AB)\leq \min\bigg(Rank(A), Rank(B)\bigg)$
$2.$ $Rank(AB)\geq Rank(A)+Rank(B)-5$
we have, $$Rank(A)+Rank(B)-5\leq k \leq \min\bigg(Rank(A), Rank(B)\bigg)$$ $$Rank(A)+Rank(B)-5\leq Rank(BA) \leq \min\bigg(Rank(A), Rank(B)\bigg)$$ $$\Rightarrow |k-Rank(BA)|\leq \min\bigg(Rank(A), Rank(B)\bigg)-\bigg(Rank(A)+Rank(B)-5\bigg)$$
I got stuck here. The solution/hint in the book states:
$|k-Rank(BA)|\leq 2,1, \ or \ 0$ according as $min\bigg(Rank(A), Rank(B)\bigg)$ belongs to $\{0,1\}$, $\{2,3\}$, or $\{4,5\}$. Consider $A=\begin{bmatrix} I_r & 0\\ 0 & 0 \end{bmatrix}$, $B=\begin{bmatrix} 0 & I_s\\ 0 & 0 \end{bmatrix}$ for suitable $r$ and $s$.
How do I move forward in my approach? I can not understand the solution/hint despite having read it multiple times.
I eventually found the answer by myself, and I am going to post a picture containing a handwritten solution for anyone curious about how to tackle this problem. Apologies for not using LaTeX and being slightly lazy here. (Note: slanted P-like symbol represents Rank)