# Expected Value Of Dice Rolling Game

I am having trouble figuring out the expected value in situations were the examples are going to infinity.

Example:

I have a fair dice with 8 sides. I keep a counter ($k$) of the rounds I play. Each round I increase the counter by 1 and I roll the die. I keep doing this until I roll a 1 or an 8.

So I'll define a random variable $X$ to be the amount of rounds played. I know that the odds of rolling a 1 or a 8 on a 8 sided die is $\frac1 4$ otherwise it is $\frac3 4$. The way I am trying to solve the expected value is by using a geometric series. This is where I am getting stuck I think it should look like this:

$E(X)=X_1P_1+X_2P_2+X_3P_3+...+X_nP_n$

$E(X)=1*\frac1 4+2*\frac1 4+3*\frac1 4+...+n*\frac1 4$

I am unsure how to turn this into a sum.

• You would have to calculate the expected value of the random variable. If it goes to infinity or not doesn't matter, since it is a normal random distribution. The expected value is the sum of the product between the possible results and their probability. E[X] = x1*p1 + [...] + xn*pn – StillBuggin Dec 20 '15 at 18:58
• Check out the geometric distribution en.m.wikipedia.org/wiki/Geometric_distribution – David Quinn Dec 20 '15 at 19:05
• The probability $P_k$ that goes with $X_k$ in your sum should be the probability that the random variable $X$ takes on the value $k$. What you’ve got is the probability that you’ll roll a $1$ or $8$, which is not the same thing at all. You should instead have the probability that the $k$th roll is $1$ or $8$ and that none of the preceding rolls were. – amd Dec 21 '15 at 0:24

There is an easy trick for this calculation, using the following fact, for a random variable $X$ and a specific value $x$: $$E(X)=P(X=x) \cdot E(X\mid X=x)+P(X\neq x)\cdot E(X\mid X\neq x)$$ (where $E(X\mid X=x)=x$, of course).

We can let $X$ be the number of throws we do in total (including the last $1$ or $8$), and $x=1$. This gives $$E(X)=\frac14+\frac34E(X\mid X\neq 1)$$ But $X\mid X\neq 1$ just means "we know we fail on the first throw, and then we keep going as normal", which means that $$E(X\mid X\neq1)=1+E(X)$$ and this gives $$E(X)=\frac14 +\frac34(1+E(X))$$which may be solved as a normal equation.

• The way I am trying to solve this and the way I have seen similar question solved is using a geometric sequence. Since X is the number of rounds played I think my expected value of X would look something like this: $E(X) = X_1 P_1+X_2 P_2 + X_3 P_3 + ... + X_n P_n$ which would turn to $E(X)=1* \frac 1 4 + 2* \frac 1 4 + 3* \frac 1 4 +...+n* \frac 1 4$ – Steph Dec 20 '15 at 19:27