16

Suppose $A$ is symmetric positive definite matrix. Is there a nice expression for the first moment of the following quantity?

$$\frac{x^TAx}{x^TA^2 x}$$

Where $x$ is distributed as $\text{Normal}(0,I_n)$. This is the ratio of two quadratic forms evaluated on the surface of the sphere.

When $A$ has eigenvalues $\langle 1, \frac{1}{2}\rangle$, this expectation is equal to $\frac{4}{3}$, visualized below (notebook)

enter image description here

Edit Aug 18 To expand on hyperplane's answer, we can take $A$ to be diagonal without loss of generality and write solution as

$$E\left[\frac{x^TAx}{x^TA^2 x}\right]=\langle a, z\rangle$$

Where $$\begin{align} a_i=&\frac{1}{A_{ii}}\\ z_i=&E_{y\sim\mathcal{N}(0,A)} \frac{y_i^2}{\|y\|^2} \end{align} $$

Yaroslav Bulatov
  • 5,167
  • 2
  • 24
  • 38
  • 1
    Thanks: in other words, we may reduce the problem to where $x$ is *uniformly* distributed on the sphere's surface. – whuber Aug 10 '21 at 14:48
  • Associated Q: https://mathoverflow.net/questions/402894/average-value-of-fracxa2xxa3x-over-surface-of-n-dimensional-sphere – kjetil b halvorsen Sep 01 '21 at 13:52

2 Answers2

11

For symmetric matrices $A, B$, the quantities $\mathcal R_A(x) = \frac{x^T A x}{x^T x}$ and $\mathcal R_{A, B}(x) = \frac{x^T Ax}{x^TBx}$ are known as the (generalized) Rayleigh quotient. A question about this was already asked here: Distribution of the Rayleigh quotient or here Expected value of Rayleigh quotient

The accepted answer refers to the 1992 book Quadratic Forms in Random Variables by Mathai and Provost.

There, on page 144, we are referred to the 1956 paper Quadratic Forms in Normally Distributed Random Variables by Gurland, where the distribution and the expectation of the generalized Rayleigh Quotient are discussed. Among other things, the author shows:

$$ \mathbf E\left[\frac{x^T Ax}{x^TBx}\right] = \sum_{j=0}^{n-1} \sum_{k=0}^{\infty} \frac{(-1)^{j+1}}{2^{j+2} v^{j+k+1}}c_{j} g_{k} B\left(j+k+1, \frac{3 n}{2}-j-1\right) $$

Here, $B(x, y)$ is the Beta Function and $v$, $c_j$ and $g_k$ are coefficients related to eigenvalues/characteristic polynomials of $A$ and $B$.

There are many other references giving different series/integral expansions/representations for the moments of $\mathcal R_{A, B}(x)$

None of which indicate that there is a general simple "closed form" for $\mathbf E[\mathcal R_{A, B}(x)]$.


Some simplification steps we can do in any case, given Eigenvalue Decomposition $B=U^T\Lambda U$:

$$ \mathbf E_{x\sim\mathcal N(0,)}\left[\frac{x^T Ax}{x^TBx}\right] = \mathbf E_{y\sim\mathcal N(0,)}\left[\frac{y^TU^T AUy}{y^T \Lambda y}\right] = \mathbf E_{z\sim\mathcal N(0,\Lambda)}\left[\frac{z^T\Lambda ^{1/2}U^T AU\Lambda ^{1/2}z}{z^T z}\right] $$

Letting $C=\Lambda ^{1/2}U^T AU\Lambda ^{1/2}$ and using linearity we have:

$$ \mathbf E_{z\sim\mathcal N(0,\Lambda)}\left[\frac{z^TCz}{z^T z}\right] = \mathbf E_{z\sim\mathcal N(0,\Lambda)}\left[\left\langle C, \;\tfrac{zz^T}{z^T z}\right\rangle\right] = \left\langle C, \; \mathbf E_{z\sim\mathcal N(0,\Lambda)}\left[\tfrac{zz^T}{z^T z}\right]\right\rangle $$

Here, both $\mathbf E_{z\sim\mathcal N(0,\Lambda)}[zz^T] = \Lambda$ and $\mathbf E_{z\sim\mathcal N(0,\Lambda)}[z^Tz] = \operatorname{tr}(\Lambda)$ are trivial, however numerical simulation suggests that $\mathbf E_{z\sim\mathcal N(0,\Lambda)}\left[\tfrac{zz^T}{z^T z}\right]$ is a diagonal matrix whose diagonal has some non-trivial, non-linear relationship w.r.t. $\Lambda$.

Hyperplane
  • 318
  • 1
  • 9
  • 1
    thanks, reading more into this. BTW, in my problem, because of rotational symmetry we can say that `A` is diagonal WLOG – Yaroslav Bulatov Aug 18 '21 at 08:34
  • 1
    Using your dot product expansion simplifies things considerably, updated q – Yaroslav Bulatov Aug 18 '21 at 09:55
  • I think that $\Lambda$ should be used instead of $\Lambda^2$ in the expectations of the numerator and denominator of $E[zz^\top/(z^\top z)]$ at the end. Maybe the partial derivatives w.r.t the $\lambda_i$ can help? – Yves Aug 18 '21 at 15:24
  • @Yves thanks for spotting that, fixed. – Hyperplane Aug 19 '21 at 08:20
  • follow-up question here -- https://math.stackexchange.com/questions/4228308/average-value-of-fracxa2xxa3x-over-surface-of-n-dimensional-sphere – Yaroslav Bulatov Aug 19 '21 at 16:49
2

$A\in\mathbb{R}^{n\times n}$ is symmetric positive, so there exists an orthonormal base $U=u_1,...,u_n$ and scalars $\lambda_1,...,\lambda_n$ s.t. $A=UDU^T$, with $D=\begin{pmatrix} \lambda_1 & & 0 \\ & \ddots & \\ 0 & & \lambda_n \\ \end{pmatrix}$. This is the spectral decomposition.

With these, we can decompose $$x^TAx=x^TUDU^Tx$$ and more importantly $$x^TA^2x=x^TUDU^TUDU^Tx$$. As U is orthonormal, $U^TU=I$ and thus we get the denominator as $x^TA^2x=x^TUD^2U^Tx$. Now we denote $w=U^Tx$. As a transformation, we get $w\sim N(U^T\mu_x, U^T\Sigma_xU)$. Plug in $x\sim N(0,I_n)$ and we get $w\sim N(0,I_n)$, again using $U^TU=I$.

The numerator is $w^TDw=\sum_{i=1}^{n}{\lambda_iw_i^Tw_i}$. Denote $g=\sum_{i=1}^{n}{\lambda_i}$, this is simply a $\chi^2_{ng}$ variable ($w^Tw\sim\chi^2_n$, we sum $g$ of those). Similarly, the denominator is a $\chi^2_{nk}$ variable, where $k=\sum_{i=1}^{n}{\lambda_i^2}$.

Overall, $\frac{x^TAx}{x^TA^2x}=\frac{w^TDw}{w^TD^2w}$ is a ratio of $\chi^2_{ng}$ variable and a $\chi^2_{nk}$ variable, so it has a beta prime distribution with parameters $\left(\alpha=\frac{ng}{2},\beta=\frac{nk}{2}\right)$. Assuming $nk>2$, the mean is

$$ \frac{\alpha}{\beta-1} = \frac{\frac{ng}{2}}{\frac{nk}{2}-1}=\frac{ng}{nk-2} $$

That's the first moment of $\frac{x^TAx}{x^TA^2x}$. Hope this helps.

Spätzle
  • 2,331
  • 1
  • 10
  • 25
  • 1
    I might have missed something with converting it into an $F$ variable? not sure, but the $\beta'$ and $F$ are tightly related. – Spätzle Aug 12 '21 at 22:31
  • 4
    Don't you need the two $\chi^2$ variables to be independent to get an $F$ (or a $\beta\prime$)? – Thomas Lumley Aug 13 '21 at 00:37
  • Thanks, will look at this more deeply. BTW because the problem is rotationally symmetric, could just say "A is diagonal WLOG" – Yaroslav Bulatov Aug 13 '21 at 08:10
  • That doesn't seem to match result for A with eigenvalues 1,1/2, the result should be 4/3, verified using 3 different methods -- https://www.wolframcloud.com/obj/yaroslavvb/newton/forum-ratio-quadratic.nb – Yaroslav Bulatov Aug 13 '21 at 08:34
  • Consider the simple case of $A=\begin{pmatrix}1&0\\0&0.5\\ \end{pmatrix}$ (which satisfies the eigenvalues <1, 0.5>): the quantity will be $\frac{x^TAx}{x^TA^2x}=\frac{x_1^2+0.5x_2^2}{x_1^2+0.25x_2^2}=1+\frac{0.25x_2^2}{x_1^2+0.5x_2^2}$. The last fraction can be written as $\frac{x_2^2}{4x_1^2+x_2^2}$. Let $x_2^2=X\sim\chi^2(1)$ and $4x_1^2=Y\sim\chi^2(4)$, of course $X,Y$ are independent and so the ratio $\frac{X}{X+Y}$ has beta distribution with parameters $(0.5,2)$. Its mean value is $0.5/(2+0.5)=0.2$ and the overall expected value is $1.2$ (rather than 4/3). Try it, even by hand. – Spätzle Aug 17 '21 at 06:13
  • 4
    As noted above, this fails because numerator and denominator are dependent in general. Consider for example the special case where $A$ is the identity matrix. – ekvall Aug 17 '21 at 06:57
  • You could also define $g$ and $k$ as traces, $Tr(A)$ and $Tr(A^2)$ respectively. – Matt F. Aug 18 '21 at 01:37