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.



Expectation of a simple function of multivariate gaussians iid rvs
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}.
$$


