Calculate effectiveness of protocol Suppose we have a protocol sending messages of $L+10$ bits. The probability of making an error in each one of the $L$ bits is $p$. Only the $L$ bits can contain errors. Suppose the probability of at least one wrong bit in each message is $q$. I know $q=1-\binom{L+10}{L}(1-p)^{10}$.
Now suppose the protocol transmits in the following manner. If we send a correct message, we stop. If we make an error, the message is retransmitted after the previous transmission is finished.
What is the expected value of the ratio $\displaystyle \frac{\text{correct bits}}{\text{bits transmitted}}$?
Idea - condition on $X=\text{number of messages sent}$. I think $X\sim \mathrm{Geom}(1-q)$...
 A: Let $Y_i$ be the number of correct bits in the $i$-th message, $X$ the number of messages and $Z$ the ratio of number of correct bits over transmitted bits. We have then
$$Z = \frac{Y_1 + Y_2 + \cdots +Y_X}{(L+10)X}$$
Since both the numerator and the denominator depends on $X$, we first take the expected value of $Z$ conditioned over $X=x$. In that way, the numerator would be the sum of a fixed and known number of $x$ i.i.d random variables $Y_1, Y_2, \ldots,Y_x$, and the denominator would be also known (deterministic). Let's see.  
\begin{align}
E[Z \mid X=x] &= E\left[\frac{Y_1 + Y_2 + \cdots +Y_X}{(L+10)X} \bigg| X=x \right]\\
&= E\left[\frac{Y_1 + Y_2 + \cdots +Y_x}{(L+10)x}\right]\\
&= \frac{1}{(L+10)x}E[Y_1 + Y_2 + \cdots +Y_x]\\
&=\frac{xE[Y_1]}{(L+10)x}\\
&=\frac{E[Y_1]}{L+10} \tag{1}\\
\end{align}
Since (1) it's true for any value $x$, we have 
$$E[Z\mid X] = \frac{E[Y_1]}{L+10},$$
and by the law of iterated expectations, we have 
$$E[E[Z\mid X]] = E[Z] = \frac{E[Y_1]}{L+10}.$$ 
What this result is telling us is that, in average, the desired ratio computed over all the messages is the same as the ratio computed over one single message, which makes sense because we are assuming that the number of errors in each message is independent of the others. 
Finally, let $Y_1 = 10 + W_1$, where $W_1$ is the number of correct bits out of $L$. $W_1 \sim \text{Binom}(L, 1-p)$, therefore $E[W_1] = L(1-p)$ and $E[Y_1] = 10 + L(1-p)$.
