# Density of random matrix only depends on its spectrum

Suppose a random positive definite matrix $$A\in\mathbb{R}^{n\times n}$$ has density function (with respect to the lebesgue measure on $$\mathbb{R}^{n(n+1)/2}$$) $$f(A)=g(\lambda_1(A),...,\lambda_n(A))$$ where $$g$$ is a function invariant under permutation of coordinates and $$\lambda_1(A),...,\lambda_n(A)>0$$ are eigenvalues of $$A$$, i.e. the density of $$A$$ only depends on its spectrum. Examples include Wishart distribution (with identity covariance), matrix beta distribution, etc.

Now, we construct another random matrix in the following way: first generate a diagonal matrix $$\Lambda$$ such that the joint distribution of the diagonal elements is the same as the joint distribution of the eigenvalues of $$A$$; second we generate an orthogonal matrix $$P\in O(n)$$ uniformly and INDEPENDENT of $$\Lambda$$; then we set $$B=P\Lambda P^T$$.

Now my question is that is the distribution of $$B$$ the same as the distribution of $$A$$? If it is true, how do we prove it? It seems obvious but I do not know how to rigorously justify it.

Update: Thank @Iosif Pinelis for giving an counter example! A further question is that, do the diagonal elements of $$B$$ have the same distribution as $$A$$'s diagonal elements?

• Density function with respect to what measure? – Iosif Pinelis May 1 at 23:42
• Lebesgue measure on $\mathbb{R}^{n(n+1)/2}$. – neverevernever May 1 at 23:44
• @AnthonyQuas : Of course, I agree with your "no hope" comment. However, I think here we cannot just take a density supported on a small neighborhood, because the density has to depend only on the spectrum. – Iosif Pinelis May 2 at 2:40

$$\newcommand{\tr}{\operatorname{\mathrm tr}} \newcommand{\R}{\mathbb{R}}$$ The answer is (of course) no (because the Lebesgue measure on the set $$\mathbb{R}^{n(n+1)/2}$$ of all possible vectors corresponding to on-and-above-diagonal part of the symmetric matrix $$A$$ has little to do with with the spectrum of the matrix $$A$$).

E.g., let $$n=2$$ and write $$A=\begin{bmatrix}a&b\\b&c\end{bmatrix}$$. The condition that $$A$$ is positive definite means exactly that $$\tr A=a+c>0$$ and $$\det A=ac-b^2>0$$. Suppose that $$\begin{equation} f(A)=f_A(a,b,c):=kI\{0<\tr A<1,\det A>0\}=kI\{0 where $$I$$ denotes the indicator and $$k:=\frac{12}\pi$$, the normalizing factor that makes $$f$$ a probability density with respect to the Lebesgue measure on the set $$\mathbb{R}^{2(2+1)/2}=\mathbb{R}^3$$ of all triples $$(a,b,c)$$. Moreover, $$f$$ depends on $$A$$ only through the spectrum of $$A$$.

The expected value of the product of the diagonal entries $$a,c$$ of $$A$$ is $$\begin{equation} EA_{11}A_{22}=\iiint\limits_{\R^3}ac f_A(a,b,c)\,da\,dc\,db=\frac9{80}. \end{equation}$$

We may write the orthogonal random matrix $$P$$ as $$R_T$$, where $$T$$ is independent of $$A$$ and uniformly distributed in the interval $$[0,2\pi)$$, and $$R_t=\begin{bmatrix}\cos t&-\sin t\\\sin t&\cos t\end{bmatrix}$$. The product of the diagonal entries of $$B=R_T\Lambda R_T'$$ is $$\begin{equation} B_{11}B_{22}=\tfrac18\, [a^2+c^2 - b^2 + 6 a c - ((a-c)^2+ b^2) \cos4 t]. \end{equation}$$ Hence, \begin{align} EB_{11}B_{22}&=\int_0^{2\pi}\frac{dt}{2\pi}\iiint\limits_{\R^3}B_{11}B_{22} f_A(a,b,c)\,da\,dc\,db =\frac{81}{640}\ne\frac9{80}=EA_{11}A_{22}. \end{align} Thus, (the diagonal entries of) the random matrices $$A$$ and $$B$$ are not equal in distribution.

• Thank you! The question is that it does not seem to be possible for $(tr(A),det(A))$ to be uniformly distributed on the unit square since we always have $\sqrt{det(A)}\leq\frac{tr(A)}{2}$ when $n=2$. – neverevernever May 2 at 2:57
• @neverevernever : I have removed the "uniform" comment, and this does not change the substance of the answer. The comment was indeed somewhat ambiguous, though, because $f_A$ is, in the final analyis, a function of three arguments ($a,b,c$), rather than two ($\text{tr}\, A$, $\det A$). Of course, the distribution of $A$ is not actually uniform in ($\text{tr}\, A$, $\det A$) -- otherwise, instead of the factor $k$ we would just have $1$. However, the important fact is that $f_A$ depends on $a,b,c$ only through $\text{tr} A$ and $\det A$, and hence only through the spectrum of $A$. – Iosif Pinelis May 2 at 3:17
• That is very helpful! What if I'm only interested in the diagonal part? Is it possible for the diagonal element of $B$ to have the same distribution as $A$'s? – neverevernever May 2 at 3:25
• I have not computed the distribution of a diagonal element, but I'd expect, for the same reasons (of the apparent incompatibility of the Lebesgue measure with spectral matters), that the answer will be again no, even in the same example. You can also modify this example by using other nonnegative functions of $\text{tr}\, A$ and $\det A$. Also, in general, if you have further questions, in addition to the posted and answered one, it is best to ask the additional questions in separate posts. – Iosif Pinelis May 2 at 3:33
• I have now provided a simpler version of the answer, with much simpler calculations, which also show that the diagonal entries of $B$ are not equal in distribution to those of $A$. – Iosif Pinelis May 2 at 12:43