Let $A,B$ be $n \times n$ matrices and $AB=BA$. Show that $$\text{rank}(A+B) \leq \text{rank}(A) + \text{rank}(B) - \text{rank}(AB)$$
Attempt at the solution:
I first proved that $$R(A+B) \subseteq R(A) + R(B)$$ where R(A) is Range(A). Then I used the dimension formula that states that $$\dim(U+V) = \dim(U) + \dim(V) - \dim(U \cap V)$$ so that I get $$r(A+B) \leq r(A) +r(B) - \dim(R(A)\cap R(B))$$
The last part would be to show that $$\dim(R(A)\cap R(B)) = \dim(R(AB))$$ using the fact that $AB=BA$.
I need help with this last part. Also please critique me if the above solution is acceptable or if there is something wrong with it.
Thank you!!
You do not need $\dim(R(A)\cap R(B)) = \dim(R(AB))$. All you need is $\dim(R(A)\cap R(B)) \ge \dim(R(AB))$, which is easy to prove using $AB=BA$.