# Computing expectation of a function of two random variables

I have two arrays $X$ and $Y$ of length $N$ each. In array $X$, I have random numbers $x_1$, $x_2,\ldots,x_N$, whose sum is $S_x$. Similarly in array $Y$, I have random numbers $y_1$, $y_2,\ldots,y_N$, whose sum is $S_y$. The numbers in $X$ are drawn from a distribution $D_x$ with support $(l_x,r_x)$; for $Y$, it is $D_y$ and $(l_y,r_y)$ and the two distributions are independent.

I now have a function of the random numbers: $Z=\sum_{i=1}^N f(x_i,y_i)$, whose expectation I need to compute. What will be the generic formula of the expectation?

I am confused here because the distribution gives me the probability of $x_i$ being a particular number on average. How do I incorporate the constraint that $\sum_i x_i=S_x$?

• Which distribution is, say $D_x$? Is it the distribution function of the random array, or is it the distribution of one random number in the array? – zoli May 21 '15 at 17:13
• @zoli: One number in the array. Distribution with finite support on the real line. – Bravo May 21 '15 at 17:15
• If you have random numbers drawn how come that their sum will be always a given constant? – zoli May 21 '15 at 17:18
• @zoli: Why not? I never said within array $X$, the draws are independent. $x_n(\omega)=S_x-\sum_{i=1}^{N-1}x_i$ for all $\omega$. – Bravo May 21 '15 at 17:21
• Sorry, I am affraid that I will not understand this problem. (The way you've defined $x_n(\omega)$ contradicts the claim that the $x_i$'s are independent. $x_1$ can be freely drawn. OK. But then $x_2=S_x-x_1$. So I just don't get this description of the experiment.) – zoli May 21 '15 at 17:28

$$E\left[\sum_{i=1}^N f(x_i,y_i)\right]=$$$$=\sum_{i=1}^{N-1}E[f(x_i,y_i)]+E\left[f\left(S_x-\sum_{i=1}^{N-1}x_i,S_y-\sum_{i=1}^{N-1}y_i\right)\right].$$
The first sum is easy to calculate: $$E[f(x_i,y_i)]=\int_{l_x}^{r_x}\int_{l_y}^{r_y}f(u,v)dD_y(v)dD_x(u).$$
Now, we need the distribution of $$\xi=S_x-\sum_{i=1}^{N-1}x_i$$ and of $$\eta=S_y-\sum_{i=1}^{N-1}y_i.$$ Without further knowledge, the distributions of $\xi$ and $\eta$ cannot be calculated unless we can refer to the central limit theorem...