Expectation of a simple function of multivariate gaussians iid rvs I would like to compute analytically the following expected value:
$$ E\left( \frac{X_i^2}{\sum_j \lambda_j^2 X_j^2}\right) $$
where the $X_i \approx N(0,1)$ are iid.
It seems to be an elementary integral, but it is eluding me. Any pointer to a non-trivial solution technique, or the solution itself, of course, is highly appreciated.
 A: Here are some preliminary computations.
One wants to compute  $A_k^n=\lambda_k^2E\left(X_k^2S^{-1}\right)$, where $S=\sum\limits_{k=1}^n\lambda_k^2X_k^2$. Starting from the expression
$$
S^{-1}=\int_0^{+\infty}\mathrm{e}^{-tS}\mathrm{d}t,
$$
and using the independence property of the random variables $X_k$, one gets
$$
A_1^n=\int_0^{+\infty}\lambda_1^2E(X_1^2\mathrm{e}^{-tS})\mathrm{d}t=\int_0^{+\infty}\lambda_1^2E(X^2\mathrm{e}^{-t\lambda_1^2X^2})E(\mathrm{e}^{-t\lambda_2^2X^2})\cdots E(\mathrm{e}^{-t\lambda_n^2X^2})\mathrm{d}t,
$$
that is,
$$
A_1^n=-\lambda_1^2\int_0^{+\infty}u'(t\lambda_1^2)u(t\lambda_2^2)\cdots u(t\lambda_n^2)\mathrm{d}t,
\quad\text{where}\
u(t)=E(\mathrm{e}^{-tX^2}).
$$
By some simple computations,
$$
u(t)=(1+2t)^{-1/2},\quad u'(t)=-(1+2t)^{-3/2},
$$
hence
$$
A_1^n=\int_0^{+\infty}\frac{\lambda_1^2\mathrm{d}t}{(1+2\lambda_1^2t)\sqrt{(1+2\lambda_1^2t)(1+2\lambda_2^2t)\cdots(1+2\lambda_n^2t)}}.
$$
First example
When $\lambda_k^2=\lambda^2$ for every $k$, the change of variable $s=\sqrt{1+2\lambda^2t}$, $s\mathrm{d}s=\lambda^2\mathrm{d}t$,  yields
$$
A_1^n=\int_1^{+\infty}\frac{\mathrm{d}s}{s^{n+1}}=\frac1n,
$$
as was to be expected by symmetry. 
Second example
When $\lambda_1^2=\lambda^2$ and $\lambda_k^2=1$ for every $k\ge2$, the change of variable $s=\sqrt{1+2t}$, $s\mathrm{d}s=\mathrm{d}t$, with $1+2\lambda^2t=\lambda^2s^2+1-\lambda^2$ yields
$$
A_1^n=\int_1^{+\infty}\frac{\lambda^2\mathrm{d}s}{s^{n-2}(\lambda^2s^2+1-\lambda^2)^{3/2}}=1-(n-1)\int_1^{+\infty}\frac{\mathrm{d}s}{s^{n}(\lambda^2s^2+1-\lambda^2)^{1/2}}.
$$
When $n=2$ and $\lambda^2\ge1$, setting $\lambda^2=1/\cos^2 u$ yields $A_1^2=\displaystyle\frac1{1+\cos u}=\frac{\lambda}{1+\lambda}$. This last formula is also valid if $\lambda^2\le1$.
Further values for even integers $n$ are $$A_1^4=\dfrac{\lambda^2}{(1+\lambda)^2},\quad A_1^6=\dfrac{\lambda^2(1+3\lambda)}{3(1+\lambda)^3},\quad A_1^8=\dfrac{\lambda^2(1+4\lambda+5\lambda^2)}{5(1+\lambda)^4}.
$$
When $n=3$ and $\lambda^2\ge1$, setting $\lambda^2=1/\cos^2 u$ and some further computations yield
$$
A_1^3=\frac{1-u\cot u}{\sin^2u}.
$$
Likewise, if $\lambda^2\le1$, setting $\lambda^2=1/\cosh^2 u$ yields
$$
A_1^3=\frac{u\coth u-1}{\sinh^2 u}.
$$
A: For the case $\lambda_1=\cdots=\lambda_n=1$, the answer is $1/n$ by symmetry.
Not using symmetry, $Y = \sum_{j\ne i} X_j^2$ has the distribution $\chi_{n-1}^2$. Now look up the $\chi^2$ density and fire up Maple. The integral over $Y$ gives something with an incomplete gamma function in it, then the integral over $X$ gives $1/n$.
I can find a few other specific values the same way.  For example, if $\lambda_1=2$
and $\lambda_2=\cdots=\lambda_n=1$ then the answer is $1/6,1/9,7/81,29/405,523/8505,2483/45927$ for $n=2,4,6,8,10,12$ (what's the pattern?).
This disproves Will's conjecture (if that's what it was). 
A: I don't know about a fully analytical solution, but your problem seems tractable conceptually. The random variable $X\_i^2/\sum\lambda_j^2 X_j^2$ whose expected value you want depends only the ray from the origin through $X = (X_1,\ldots,X_n)$; i. e., it is a function of $T = X/||X||$, which is a random variable taking values on the unit sphere in $\mathbb{R}^n$. Since the components of $X$ are IID normal, $T$ is distributed uniformly on the unit sphere. Thus, your expected value is a simple (n-1)-dimensional surface integral over the unit sphere: $$\int \frac{T_i^2}{\sum_j \lambda_j^2 T_j^2}d\mu(T)$$ where $\mu$ is surface measure on the unit sphere. $d\mu(T)$ can be expressed in coordinates without too much difficulty, but that's all I'll attempt to say here. I don't know whether to expect an analytical solution. 
