If $AB=0$ prove that $\mathrm{rank}(A)+\mathrm{rank}(B)\leq n$

Let $A,B\in M_n(\mathbb{R})$ such that $AB=0$. Prove that $$\mathrm{rank}(A)+\mathrm{rank}(B)\leq n.$$

From the given information, I only know that $\mathrm{rank}(AB)=0$.


By $AB=0$, the column space of $B$ lies in the null space of $A$, i.e. $\mathrm{col}(B)\subset N(A)$. This implies that $\mathrm{rank}(B)=\dim (\mathrm{col}(B))\leq \dim N(A)$. Then, by rank-nullity theorem, we have $$\mathrm{rank}(B)+\mathrm{rank}(A)\leq \dim N(A)+\mathrm{rank}(A)=n.$$

Note added: To see $\mathrm{col}(B)\subset N(A)$, suppose that $B=[B_1|\cdots|B_n]$. If $x\in\mathrm{col}(B)$, then $x=y_1B_1+\cdots+y_nB_n=By$, where $y$ is the vector given by $y=\left[ \begin{array}{c} y_1 \\ y_2 \\ \vdots \\ y_n \\ \end{array} \right]$. Therefore, $Ax=ABy=0$ since $AB=0$.


Use Gaussian elimination: $A=RA'$, where $A'$ is upper triangular and $R$ represents row tranforms, $B=B'C$, where $B'$ is lower triangular and $C$ represents column transforms.

The diagonal of $A$ is $a_1, a_2, \ldots, a_n$ and the number of nonzero entries is the rank of $A$, similarly for $B$.

The matrices $R, C$ are invertible, so $0=AB=RA'B'C$ implies $0=A'B'$. The product $A'B'$ is a diagonal matrix with entries $a_1b_1, a_2b_2, \ldots a_nb_n$, all of them have to be zero, so $\text{rank}\,A+\text{rank}\,B\le n$ follows.