Rank of a matrix product with some conditions I have $A \in \mathbb{R}^{q\times n }, B \in \mathbb{R}^{n \times p} $ with $\text{rank}(A)=q~$ and $~\text{rank}(B)=p$.
Additionally there is the condition: $n\geq p \geq q$.
I know that $\text{rank}(AB)\leq \min\{\text{rank}(A), \text{rank}(B)\}=q$.
I want to know if equality ($\text{rank}(AB)=q$)  always holds with the additional condition  $n\geq p \geq q~$, or are there some constraints?
 A: No, the equality does not necessarily hold. Consider the case of $n = 3,p=2,q=1$. Take
$$
A = \pmatrix{1&0&0},\quad  B = \pmatrix{0&0\\1&0\\0&1}.
$$
We have $\operatorname{rank}(AB) = 0 < q = 1$.

One possibly helpful additional condition: if $p = n$ (so that $B$ is square) and both $A$ and $B$ have full rank, then it will always hold that $\operatorname{rank}(AB) = \operatorname{rank}(A) = q$.
A: Take the following example:
$$
A = \begin{bmatrix}
0 & 0 & 0& 1 & 0 & 0\\
0 & 0 & 0& 0 & 1 & 0 \\
0 & 0 & 0& 0 & 0 & 1 \\
\end{bmatrix}, B = \begin{bmatrix}
1 & 0\\
0 & 1\\
0 & 0\\
0 & 0\\
0 & 0\\
\end{bmatrix}, AB=\begin{bmatrix}
0 & 0\\
0 & 0\\
0 & 0\\
\end{bmatrix}
$$
As you can see, $rank(A) = 3$ , $rank(B) = 2$ and $rank(AB) = 0$. So it not always hold and constrain may be thought as A and B rank is compressed in the same side, roughly said. It is,
$$
A_2 = \begin{bmatrix}
1 & 0 & 0& 0 & 0 & 0\\
0 & 1 & 0& 0 & 0 & 0 \\
0 & 0 & 1& 0 & 0 & 0 \\
\end{bmatrix}, A_2B=\begin{bmatrix}
1 & 0\\
0 & 1\\
0 & 0\\
\end{bmatrix}
$$
