We toss balls into urns. Denote with $x$ the number of balls in an urn. And $x_r$ denotes the number of red balls. The share of red balls among the balls is denoted as $P$. We toss these balls into urns in a manner such that $g(x) = 1/4 \,, x \in [0, 3]$, where $g(x)$ is the probability mass function of an urn of having $x$ balls.
Each urn will pick a winning ball. If there is a red ball among the balls, it will randomly pick a red ball. If there is none, if will pick at random among all its balls.
We want to determine that probability at which a red ball will get "picked" as a winning ball after it has been tossed into one of the urns.
One way of getting there is
$$ \frac{1}{E[X_r | x_r > 0 \wedge x > 0]}$$
Intuitively, if there is on average 3 red balls in urns where there is at least one red ball, then red balls have a 1/3 chance of becoming the winner.
For a numerical example, pick $P = 0.5$. Then
- $E[x_r | x_r > 0 \wedge x = 1] = 1$
- $E[x_r | x_r > 0 \wedge x = 2] = 1 + P = 3/2$
- $E[x_r | x_r > 0 \wedge x = 3] = 1 + 2P^2 + 2P(1-P)=2$
So the conditional expectation is $1/3 + 1/3 \cdot 3/2 + 1/3 \cdot 2 = 3/2$
Next, I tried to transform the expectation as
$$ E[X_r | x_r > 0] = \sum_{x_r=1}^3 Prob(x_r = X_R | x_r > 0 \wedge x > 0) x_r\\ = \frac{\sum_{x_r=1}^3 Prob(x_r = X_R \wedge x_r > 0 \wedge x > 0) x_r}{Prob(x_r > 0 \wedge x > 0)}\\ = \frac{\sum_{x_r=1}^3 Prob(x_r = X_R) x_r}{Prob(x_r > 0\wedge x > 0)}\\ = \frac{E[x_r]}{Prob(x_r > 0 \wedge x > 0)}$$
Again, in the numerical example above, $E[x_r] = 0.75$. The probability in the denominator however is $4/3(1/2 + 3/4 + 7/8) = 4/3 * 17/8 = 0.53125$
To get the conditional expectation of before, we need that
$$ \frac{3}{2} = \frac{E[x_r]}{Prob(x_r > 0 \wedge x > 0)} = \frac{\frac{3}{4}}{Prob(x_r > 0 \wedge x > 0)} $$
i.e., the probability must be 0.5. However, it is 0.51325, and hence the calculation appears to be off. Where did I slip? What's wrong with this?
$E[1/X]$ is not generally equal to $1/E[X]$.
$E[x_r\mid x_r>0\land x=2]=4/3$, not $3/2$, and $E[x_r\mid x_r>0\land x=3]=12/7$, not $2$, if $P=1/2$. (It may be that the numbers you got are the ones you want but you expressed the expectation badly. What you wrote is the expected number of red balls given that some ball is red, but I think you wanted to identify a particular red ball in advance and calculate the expected number of red balls given that that ball is in the urn.)
When you combined the expectations $E[x_r\mid x_r>0\land x=1]$, $E[x_r\mid x_r>0\land x=2]$, and $E[x_r\mid x_r>0\land x=3]$, you gave them all equal weight ($1/3$). But the three events $x_r>0\land x=1$, $x_r>0\land x=2$, and $x_r>0\land x=3$ are not equally likely and should have different weights.