# If $A$ and $B$ are positive semidefinite matrices such that $A^2 = B^2$, show $A = B$

Problem: If $A$ and $B$ are positive semidefinite matrices such that $A^2 = B^2$, show $A = B$, where $A, B$ are $n$-by-$n$ matrices.

This problem is taken out of Linear Algebra (4th edition) by Friedberg, Insel, and Spence.

EDIT: Problem is in Section $6.4$ number $17(d)$

Before posting my question, I looked at this specific question on the website: $A,B\in L(X)$ is positive semidefinition hermitian operators and $A^2=B^2$, then $A=B.$

This seems like the answer draws from materials outside this textbook. I am not familiar with the square root of a matrix as denoted in that thread. This is not a homework question, but I suspect that there should be a shorter and simpler proof (whether there is one or not) that does not draw materials outside of this textbook.

However, I am stumped as to show how given the hypothesis above (been at it for an hour), how I can deduce that $A = B$. I also attempted to show the contraposition but I am uncertain as how to proceed other than using the fact that there exists an orthonormal basis $\beta$ for $\mathbb{R}^n$ consisting of eigenvectors of $A$ since it is symmetric.

I would appreciate it if anyone can point me in the right direction.

## 3 Answers

I'll assume the underlying space is $\mathbb{R}^{N}$ as you had done, but the arguments are essentially unchanged for $\mathbb{C}^{N}$. Assume $A$, $B$ are positive semidefinition with $A^{2}=B^{2}$. Then $A$ and $B$ have orthonormal bases of eigenvectors.

Let $\{ x_{1},x_{2},\cdots, x_{N}\}$ be an orthonormal basis of eigenvectors for $A$ with corresponding eigenvalues $\lambda_{j} \ge 0$. If $\lambda_{j}=0$ for some $j$, then $Ax_{j}=0$ which implies $B^{2}x_{j}=0$, and $$0 = x_{j}^{\perp}B^{2}x_{j} = (Bx_{j})^{\perp}(Bx_{j}) \implies Bx_{j}=0.$$ The converse is also true: If $Bx_{j}=0$, then $Ax_{j}=0$. So $\mathcal{N}(B)=\mathcal{N}(A)$. If $\lambda_{j}\ne 0$, then $$B^{2}x_{j}=A^{2}x_{j}=\lambda_{j}^{2}x_{j}.$$ Let $x_{j}=x_{j}^{+}+x_{j}^{-}$ where $$x_{j}^{+} = \frac{1}{\lambda_{j}}(\lambda_{j}I+B)x_{j},\;\;\; x_{j}^{-} = \frac{1}{\lambda_{j}}(\lambda_{j}I-B)x_{j}.$$ Then $B x_{j}^{+}=\lambda_{j}x_{j}^{+}$ and $Bx_{j}^{-}=-\lambda_{j}x_{j}^{-}$. Because $B$ is positive semidefinite, then $x_{j}^{-}=0$, which gives $$0 = x_{j}^{-} = \frac{1}{\lambda_{j}}(\lambda_{j}I-B)x_{j} \implies Bx_{j}=\lambda_{j}x_{j}.$$ Therefore $Bx_{j}=Ax_{j}$ for all $j$, which proves that $B=A$.

• I take it that symbol $\perp$ is the conjugate transpose. In the first line, would it be $(Bx_j)^{\perp}(Bx_j) = 0$. Thanks again T.A.E. This helped out a lot. – MathNewbie Nov 9 '14 at 9:05
• @MathNewbie : You're welcome. Yes, in the first line, that's what it would be. I fixed that now. – DisintegratingByParts Nov 9 '14 at 12:57

Lemma: If $A$ and $B$ have different eigenvalues, then $X=0$ is the unique solution of the matrix equation $AX=XB.$

Proof: $AX=XB \implies p(A) X=X p(B)$ , for some polynomial $p(t)$. Especially, let $p(t)$ be the characterisitic polynomial of $A$, $\space f_A (t)=\operatorname{det}(t I -A)$. Since $A$ and $B$ have distinct eigenvalues, $\space f_A (B)$ is invertible, while $f_A (A) =0$ thanks to the Cayley-Hamilton theorem. Consequently, $X=0.$

Now we can address the original problem: $A^2=B^2 \implies A(A-B)=(A-B)(-B)$, and, since both $A$ and $B$ are positive semidefinite, the eigenvalues of $A$ and $-B$ are different (but I think it is necessary that at least one of the matrices is invertible, otherwise counterexamples would appear). Thus, $A-B=0$.

• This is a nice proof for positive definite matrices. However as you noted it has problem with eigenvalues$~0$, whereas the result does hold in the semi-definite case (note that $A^2=B^2$ with $A,B$ real symmetric implies $\ker A=\ker A^2=\ker B^2=\ker B$). – Marc van Leeuwen Nov 9 '14 at 13:06

Using just that positive semi-definite (symmetric) matrices are diagonalisable with real non-negative eigenvalues, you can reason as follows.

The vector space decomposes as sum of eigenspaces for $A$ for various eigenvalues $\lambda\geq0$, and such an eigenspace is contained in the eigenspace for$~A^2$ for the eigenvalue$~\lambda^2$. But since all those eigenvalues are distinct (which is where $\lambda\geq0$ is used), this is in fact an eigenspace decomposition for $A^2$. Since the same is true for $B$ in the place of $B$, we see that $A$ and $B$ have the same eigenvalues with identical eigenspaces; it follows that $A=B$. (One may compare matrices after change of basis to a basis of common eigenvectors.)