$\mathbb{E}\left[ {X|Y} \right]$ es una variable aleatoria. Dado que $Y$ es una variable aleatoria discreta, $\mathbb{E}\left[ {X|Y} \right]$ es de la forma $\sum\limits_{i = 0}^n {\frac{{\mathbb{E}\left[ {X{1_{Y = i}}} \right]}}{{\mathbb{P}\left( {Y = i} \right)}}{1_{Y = i}}} $ .
Dejemos que $F$ sea el caso de que un robot esté defectuoso y $D$ ser el caso de que se detecte un robot defectuoso. Tenemos $\mathbb{P}\left( F \right) = \phi $ ,
$\mathbb{P}\left( D \right) = \mathbb{P}\left( {D|F} \right)\mathbb{P}\left( F \right) + \mathbb{P}\left( {D|{F^C}} \right)\mathbb{P}\left( {{F^C}} \right) = \delta \phi + 0\left( {1 - \phi } \right) = \delta \phi $ ,
$\mathbb{P}\left( {F|{D^C}} \right) = \frac{{\mathbb{P}\left( {{D^C}|F} \right)\mathbb{P}\left( F \right)}}{{\mathbb{P}\left( {{D^C}|F} \right)\mathbb{P}\left( F \right) + \mathbb{P}\left( {{D^C}|{F^C}} \right)\mathbb{P}\left( {{F^C}} \right)}} = \frac{{\left( {1 - \delta } \right)\phi }}{{\left( {1 - \delta } \right)\phi + \left( {1 - \phi } \right)}}$ ,
$\mathbb{P}\left( {F|D} \right) = 1$ .
$\mathbb{E}\left[ {X{1_{Y = i}}} \right] = \mathbb{E}\left[ {\sum\limits_{j = 1}^n {1_F^{\left( j \right)}} {1_{Y = i}}} \right] = \mathbb{E}\left[ {\sum\limits_{j = 1}^n {1_F^{\left( j \right)}} |Y = i} \right]\mathbb{P}\left( {Y = i} \right) = \left( {i\mathbb{E}\left[ {{1_F}|D} \right] + \left( {n - i} \right)\mathbb{E}\left[ {{1_F}|{D^C}} \right]} \right)\mathbb{P}\left( {Y = i} \right) = \left( {i\mathbb{P}\left( {F|D} \right) + \left( {n - i} \right)\mathbb{P}\left( {F|{D^C}} \right)} \right)\mathbb{P}\left( {Y = i} \right) = \left( {i + \left( {n - i} \right)\frac{{\left( {1 - \delta } \right)\phi }}{{\left( {1 - \delta } \right)\phi + \left( {1 - \phi } \right)}}} \right)\mathbb{P}\left( {Y = i} \right)$
Así que,
$\sum\limits_{i = 0}^n {\frac{{\mathbb{E}\left[ {X{1_{Y = i}}} \right]}}{{\mathbb{P}\left( {Y = i} \right)}}{1_{Y = i}}} = \sum\limits_{i = 0}^n {\left( {i + \left( {n - i} \right)\frac{{\left( {1 - \delta } \right)\phi }}{{\left( {1 - \delta } \right)\phi + 1 - \phi }}} \right){1_{Y = i}}} = \sum\limits_{i = 0}^n {\left( {\frac{{n\phi \left( {1 - \delta } \right) + \left( {1 - \phi } \right)i}}{{1 - \delta \phi }}} \right){1_{Y = i}}} = \frac{{n\phi \left( {1 - \delta } \right) + \left( {1 - \phi } \right)Y}}{{1 - \delta \phi }}$