9

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.)

user26857
  • 52,094
ovgolovin
  • 323
  • 7
    Hint: you can do this with two-by-two matrices. Look for $A$, $B$ such that $AB=0$ but $BA \neq 0$. – Chris Eagle Oct 31 '11 at 22:31
  • Try working with a single column full of $1$s and $0$s and a single row full of $1$s and $0$s. For ease, perhaps do the case where each is $2\times 1$ or $1\times 2$. – Jason DeVito - on hiatus Oct 31 '11 at 22:32
  • Why do you think that this seems not to be true? To prove that something is not true in general, you need to find a single counterexample... – N. S. Oct 31 '11 at 22:32
  • An other question is: determine $\max_{A\in\mathcal M_{n,p}(\mathbb R),B\in\mathcal M_{p,n}(\mathbb R)}\operatorname{rank}(A\cdot B)-\operatorname{rank}(B\cdot A)$ in terms of $n$ and $p$. – Davide Giraudo Oct 31 '11 at 22:52
  • @JasonDeVito Thanks for the hit. I made an answer basing on it. Still, I want some intuition why it's so. We can look on the first matrix in a multiplication as on some operator. And why if A operates on B the rank is r1 and when B operates on A is r2, and r1 is not equal to r2. The proof is a good thing, but it'll be forgotten over time. And only intuition is what will be carried over time. – ovgolovin Oct 31 '11 at 22:55
  • @ovgolovin: Try first matrix first column $0$'s, second column $1$'s; second matrix first row $1$'s, second row $0$'s. (I prefer square matrices.) – André Nicolas Oct 31 '11 at 23:37
  • @AndréNicolas Thanks! I updated the answer. It worked. The only thing left that I can't understand is why the rank changes. – ovgolovin Oct 31 '11 at 23:46
  • Note that it is true for full rank (look at the determinant). Also note that it can be instructive to regard functions of finite sets and cardinalities instead of matrices and dimensions. Do you understand the analogous question in that case? – Phira Oct 31 '11 at 23:54
  • @Phira I can barely understand what you write. – ovgolovin Nov 01 '11 at 00:05
  • @ovgolovin Can you be more specific? – Phira Nov 01 '11 at 00:07
  • I think Phira may be suggesting the following: let $S$ be a finite set, let $f$ and $g$ be functions from $S$ to $S$; must the range of the composition of $f$ and $g$ have the same size as the range of the composition of $g$ and $f$? If you can understand what's going on there, it may give you some insight into what's happening with the matrices. – Gerry Myerson Nov 01 '11 at 00:13
  • @GerryMyerson Thank you. I seem to understand now. – ovgolovin Nov 01 '11 at 13:53
  • @Phira My lack of ability to anderstand was primarily connected with the terms in English which I couldn't comprehend (English is not my native language): "full rank", "regard" in this meaning, finite sets; cardinality; dimensions. I may know these terms in my native language, but here in English they were beyond my ability to comprehend. Now with Gerry Myerson's explanation I seem to understand that the order of function application matters and the size of resultant range may differ. – ovgolovin Nov 01 '11 at 13:53

3 Answers3

16

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$.

André Nicolas
  • 507,029
12

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)$.

user26857
  • 52,094
ovgolovin
  • 323
9

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] $$

Robert Israel
  • 448,999
  • Thank you for the answer. I even started watching videos on the Khan Academy site about the nullspace of a matrix after reading you answer! After watching this video I'll recur to your answer and hope I'll managed to grasp it completely. – ovgolovin Nov 01 '11 at 23:26
  • Awesome answer! – krianaaa May 29 '22 at 19:10