Expected number of times the first outcome occurs 3 times Independent trials resulting in outcomes $1,2,3$ with probabilities $1/2,1/4,1/4$ are performed. Let $N$ be the number of trials needed until the first outcome has occurred 3 times (not necessarily consecutively). I want to find $E(N)$. My thoughts were to condition on the first outcome. $$E(N)=E(N|1)\frac{1}{2}+E(N|2)\frac{1}{4}+E(N|3)\frac{1}{4}$$. But I do not know what to do with $E(N|i)$ which is the conditional expectation given the first outcome is $i$. Any help is much appreciated. Thank you. 
 A: Let $N_1, N_2, N_3$ be the waiting times until the first, second, and third 1.  Your $N$ is $N_3$.  But $E(N_3) = 3 E(N_1)$ -- basically after each 1 the situation resets until you get the next 1.
So what's $E(N_1)$?  You have
$$E(N_1) = E(N_1 | 1) (1/2) + E(N_1 | 2) (1/4) + E(N_1 | 3) (1/4).$$
Now clearly $E(N_1 | 1) = 1$ -- if you get a 1 on the first trial then the waiting time is 1.  And $E(N_1 | 2) = 1 + E(N_1)$ -- if you get a 2 on the first trial then you have to start over, but with one trial already counted against you.  Similarly $E(N_1 | 3) = 1 + E(N_1)$.  So the equation above becomes
$$E(N_1) = (1)(1/2) + (1 + E(N_1)) (1/2)$$
which you can solve for $E(N_1)$.
A: $$\newcommand{\C}[2]{^{#1}\text{C}_{#2}}$$
Let, first outcome=$O_1$,
Suppose $N $ trials have been done,$$$$The last trial must be $O_1$  as you stop after the third trial,
$$$$
So the other $O_1$ s are distributed in first $N-1$ trials,
$$$$
hence probability that we get 2 $  O_1$ for $(N-1)$ trials is,
$$=\C{(N-1)}{2} (\frac{1}{2})^2(\frac{1}{2})^2$$
$$=\C{(N-1)}{2} \frac{1}{16}$$
$$=\frac{\C{(N-1)}{2}}{16}$$
Now probability that 1 outcome occurs after N-1 th trial,
$$=\frac{\C{(N-1)}{2}}{32}$$
Hence,
$$P(N)=\frac{\C{(N-1)}{2}}{32}$$

The formula i used is,
  $$$$Let p be the probability an event will happen,
  $$$$q be it unit happening,
  $$$$Given n trials have taken place
  $$$$Probability that event occurred r times is
  $$P(n,r)=\C{n}{r} (p)^r (q)^{n-r}$$

PS:I don't understand what an expectation is , i can just guide you till here.
A: You have a Markov chain with $3^3+1=28$ states.  The first $27$ of them can be named like $012$, meaning you have thrown no $1$s, one $2$, and two $3$s.  The last state is finish, where you have thrown three of something.  You can start from the end to compute the expected number of throws.  For example, $E(N|222)=7$ because you have made six throws and are guaranteed to finish next time.  Knowing this, $E(N|122)=\frac 12 \cdot 7 + \frac 12 \cdot 6=6.5$ because you have half chance to throw a $1$ and go to $222$ and half chance to finish.  The equality of probability between $2$ and $3$ makes the expected number of throws match in many pairs of states.
