Is the rank of $AB$ always equal to the rank of $BA$?

I know that matrix multiplication is not commutative: $ AB \neq BA$.

Still, it may be possible that $\operatorname {rank} (AB) = \operatorname {rank} (BA)$. But it seems to be not true.

How can it be proved that $ \operatorname {rank} (AB) \neq \operatorname {rank} (BA)$?

(Usually it's not a big deal to prove a negative statement since it only take to find one example when the equality is not satisfied.)


Solution 1:

Let $A=\pmatrix{0&1\\0&0}$ and let $B=\pmatrix{1&0\\0&0}$. These are matrices of simple geometric transformations.

If $v$ is a point in the plane, viewed as a vector, then $Bv$ is the projection of $v$ on the $x$-axis.

And if $w$ is a point in the plane, then $Aw$ is projection onto the $y$-axis, followed by reflection in the line $y=x$.

Now look at $A(Bv)$. We have (i) projected $v$ onto the $x$-axis, and then (ii) projected the result onto the $y$-axis, then reflected in the line $y=x$. Before the reflection, we are already at $(0,0)$, so $AB$ kills every vector.

Look next at $B(Av)$. If the $y$-component of $v$ is non-zero, $Av$ is a non-zero point on the $x$ axis, and the projection $B$ does nothing to $Av$. Thus $B(Av)$ is not the $0$-vector for "most" $v$.

Solution 2:

To prove that $ \operatorname {rank} ( AB) \not= \operatorname {rank} ( B A) $ we just need to find an example when the equality is not satisfied.

As suggested in the comments to the answer, let's take $ A = \begin{pmatrix} 0 & 1\\ 0 & 1 \end{pmatrix} $ and $ B = \begin{pmatrix} 1 & 1\\ 0 & 0 \end{pmatrix} $.

$ AB = \begin{pmatrix} 0 & 0\\ 0 & 0 \end{pmatrix} $; $ \operatorname {rank} ( AB) = 0 $.

$ BA = \begin{pmatrix} 0 & 2\\ 0 & 0 \end{pmatrix} $; $ \operatorname {rank} ( BA) = 1 $.

The ranks don't match, so $\operatorname {rank} ( AB) \not= \operatorname {rank} ( BA)$.

Solution 3:

You asked for "intuition". One way of looking at it is this.
An $m \times n$ matrix $A$ operates on $n$-dimensional vectors, taking them to $m$-dimensional vectors. The rank $r_A$ of $A$ is the dimension of the range of $A$, and is also $n$ minus the dimension of the kernel of $A$. That is, you start with $n$ linearly independent vectors $v_j$ spanning ${\mathbb R}^n$; the images $A v_j$ of them under $A$ are not linearly independent, because there are $k$ independent relations between them corresponding to the dimension of the kernel of $A$, so we have only $r_A = n - k$ linearly independent vectors spanning the range of $A$. Now in $BA$, $B$ operates on these vectors so the rank of $BA$ is the number of linearly independent vectors in the range of $BA$. This is reduced from $r_A$, not by the dimension of the kernel of $B$, but by the dimension of the intersection of the kernel of $B$ with the range of $A$. That is, $\text{rank}(BA) = \text{rank}(A) - \dim(\ker (B) \cap \text{range}(A))$. Similarly ($B$ being $n \times m$ so that $AB$ and $BA$ both make sense) $\text{rank}(AB) = \text{rank}(B) - \dim(\ker(A) \cap \text{range}(B))$. And there is no reason for these to be the same.

Indeed, given $n$ and the ranks of $A$ and $B$, $\ker(A)$ and $\text{range}(B)$ can be any subspaces of ${\mathbb R}^n$ of dimensions $n - \text{rank}(A)$ and $\text{rank}(B)$ respectively, and their intersection can have any dimension from $\max(\text{rank}(B) - \text{rank(A)},0)$ to $\min(n - \text{rank}(A),\text{rank}(B))$.

For example, if $m=n = 5$ and $\text{rank}(A) = \text{rank}(B) = 3$, $\dim(\ker(A) \cap \text{range}(B)$ can have any dimension from 0 to 2, making $\text{rank}(AB)$ anything from 1 to 3, and similarly $\text{rank}(BA)$ can be anything from 1 to 3. To get an example with $\text{rank}(AB) = 3$ and $\text{rank}(BA) = 1$, you want $\ker(A)$ and $\text{range}(B)$ to be subspaces of ${\mathbb R}^5$ of dimensions 2 and 3 respectively with intersection of dimension 0, while $\ker(B)$ and $\text{range}(A)$ are subspaces of dimensions 2 and 3 with intersection of dimension 2. If $e_1$ to $e_5$ are the standard basis vectors of ${\mathbb R}^5$, you could for example have $\ker(A) = \text{span}(e_1,e_2)$ while $\ker(B) = \text{span}(e_4,e_5)$ with $\text{range}(A) = \text{range}(B) = \text{span}(e_3, e_4, e_5)$. Thus we could have $$ A= \left[ \begin {array}{ccccc} 0&0&0&0&0\\ 0&0&0&0&0 \\ 0&0&1&0&0\\ 0&0&0&1&0 \\ 0&0&0&0&1\end {array} \right], \ B = \left[ \begin {array}{ccccc} 0&0&0&0&0\\ 0&0&0&0&0\\ 1&0&0&0&0\\ 0&1&0&0&0 \\ 0&0&1&0&0\end {array} \right] $$