        \problemdata       % Takes 5 *mandatory* arguments
        {urns-2red}             % latex-friendly label for the prob.
        {expectation}  % The topic(s) of the problem content.
        {}               % Source (if known)
        {S02 cp11w-1} % Usage (list ones you are aware of).
        {Ashish, S02}        % Last revision info (author, date).



\begin{problem} An urn contains red and blue colored balls. 
The fraction of red balls is $r$ where $0 \leq r \leq 1$. A gambler
repeatedly pulls a ball at random from the urn. That is, at any point
during succesive pulls, each ball in the urn is equally likely to be
the next one pulled. The gambler puts the ball back into the urn
before making the next pull. He keeps pulling balls until he pulls
\emph{two red balls in a row}. We want to determine the expected
number of pulls the Gambler must make.

We can analyze this using Wald's Theorem. The sequence of pulls by the
Gambler can be regarded as a sequence of \emph{tries}, where the first
try begins with the first ball pulled.  Each try consists of a
sequence of pulled balls continuing until either a blue ball, or two
red balls in a row, are pulled.  For example, if the colors of pulled
balls are RBBBRBRR, then there are five tries which we indicate with
slashes: /RB/B/B/RB/RR/.  Note that each try consists of one or two
consecutive balls.

\begin{problemparts}

\problempart What is the expected length of the $i$th try, assuming
that there are at least $i$ tries?

\solution{Given that there is an $i$th try, it is of length 1 iff it
starts with a blue ball.  It is of length 2 iff it starts with a red
ball.  Hence,
\[\expect{\mbox{length of $i$th try} \mid \mbox{there is an
$i$th try}} = 1\cdot (1-r) + 2 \cdot r = 1 + r.
\]
}

\problempart What is the expected number of tries?

\solution{A series of tries ends iff only the last try consists of two
reds. We know from lecture that the ``mean time to failure'' is the
reciprocal of the probability of failure, so $\expect{\mbox{num
tries}}$ is the $1/\pr{\mbox{2 reds}}= 1/r^2$.}

\problempart What is the expected number of pulls the Gambler makes?

\solution{By Wald's Theorem we can just multiple the expected length
of the try by the the expected number of tries.}
\end{problemparts}
\end{problem}
