A $2\times 2$, real, symmetric random matrix $M$ is provided with diagonal entries $M_{11}$ and $M_{22}$ following independent normal distributions $N(0,1)$ and off-diagonal entries $M_{12}=M_{21}$ following normal distribution $N(0,1/2)$.
What's the distribution and the mean of the absolute value of the difference between its two eigenvalues $\Delta E$ ?
Attempt :
The eigenvalues satisfy equation $x^2-Tx+\Delta=0$ where $T$ and $\Delta$ denote the trace and determinant of said matrix, respectively.
Therefore, $x_{\pm}=\frac 12(T\pm\sqrt{T^2-4\Delta})$ and $\Delta E=\sqrt{T^2-4\Delta}=\sqrt{(A-D)^2+4BC}$
($A=M_{11}, B=M_{12}, C=M_{21}, D=M_{22})$
$A$ and $D$ are two independent Gaussian variables with mean $0$ and variance $1$, therefore $A-D$ is a Gaussian random variable with mean $0$ and variance $2$, $N(0,2)$.
$B=C$ is a Gaussian random variable with mean $0$ and variance $1/2$
Therefore, $4BC=\frac1416B^2=\frac14(4B)^2$ with $4B \sim4N(0,1/2)=N(0,2)$
So, $\Delta E \sim\sqrt{N(0,2)^2+\frac14N(0,2)^2}=\sqrt{\frac54 N(0,2)^2}=\sqrt{N(0,\sqrt{5})^2}=|N(0,\sqrt{5})|$
This happens to be a folded normal distribution with $\mu=0$ and $\sigma=\sqrt{\sqrt{5}}$
So the mean should be $\sqrt{\frac{2\sqrt{5}}{\pi}}\approx 1.1931$.
However, the following MATLAB code seems to suggest otherwise :
for i=1:1e+5
M(1,1)=normrnd(0,1);
M(2,2)=normrnd(0,1);
M(1,2)=normrnd(0,1/2);
M(2,1)=M(1,2);
ei=eig(M);
tab(i)=abs(ei(1)-ei(2));
end
mean(tab)
returns $1.5241$
Am I handling distributions wrongly again ?
Context : lonely physics student who wanted to learn maths, uni says it's useless for a physicist and that adults learn by themselves, gives (ungraded) exercises to train instead, but I can't do a single one correctly, despite spending a whole day on the first question of a single problem. Can't improve no matter what. Work hard and you'll get there, they said. $\text{*roll eyes*}$
I presume that $M_{12}$ is a Gaussian random variable with mean $0$ and variance $1/2$ (not SD!) and is independent on $M_{11}$ and $M_{22}$. Then $$\Delta E=\sqrt{T^2-4\Delta}=\sqrt{(A-D)^2+4BC}=\sqrt{X^2+Y^2},$$ where $X=(A-D)$ is also a Gaussian random variable with mean $0$ and variance $2$, $N(0,2)$, and $Y=2M_{12}$ is a Gaussian random variable with mean $0$ and variance $2^2\cdot \frac12=2$. Since $X$ and $Y$ are independent, $\dfrac{X}{\sqrt2}$ and $\dfrac{Y}{\sqrt2}$ are standard Gaussian, then $$ \dfrac{X^2+Y^2}{2} \sim \chi^2_2=Exp(\frac12), $$ where $\chi^2_2$ is the chi-squared distribution with $2$ degrees of freedom. This distribution is exactly the same as the Exponential distribution with mean $2$.
Then $$\Delta E=\sqrt{X^2+Y^2}=\sqrt{2Exp(\frac12)}=\sqrt{Exp(\frac14)}.$$
If you need mean value, calculate $$E(\Delta E)=\int_0^\infty \sqrt{x} \frac14 e^{-\frac14x}\,dx=\sqrt{\pi}\approx 1.77245.$$
If you ask
M(1,2)=normrnd(0,1/2)in Matlab, you generate $N(0,1/4)$. To generate $N(0,1/4)$, writeM(1,2)=normrnd(0,1/sqrt(2))and compare results.To find distribution of $\Delta E=\sqrt{Exp(\frac14)}$ write CDF for $y>0$: $$F_{\Delta E}(y)=P(\sqrt{Exp(\frac14)}\leq y)=P(Exp(\frac14)\leq y^2)=1-e^{-\frac{y^2}{4}}. $$ The probability density function is $$ f_{\Delta E}(y)=\frac{y}{2}e^{-\frac{y^2}{4}},\quad y>0. $$