If $\mathbf{x}\sim\mathbf{N}(\mathbf{0},\mathbf{I})$, and assume that $A$ is a symmetric positive definite matrix, how can I calculate the following two expectations where there is a logarithm in it?
$$
\mathrm{E}\_\mathbf{x}\left[\log(\mathbf{x}^\top A\mathbf{x})\right]
$$
and


$$
\mathrm{E}\_\mathbf{x}\left[(\mathbf{x}^\top A\mathbf{x})\log(\mathbf{x}^\top A\mathbf{x})\right]
$$


Using the decomposition $A=U\Lambda U^\top$ and $\mathbf{y}=U^\top\mathbf{x}$, the first expectation can be reduced to
$$
\mathrm{E}\_\mathbf{y}\left[\log(\mathbf{y}^\top \Lambda\mathbf{y})\right]
$$


$$
=\mathrm{E}\_\mathbf{y}\left[\log\left(\sum\_i{\lambda\_i\mathbf{y}\_i^2}\right)\right]
$$
where $y$ has the same distribution as $x$ because $U$ is a orthogonal matrix.


However, since the random variables $y\_i$ are in the logarithm function, I cannot decompose the expectation further and such a expectation seems to be difficult to calculate.


Could you please help me with this problem or give some suggestions about it?
Thank you very much!



How to calculate this expectation with logarithm?
For the case $\lambda\_1=\cdots=\lambda\_k=1$, $\sum\_i \lambda\_i y\_i^2$ has a chi-squared distribution with $k$ degrees of freedom. Plugging in the chi-squared density and cranking up Maple, we get
$$E\Bigl(\log\bigl(\sum\_{i=1}^k y\_i^2\bigl)\Bigl) = \ln 2+\Psi(k/2),$$
where $\Psi(x)$ is the digamma function (the derivative of the gamma function $\Gamma(x)$).
The first six values are $-\gamma-\ln 2$, $-\gamma+\ln 2$, $-\gamma+2-\ln 2$, $-\gamma+1+\ln 2$, $-\gamma+\frac83-\ln 2$, $-\gamma+\frac32+\ln 2$.


If the $\lambda\_i$ are not all equal, $\sum\_i \lambda\_i y\_i^2$ is called a weighted chi-squared distribution (and probably other names too). I don't know if there is an expression for its density that is useful here.


