About discrete probabilities (Expected values) Is my solution correct?
Suppose two player (A and B) each one with 200,00 dollars toss a coin not balanced in a such way that the probability of head is $p$.
Suppose yet that if the result obtained is head then the player A receives 100,00 from the B. And if the result is tail the player A gives 100,00 to the B.
Suppose yet that the game ends when one of then amass 400,00.
Let $N$ the number os toss. Evaluate the expected value of tosses.
Well, My solution was:
The unique way of the game ends is one of the players get his payoff twice in a row.
Then the possible values for this random variable is $k = 2,3,\ldots$.
So
$$P(k=2) = p^2 + (1-p)^2$$
$$P(k=3) = (1-p)p^2 + p(1-p)^2$$
$$P(k=4) = p(1-p)p^2 + (1-p)p(1-p)^2 = (1-p)p^3 + p(1-p)^3$$
Then
$$P(X = k) = 2(p^2 + (1-p)^2) + \sum_{k=3}^{\infty} k[(1-p)p^{k-1} + p(1-p)^{k-1}]$$
Is this right?
 A: Here's what I meant by backwards induction (Markov chain method is equivalent):
There are only 5 possible states of the world which we will measure by A's wealth in hundreds of thousands of dollars.  Thus we will label the states {0, 1, 2, 3, 4}. We begin in state {2}.  If S is a state let E(S) be the expected number of tosses from state S.  The answer we want is E(2).  We note that E(0) = 0 = E(4). We have three unknowns (E(1), E(2), and E(3)) so we seek three equations connecting them.
Now, say you are in state {3}.  You toss the coin.  With probability p you move to state {4} and with probability (1-p) you move to state {2}.  It follows that $$E(3) = 1 + pE(4) + (1-p)E(2) = 1 + (1-p)E(2)$$.
Similarly $$E(2) = 1 + pE(3) + (1-p)E(1)$$ and
$$E(1) = 1 + pE(2)$$
Thus we have our three equations.  We only really care about E(2) so let's eliminate everything else.  Substituting the expression for E(1) into the middle equation we get, after some algebra,
$$E(2)(1-p+p^2) = 2 - p + pE(3)$$
But the first equation gives us a simple expression for pE(3) in terms of E(2).
Combining everything (and working through the algebra) we arrive at the final answer:  $$E(2) = \frac{2}{1-2p+2p^2}$$
As a sanity check, note that if p = 1 this gives 2, which makes sense (A inevitably wins after 2 tosses).  Similarly p = 0 also gives 2 (and A inevitably loses after 2 tosses).
A: Your basic approach is sound, but you're making an incorrect generalization in the sum, as you can see if you work out $P(k=5)$. (Also you're writing $P(X=k)$ where it seems you mean the expectation value.)
Anyway, this is a rather cumbersome way to calculate the expected number of tosses. Two successive tosses have outcome "A wins" with probability $p^2$, "B wins" with probability $(p-1)^2$ and "back to square one" with probability $2p(1-p)$. Thus the expected number of tosses satisfies the equation
$$\left<n\right>=2+2p(1-p)\left<n\right>\;,$$
with solution $\left<n\right>=2\,/\left(1-2p+2p^2\right)$.
A: I think I made a correct solution.
In fact $X$ just take even values.
So, $k = 2,4,6,8,\ldots$.
Then:
$$P(k = 2) = p^2 + (1-p)^2$$
$$P(k = 4) = p(1-p)p^2 + (1-p)p(1-p)^2 = p^3(1-p) + p(1-p)^3$$
$$P(k = 6) = p(1-p)p(1-p)p^2 + (1-p)p(1-p)p(1-p)^2 = p^4(1-p)^2 + (1-p)^4p^2$$
$$EX = \sum_{k \in even}^{n+l = k}k[p^l(1-p)^n + (1-p)^np^l]$$
