# Relationship between $A$ and $B$ where $A D A^T = B D B^T$.

Let $$C$$ be a real-valued positive semidefinite matrix with eigendecomposition, $$C = A D A^T,$$ so that $$A$$ is orthonormal and $$D$$ is diagonal.

If it can be shown that $$C = B D B^T,$$ what can be said about the relationship between $$A$$ and $$B$$? It is obvious that $$A$$ and $$B$$ are not necessarily equivalent since $$B = -A$$ also works, but are there any other cases?

• Since you write transpose, are you asking your question for matrices with real entries in particular? Dec 1, 2023 at 2:21
• Sorry for delayed response, yes these are real valued matrices. Dec 1, 2023 at 4:50
• Please do not leave the necessary information only in the comment. Edit your question to clarify. By the way, the standard terminology for a real square matrix with orthonormal columns is orthogonal matrix, not orthonormal matrix. Dec 1, 2023 at 8:59

$$\def\ed{\stackrel{\text{def}}{=}}$$ There are certainly many other possibilities for $$\ B\$$ besides $$\ {-}A\$$, even when $$\ C\$$ is a positive definite matrix with distinct eigenvalues. Suppose the dimensions of $$\ C\$$ are $$\ n\times n\ ,$$ that it has rank $$\ n-r\ ,$$ and that the dimensions of its eigenspaces corresponding to its distinct non-zero eigenvalues, $$\ \lambda_1<\,\lambda_2<\,\dots<\,\lambda_k\ ,$$ are $$\ d_1,d_2,\dots,d_k\ .$$ Let $$\ \lambda_0\ed0\ ,$$ and $$\ d_0\ed r\$$ be the dimension of the nullspace of $$\ C\$$ (which might be $$\ 0\$$). Let $$\ P\$$ be an $$\ n\times n\$$ permutation matrix such that $$P^TDP=\pmatrix{\text{diag}\big(\mu_1,\mu_2,\dots,\mu_{n-r}\big)&0_{n-r\times r}\\ 0_{r\times n-r}&0_{r\times r}}\ ,$$ with $$\ \mu_1=\lambda_1\le\mu_2\le\dots\le\mu_{n-r}=\lambda_k\ .$$ In the case when $$\ r=0\$$, the last $$\ r\$$ rows and columns of the above matrix are to be regarded as absent. Let $$\Gamma\ed\pmatrix{ \begin{array}{c|c} \matrix{B_1&0_{d_1\times d_2}&\dots&0_{d_1\times d_k}\\0_{d_2\times d_1}&B_2&\dots&0_{d_2\times d_k}\\\vdots&&\ddots&\vdots\\0_{d_k\times d_1}&0_{d_k\times d_2}&\dots&B_k}&0_{n-r\times r}\\ \hline 0_{r\times n-r}&B_0 \end{array}}$$ where each $$\ B_i\$$ is an arbitrary $$\ d_i\times d_i\$$ orthogonal matrix$$\left.^\color{red}{\dagger}\right.$$ for $$\ i\ne0\ ,$$ and $$\ B_0\$$ is any non-singular $$\ r\times r\$$ matrix whatsoever if $$\ r>0\ .$$ Then \begin{align} P\Gamma^T\pmatrix{\text{diag}\big(\mu_1,\mu_2,\dots,\mu_{n-r}\big)&0_{n-r\times r}\\ 0_{r\times n-r}&0_{r\times r}}\Gamma P^T&=P\pmatrix{\text{diag}\big(\mu_1,\mu_2,\dots,\mu_{n-r}\big)&0_{n-r\times r}\\ 0_{r\times n-r}&0_{r\times r}}P^T\\ &=D\ , \end{align} or, putting $$\ G\ed\Gamma^{-1}\ ,$$ $$\pmatrix{\text{diag}\big(\mu_1,\mu_2,\dots,\mu_{n-r}\big)&0_{n-r\times r}\\ 0_{r\times n-r}&0_{r\times r}}=G^TP^TDPG\ .$$ Therefore, \begin{align} APG^TP^TDPGP^TA^T&=AP \pmatrix{\text{diag}\big(\mu_1,\mu_2,\dots,\mu_{n-r}\big)&0_{n-r\times r}\\ 0_{r\times n-r}&0_{r\times r}}P^TA^T\\ &=ADA^T\\ &=C\ , \end{align} and $$\ B=APG^TP^T\$$ is another matrix for which the identity $$\ C=\,BDB^T\$$ holds.

In the case when $$\ C\$$ is positive definite and has distinct eigenvalues, $$\ r=0\ ,$$ and for all $$\ i>0\$$ $$\ B_i\$$ is a $$\ 1\times1\$$ matrix. Nevertheless, every entry on the diagonal of the diagonal matrix $$\ PG^TP^T\$$ can be either $$\ {+}1\$$ or $$\ {-1}\$$. Even in this case, therefore, if $$\ B\$$ is a matrix obtained from $$\ A\$$ by multiplying an arbitrary selection of its columns by $$\ {-1}\ ,$$ then $$\ B\$$ will still satisfy the identity $$\ C=\,BDB^T\ .$$

$$\left.^\color{red}{\dagger}\right.$$ Note that, by definition, this means that $$\ B^T=B^{-1}\$$—that is, the rows and columns of $$\ B\$$ are normalised as well as orthogonal to each other.

• Fascinating. This is a very helpful answer, that I need to review in a little bit more detail. Given a $B$ that satisfies $C = B D B^T$, is it possible to recover $A$? Or if not, can we recover a matrix $B'$ such that the first $m$ columns of $A$ and $B'$ have the same column space for every $m \leq n$? Let me know if you think I should post this as a new question. Dec 1, 2023 at 15:08

If we weaken the hypothesis to complex matrices, then we have spectral decompositions as $$C=UDU^*$$, where $$U$$ is a unitary matrix. Rewriting, $$CU=UD$$ shows that the column vectors of $$U$$ must be eigenvectors for the corresponding eigenvalues.

In fact, you can swap one out for a different eigenvector for the same eigenvalue as long as you are being careful that you are not reducing the span of the eigenvectors, because for $$U$$ to be invertible they need to form a basis. So a safe way to do it is choose any eigenbasis, and arrange them in a way corresponding to their eigenvalues in $$D$$, this should give you a valid unitary (of course, your vectors should be normalized) $$U$$ such that $$C=UDU^*$$

The reason I mentioned complex entries is that there is a lot more freedom to work with, and I am not sure if orthogonal diagonalizable real matrices with real eigenvalues necessarily have an eigenbasis with real eigenvectors. (I searched it up and saw that it is possible to get to real eigenvectors given complex ones but I am not sure if there is a way to do it which preserves the fact that the original set was not arbitrary but in fact a basis). My answer should still mostly hold for real matrices as well.

The point is that the columns in $$A$$ or $$B$$ corresponding to a particular eigenvalue will form a basis for the corresponding eigenspace, so combining them gives a basis for the entire space.