How can I find the expected value due to the trials instead of simply expected value of trials of a geometric distribution?

Suppose in a game, if I win in the $j$th round, I gain $+\$2^{j-1}$and if I don't win in the$j$th, I lose$-\$2^{j-1}$. If I lose, I will keep playing until I win. Once I win, I leave the game. Otherwise, I continue to play until 30 rounds and leave the game even if I don't win. In other words, I will just stop at the $30$th round. Each round is independent and the probability of winning in each round is $\frac{9}{13}$.

I let $X$ be a random variable of my winnings. I want to find my expected winnings.

Since it works in a way that I would stop during my first win, I have a feeling that $X$ should be distributed over the Geometric Distribution. The game is either a win or a lose, so it is pretty much like a Bernoulli trial. But since I am not getting the expected number of rounds played, the Bernoulli trials cannot be just $0$ or $1$. So I thought I could modify it to become this way: $${ X }_{ j }=\left\{\begin{matrix} +2^{j-1} & if\; win\\ -2^{j-1} & if\; lose \end{matrix}\right.$$ Then, $E(X)=E(X_1+X_2+\cdots +X_{30})=E(X_1)+E(X_2)+\cdots +E(X_{30})$

However, because I thought this is a Geometric Distribution, the expected value is just $\frac{1}{p}=\frac{13}{9}$. But I don't think the expected winnings is $\frac{13}{9}$ and is wrong.

Is what I have done correct?

So, instead of the usual finding of the expected number of trials of a standard geometric distribution, how can I find an expected number of another factor due to the trials (in this case, the expected number of winnings from the trials)?

Edit:

What I attempted to do was to make use of an indicator function to determine the expectation. But it doesn't seem successful.

The ideas in your post can be used to produce a nice solution, which will be given later. But the expected length of the game, which is almost but not quite $\frac{13}{9}$, because of the cutoff at $30$, has I think not much bearing on the problem.

First Solution: Let's do some calculations. If we win on the first round, we win $1$ dollar and leave. If we lose on the first and win on the second, we lost $1$ dollar but won $2$, for a net of $1$. If we lose on the first two rounds, and win on the third, we have lost $1+2$ dollars, and won $4$, for a net of $1$.

Reasoning in the same way, we can see that we either leave with $1$ dollar, or lose a whole bunch of money, namely $1+2+4+\cdots+2^{29}$, which is $2^{30}-1$. The reason that if we win, our net gain is $1$, is that if we win on the $i$-th round, we have lost $1+2+\cdots +2^{i-2}$ and won $2^{i-1}$. Since $1+2+\cdots +2^{i-2}=2^{i-1}-1$, our net gain is $1$.

The probability we lose an enormous amount of money is $\left(\frac{4}{13}\right)^{30}$ ($30$ losses in a row). Now the expectation is easy to find. It is $$(1)\left(1-\left(\frac{4}{13}\right)^{30}\right)- (2^{30}-1)\left(\frac{4}{13}\right)^{30}.$$ There is a bit of cancellation. The expectation simplifies to $$1-2^{30}\left(\frac{4}{13}\right)^{30}.$$

Second Solution: We give a much more attractive solution based on the idea of your post. For $j=1$ to $30$, let $X_j$ be the amount "won" on the $j$-th trial Then the total amount $X$ won is $X_1+\cdots+X_{30}$. Thus, by the linearity of expectation, $$E(X)=\sum_{j=1}^{30} E(X_j).$$ The $X_j$ are not independent, but that is irrelevant.

Let $p=4/13$. We win $2^{j-1}$ at stage $j$ with probability $p^{j-1}(1-p)$, and lose $2^{j-1}$ with probability $p^{j-1}p$. So $$E(X_j)=2^{j-1}p^{j-1}(1-2p).$$ Now sum, from $j=1$ to $j=30$. The sum is $$(1-2p)\frac{1-(2p)^{30}}{1-2p}, \quad\text{that is,}\quad 1-\left(\frac{8}{13}\right)^{30}.$$

• Thanks! I think if we look at it this way, then the expectation will be $(2^{30}-1)\left(\frac{4}{13}\right)^{30}+1(1-\left(\frac{4}{13}\right)^{30})$, is this right? Does that mean that I will not be able to use the linearity method to solve for this problem? Feb 23 '12 at 6:26
• @xEnOn: I earlier made a sign typo, and so have you. The second part is right, but the first should have a $-$ sign in front, since we lose $2^{30}-1$. I think my post at this moment is (after a few corrections!) fairly typo-free. There is a smoother way to do it using indicator functions, but it is late, and my brain has stopped working. Feb 23 '12 at 6:44
• oh yea...there should be a minus sign in front because that is a lost. Thanks! And I think what I attempted to do earlier was to use what you said as the indicator functions method. I should have used this term in my question though. I didn't know of the name of the method. Thanks for telling. It will be interesting to know how I could use the indicator function way because there could be chances where the net profit doesn't cancel out so nicely to just $\$1$. Feb 23 '12 at 7:07 • Would you have time to show how this problem could be done with an indicator function later in the day? I kept trying for many hours but still couldn't figure out how I should do it. :( Thanks for you help. Feb 23 '12 at 12:09 • @xEnOn: I wrote out the much nicer solution that goes along the line you tried. Had done it before, but made an arithmetical error, was too tired to figure out what was happening. An inessential variant uses$Y_j=1$if we win on the$j$-th trial,$-1$if we lose, and$X=\sum 2^{j-1}Y_j\$. Feb 23 '12 at 19:44