# Negative variance, what is wrong?

I am trying to obtain the variance of a function of two random variables

$$f(\boldsymbol x):= x_A (e^{k(x_A+x_B)}-1)$$

where $$\boldsymbol x = [x_A, x_B]^T$$. Additionally, I know that $$\operatorname{E}[x_A]=\operatorname{E}[x_B]=0$$.

My approach is to obtain:

$$\operatorname{Var}[f] = \operatorname{E}[f^2]-\operatorname{E}[f]^2$$

For the expectation of $$f$$, I followed this post and used

$$\operatorname{E}[f(\boldsymbol x)] \approx f(\operatorname{E}[\boldsymbol x]) + \frac{1}{2} \operatorname{E}[(\boldsymbol x-\operatorname{E}[\boldsymbol x])^TH_f(\operatorname{E}[\boldsymbol x]) (\boldsymbol x-\operatorname{E}[\boldsymbol x])]$$

Which for this case should simplify to

$$\operatorname{E}[f(\boldsymbol x)] \approx \frac{1}{2} \operatorname{E}[(\boldsymbol x)^TH_f(\operatorname{E}[\boldsymbol x]) \boldsymbol x]$$

The hessian matrix for $$f(\boldsymbol x)$$ evaluated at $$\operatorname{E}[\boldsymbol x]=[0,0]^T$$ turns to be

$$H_f(\operatorname{E}[[0,0]^T]) =\left[ \begin{matrix} 2k & k \\ k& 0 \end{matrix}\right]$$

so I get

$$\operatorname{E}[f(\boldsymbol x)] \approx \operatorname{E}\left[[x_A, x_B]\left[ \begin{matrix} 2k & k \\ k& 0 \end{matrix}\right] [x_A, x_B]^T\right]= \operatorname{E}[kx_A^2+kx_Ax_B]$$

For $$\operatorname{E}[f^2]$$, every term in the hessian (evaluated at $$\operatorname{E}[\boldsymbol x]$$) is null. Because of this I get $$\operatorname{E}[f^2]\approx 0$$.

Then, as $$(\operatorname{E}[kx_A^2+kx_Ax_B])^2\ge 0$$, my estimation of the variance is negative.

My questions are:

• What I am doing wrong?
• How to solve it correctly?

Thank you very much

• What distribution has the property of $\operatorname{E}[f^2]\approx 0$ ? – user158565 Jan 4 at 2:12
• @user158565 Thanks for reply, I bet none, although I do not know exactly the distribution of my data, it should be something close to the normal distribution. Although I agree with you in that such expectation is not possible, I cannot find where is the mistake. – user1420303 Jan 4 at 2:57
• I mean you should not get $\operatorname{E}[f^2]\approx 0$. – user158565 Jan 4 at 3:00
• @user158565 I understand that, but I found that the Hessian evaluated at (0,0) is null (please, see the link in the question). Higher order terms maybe helps, or maybe I am doing something wrong in that part. In any case, I found rare that I get $\operatorname{E}[f^2]\approx 0$ up to second order. I would like to try it up to higher orders but I really do not know how to do that (I am chemist). – user1420303 Jan 4 at 3:06
• I think the covariance between $x_A$ and $x_B$ is needed. Then you can try delta method. – user158565 Jan 4 at 3:10

Suppose you can get the covariance between $$x_A$$ and $$x_B$$. Let $$\Sigma = \left(\begin{matrix} Var(x_A) & Cov(x_A,x_b)\\ Cov(x_A,x_b) &Var(x_B) \end {matrix} \right)$$ $$\frac {\partial f}{\partial x} = \left(\begin{matrix} \frac {\partial f} {\partial x_A} & \frac {\partial f} {\partial x_B}\end {matrix} \right)$$
$$Var(f) \approx\left(\frac {\partial f}{\partial x}\right)\Sigma \left(\frac {\partial f}{\partial x}\right)^T$$