[Math] Expected value of rolling dice until getting a $3$

probabilityrandom variables

I am having trouble with this question with regards to random variables and calculating expected values:

Suppose I keep tossing a fair six-sided dice until I roll a $3$. Let $X$ be the number of times I roll the dice. What is the value of $E[X]$?

So for this problem I was thinking that the answer would just be $1$. Here is my thought behind it.

For each turn there is a $1/6$ chance of hitting a three. If I keep rolling and rolling I will eventually hit a $3$. So the math works out to be $(1/6)*6$ which is equal to $1$. Does this logic make sense? I am a bit confused with how exactly I would go about picking the values for $P(X=x)$ and how to calculate expected value. Some insight would be very helpful.

Best Answer

No, this logic doesn't make sense; but, let's see if we can clear that up!

For a fixed number $k$, let's think about the event $\{X=k\}$. If we can find the probabilities of each of these events (for $k=1,2,3,\ldots$), then $$ \mathbb{E}[X]=\sum_{k=1}^{\infty}kP(X=k). $$ What does it mean to say that $X=k$? It means that the first $k-1$ rolls of the dice gave a number other than $3$, and that the $k$th roll gave exactly $3$. Thus $$ P(X=k)=\left(\frac{5}{6}\right)^{k-1}\cdot\frac{1}{6}. $$ So, we find that. $$ \mathbb{E}[X]=\frac{1}{6}\sum_{k=1}^{\infty}k\left(\frac{5}{6}\right)^{k-1} $$ Now, this must be simplified... but that's not so bad, if you remember some stuff about sequences and series. First, remember that $$ \sum_{k=0}^{\infty}x^k=\frac{1}{1-x},\qquad \lvert x\rvert<1. $$ Differentiating each side of this, we find $$ \frac{1}{(1-x)^2}=\frac{d}{dx}\left[\frac{1}{1-x}\right]=\frac{d}{dx}\left[\sum_{k=0}^{\infty}x^k\right]=\sum_{k=1}^{\infty}kx^{k-1},\qquad \lvert x\rvert<1. $$ In particular, taking $x=\frac{5}{6}$ yields $$ \mathbb{E}[X]=\frac{1}{6}\sum_{k=1}^{\infty}k\left(\frac{5}{6}\right)^{k-1}=\frac{1}{6}\cdot\frac{1}{(1-\frac{5}{6})^2}=6. $$

Related Question