When do addition and inversion of matrices commute?

Can you guys help me out with the following problem:

Problem: Find conditions that the matrices $A$ and $B$ have to satisfy in order for the following to be valid: $(A+B)^{-1} = A^{-1} + B^{-1}$.

My solution. The first condition is that $A$ and $B$ have to have the same dimensions. Then by expanding the two equalities: $(A+B) \cdot (A^{-1} + B^{-1})=I$ and $(A^{-1} + B^{-1}) \cdot (A+B)=I$, I deduced the second condition: $A$ and $B$ have both to be invertible, and third condition is: $A^{-1} \cdot B=B \cdot A^{-1}$. Is my answer correct?

-
Please don't put general subjects like "linear algebra" into the titles; that's what the tags are for. – joriki Oct 29 '11 at 17:39
A = 1, B = 2. All your conditions hold, but $(1+2)^{-1} \neq 1^{-1} + 2^{-1}$. Its quite simple to check. – Mikael Öhman Oct 29 '11 at 17:53
In general two matrices are not necessary commutative. – Hassan Muhammad Oct 29 '11 at 17:54
Then, what are the conditions on A and B? any hint? – M.Krov Oct 29 '11 at 18:07
$(A+B)^{-1}(A^{-1} + B^{-1})$ $= AA^{-1} + AB^{-1} + BA^{-1} + BB^{-1}$ $=I + AB^{-1} + BA^{-1} + I$. If this is equal to $I$, then $I + AB^{-1} + BA^{-1}=0$. So you'd need $AB^{-1} + BA^{-1}=-I$. That's trivially equivalent to what you want. Solving in a reasonable way for $A$ and $B$ would take more work. One solution for $1\times1$ matrices is $A= (-1+\sqrt{3})/2$ and $B=1$. – Michael Hardy Oct 29 '11 at 18:19

To elaborate slightly on @MichaelHardy's comment, from:

$$A\;B^{-1} + B\;A^{-1} = -I$$

consider as well that:

$$(A\;B^{-1})^{-1} = B\;A^{-1}$$

So when we are talking about all possible solutions, these can be generated by finding $M$ such that:

$$M + M^{-1} = -I$$

i.e. an invertible matrix $M$ such that:

$$M^2 + M + I = 0$$

Then if $M$ has the corresponding characteristic root(s), any invertible matrix $B$ can be paired with an invertible matrix $A$ satisfying the desired relation via:

$$A = MB$$

so that $M = A\;B^{-1}$ and $M^{-1} = B\;A^{-1}$.

Added: A few more words about $M$ and its characteristic roots are useful.

Because it satisfies the polynomial above without repeated roots, complex matrix $M$ must be diagonalizable (similar to a diagonal matrix) with eigenvalues in $\{ (-1 \pm i\sqrt{3})/2 \}$, the nontrivial cube roots of unity. So to construct all such $M$, choose how many of each root so that combined we have $n$ the dimension of $M$, and group them along the diagonal of $D$ having those with positive imaginary part before those with negative imaginary part (for the sake of definiteness). Then take for arbitrary invertible complex matrix $P$ the similarity transformation:

$$M = P\; D \; P^{-1}$$

If we wanted to restrict $M$ to real matrices, then its eigenvalues must occur in conjugate pairs. Thus the dimension $n$ must be even and the "real Jordan canonical form" must have diagonal blocks $\bigl(\begin{smallmatrix} \frac{-1}{2}&\frac{\sqrt{3}}{2} \\ \frac{-\sqrt{3}}{2}&\frac{-1}{2} \end{smallmatrix} \bigr)$. Replace $D$ with such a block diagonal matrix and $P$ with an arbitrary invertible real matrix in our above similarity recipe, and you get the construction of all real solutions $M$.

-

For third condition you have that:

$(A+B)(A+B)^{-1}=(A+B)(A^{-1}+B^{-1})$

$(A+B)^{-1}(A+B)=(A^{-1}+B^{-1})(A+B)$

$\Rightarrow (A+B)(A^{-1}+B^{-1})=(A^{-1}+B^{-1})(A+B)\Rightarrow$

$\Rightarrow AA^{-1}+AB^{-1}+BA^{-1}+BB^{-1}=A^{-1}A+A^{-1}B+B^{-1}A+B^{-1}B \Rightarrow$

$\Rightarrow AB^{-1}+BA^{-1} =A^{-1}B+B^{-1}A$

-
And, to test if these 3 conditions are enough, you assume all of them are true and see if you can prove the original statement – Graphth Oct 29 '11 at 18:17