# Expected value for randomly assigned sum and product of random variables

I pick randomly, with the weights indicated and without replacement 4 numbers from this table,

$$\begin{array}{c|c} Value & Weight \\ 63 & 1 \\ 91 & 2 \\ 78 & 3 \\ 85 & 4 \\ \hline 1 & 6 \\ 2 & 2 \\ 3 & 2 \\ \end{array}$$

The outcome of the process is defined as the sum of the values if they are among the top part of the table, but if the value comes from the lower part of the table then it is a factor of the previous value. Examples,

If the drawn 4 values are $$63,\ 91,\ 78,\ 85$$ the outcome is $$63+91+78+85$$

If the drawn 4 values are $$85,\ 3,\ 78,\ 1$$ the outcome is $$85\cdot3+78\cdot1$$

If the drawn 4 values are $$78,\ 3,\ 2,\ 1$$ the outcome is $$78\cdot3\cdot2\cdot1$$

(The first value is assumed to be one of the 4 firsts).

Now I want to compute the average outcome of this process, this is, the expected value for the outcome.

How can I compute the expected value?

My problem is that I don't know how to define my random variable. For each sample, I can compute the expectation value if I know in which group it is,

If $$X$$ is a random variable drawn from the 4 first values,

$$E(X) = \frac{1}{10}63 + \frac{2}{10}91+ \frac{3}{10}78+ \frac{4}{10}85$$

Equivalently, if $$Y$$ is a random variable drawn from the 3 last values,

$$E(Y) = \frac{6}{10}1 + \frac{2}{10}2+ \frac{2}{10}3$$

Now, to compute the outcome expected value, I feel that this would work using the linearity of the expectation value, but without defining the outcome random variable is very difficult.

My attempt is the following but I don't know whether this is SUPER WRONG or CORRECT, If the first one is always $$X$$ (from the first group), there are 6 possibilities for other 3 (1.XXXX 2.XYXX 3.XYYX 4.XYYY 5.XYXY 6.XXYY) that let me define the random variable for each case,

$$Z_a = X_1 + X_2 +X_3 +X_4$$

$$Z_b = X_1\cdot Y_1 +X_2 +X_3$$

$$Z_c = X_1\cdot Y_1\cdot Y_2+X_2$$

$$Z_d = X_1\cdot Y_1\cdot Y_2\cdot Y_3$$

$$Z_e = X_1\cdot Y_1+X_2\cdot Y_2$$

$$Z_f = X_1+X_2\cdot Y_1\cdot Y_2$$

Now, the $$E(Z_\alpha)$$ is simple due to linearity, for example

$$E(Z_e) = E(X_1)*E(Y_1)+E(X_2)\cdot E(Y_2)$$

and

$$E(X_i)\ = E(X)\ \forall\ i$$ and $$E(Y_j)\ = E(Y)\ \forall\ j$$

And then the expected value of my outcome would be

$$\frac{E(Z_a)+E(Z_b)+E(Z_c)+E(Z_d)+E(Z_e)+E(Z_f))}{8}$$

which uses that all the $$Z$$s are equally likely because the probability of each drawn to be $$X$$ or $$Y$$ are 50/50 (because the sum of the weights of each group is the same).

• An Issue: If you select without replacement, then the values will not be uncorrelated. $$\mathsf E(X_1\cdot Y_2)\neq\mathsf E(X_1)\mathsf E(Y_2)$$ – Graham Kemp Nov 22 '18 at 0:36
• Is that so? Then I am a bit confused because I was reading other posts on expected value without replacement and they explain that the probabilities vary but the expectation value does not change. Like this post: math.stackexchange.com/questions/1857916/… math.stackexchange.com/a/2906224/523753 – myradio Nov 22 '18 at 8:19
• Linearity of Expectation works with addition of random variables, not multiplication. – Graham Kemp Nov 22 '18 at 9:23
• I was thinking in $Y$ as a constant once fixed. With the typical notation of $a$ being a constant value, we usually have that $E(a \cdot X)=a.E(X)=E(a)E(X)$. But I guess it was wrong to assume that if now instead of a constant $a$ I have another random variable I can just do $E(Y \cdot X)=E(Y)E(X)$. Maybe I should use the fact that $X$ and $Y$ are equally likely and think them separately? – myradio Nov 22 '18 at 9:29

Let's use the values, $$4,5,6, 1,2,3$$, equal weighting, and only two selections.   If the second selection is one from the first three numbers we multiply, else we add.
The expectation is: \begin{align}\mathsf E(g(X,Y)) &= \mathsf E(XY\mathbf 1_{Y\in\{4,5,6\}})+\mathsf E((X+Y)\mathbf 1_{Y\in\{1,2,3\}})\\&= {\tfrac 1{30}\left( (1+2+3+5+6)4+(1+2+3+4+6)5+(1+2+3+4+5)6\right) +\tfrac 16\left( ((2+3+4+5+6)+1)+((1+2+3+4+5+6)+2)+((1+2+4+5+6)+3) \right)}\\ &=\tfrac 1{30}\left(17\cdot4+16\cdot 5+15\cdot 6\right)+\tfrac 16\left(21\cdot 3\right)\\&=\tfrac{553}{30}\end{align}
By your method: $$\mathsf E(X)\mathsf E(Y\mathbf 1_{Y\in\{4,5,6\}})+\mathsf E(X)+\mathsf E(Y\mathbf 1_{Y\in\{1,2,3\}})\\=\tfrac 1{36}(21)(15)+\tfrac{21}6+\tfrac {6}6\\=\tfrac{477}{36}$$
• Also, I just was thinking. What you are doing is defining $g$ as $g(X,Y) = XY\mathbf 1_{Y\in\{4,5,6\}}+(X+Y)\mathbf 1_{Y\in\{1,2,3\}}$ is that correct? And then using linearity of the $E$ on that function $g(XY)$, right? – myradio Nov 22 '18 at 11:35