# Compute expected received balls from boxes

I have 6 boxes: $A,B,A',B',C \text{ and } D$. The box $A$ has $n_1$ red balls that are numbered from $1, \cdots, n_1$. The box $B$ has $n_2$ green balls that are numbered from $1, \cdots, n_2$. Make a copy version of these boxes $A,B$ are $A',B'$ (It means the box $A'$ has $n_1$ red balls from $1, \cdots, n_1$, and the box $B'$ has $n_2$ green balls from $1, \cdots, n_2$ ). These two boxes $C,D$ have no balls. Let $p$ be loss probability when we throw balls from a box to another box (each ball gets dropped with independent probability $p$). (For example, if we throw a ball from the box $A$ to box $C$ with loss prob. is $p=10\%$, then $90\%$ the ball will not drop. Then expected number of received ball in box $C$ will be $0.9n_1$ balls...).

First, I will throw these balls from $A$ and $B$ to the box $C$ with loss probability is $p$. Call number of red and green balls in box $C$ are $n_{1C},n_{2C}$, respectively. Then, randomly select $r$ balls from the box $C$, with $0 \le r \le \min(n_1,n_2,n_{1C}+n_{2C})$. Throw these $r$ balls to the box $D$ with loss probability $p$.

Second, throw these balls from these boxes $A',B'$ to the box $D$ with loss probability $p$.

How many (expected number) red balls do we have in the box $D$ in term of $p$, if two red balls have the same number (i.e number 4 of a red ball from $A' \to D$, and number 4 of a red ball from $C \to D$), then the red ball only counts 1 time? In the same manner, how many green balls do we have in the box $D$? Thank you in advance. • This question is very hard to read...there's a lot of unhelpful verbiage, the variable names are confusing and the picture doesn't add anything. I think, but am not at all sure, that you are asking this: "you have a bunch of balls, red ones $r_i$ and green ones $g_i$. Each specific ball, like $r_1$, say, has two independent ways of making it to box $D$. Either it goes there directly (probability $q=1-p$) or it goes there after making a stop (probability $q^2$) or it could reach by both routes (probability q^3). What's the expected number that makes it to box $D$? Do I have it right? – lulu Jun 30 '16 at 14:17
• Note: if I have understood the question correctly (a big if) then it isn't difficult, and I'll write up a solution. If I have misunderstood, perhaps you could clarify? To stress: I am not at all sure I am reading it correctly. For example, I don't think the "red and green" have anything to do with it. There are just $n_1+n_2$ balls. Could be different colors, could be the same. – lulu Jun 30 '16 at 14:18
• Thank lulu. My question is extended version of math.stackexchange.com/questions/1842299/… – user3051460 Jun 30 '16 at 15:13
• Is my interpretation correct? If so then, barring blunder, my posted solution ought to be correct. If my interpretation is not correct, could you clarify the way in which I have misunderstood it? – lulu Jun 30 '16 at 15:16
• Oh, Ok. Yes, I missed that one. Not so easy to add that one in...let me think for a minute. – lulu Jun 30 '16 at 15:56

NOTE: as the OP points out in the comments, this solution incorrectly assumes that ALL balls in $C$ are subsequently tossed over towards $D$. That case may still be relevant so I will leave this up for now and will modify it if I can incorporate the filter from $C$.
Let $X_i$ denote the indicator variable for the $i^{th}$ red ball. Thus $X_i=1$ if $r_i$ eventually gets to box $D$ (either once or twice) and $X_i=0$ otherwise. Let $E[Red]$ be the expected number of red balls that eventually make it to $D$. Then by linearity of expectation $$E[Red]=E\left[\sum X_i\right]=\sum E[X_i]=\phi\times n_1$$ Where $\phi$ denotes the probability that a given red ball makes it (either once or twice). It's easy to compute $\phi$. The chosen ball makes it along the path $A'\to D$ with probability $q=1-p$ and it makes it there along the path $A\to C \to D$ with probability $q^2$. Adding these double counts those cases in which the ball makes it via both routes, which happens with probability $q^3$. Thus $$\phi=q+q^2-q^3\implies E[Red]=(q+q^2-q^3)\times n_1$$
The same argument shows that $E[Green]=(q+q^2-q^3)\times n_2$ and the final answer is just $$E=E[Red]+E[Green]=(q+q^2-q^3)\times (n_1+n_2)$$