Expected Value Problem with a 10 Sided Die I have a $10$ sided die numbered $1-10$. I keep rolling it until it lands on a prime number. Let $X$ be the number of times I roll the die.
What is the expected value $E(X)$?
What I have so far is the probability of rolling a prime is $P(\text{prime}) = \frac{4}{10}$.
How do I calculate the expected value? I tried the formula: $$\sum_{s\in S} P(s) \cdot X(s) = P(1)X(1) + P(2)X(2) +P(3)X(3)+P(4)X(4)$$
Where $P(s)$ is the probability of rolling a prime and $X(s)$ is the number of rolls. I plug in $\frac{4}{10}$ for each $P$ and $X$ is incremented from $1$. I am getting $4$ and the answer is $\frac{10}4$. Can someone guide me to what is going wrong here?
 A: Hint
$$E(X) = \frac{4}{10} + 2 \cdot \frac{6}{10} \cdot \frac{4}{10} + 3 \cdot \left(\frac{6}{10}\right)^2 \cdot \frac{4}{10} +.... + (n+1) \cdot \left(\frac{6}{10}\right)^n \cdot \frac{4}{10} + ... \infty$$
A: Your formula should be
$E(X) = \sum_{x=1}^{\infty} xP(x)$
The probability that you only have one dice roll (x=1) is equal to the probability that you roll a prime on the first roll. That's $\frac{4}{10}$
The probability that you have two dice rolls (x=2) is equal to the probability that you first roll a non-prime and then roll a prime. That's $\frac{6}{10} \times \frac{4}{10}$
The probability that you have $n$ dice rolls is equal to the probability that you first roll a non-prime for the first $n-1$ times and then roll a prime. That's $(\frac{6}{10})^{n-1} \times \frac{4}{10}$.
So using that in the formula for $E(X)$ gives:
$E(X) = \sum_{x=1}^{\infty} x(\frac{6}{10})^{x-1} \times \frac{4}{10}$
A: With all the help above I found the solution.
The probability of a success (getting a prime number from the die) is $P(success) = \frac{4}{10}$. Each trial is independent and we have no set number of trails to get a success, leading to the conclusion that this is a geometric distribution. Therefore, the solution we get is:
$$E(X) = \frac{1}{P(success)} = \frac{1}{\frac{4}{10}} = \frac{10}{4}$$.
A: The key thing you are doing wrong is that you need $P(s)$ to be the probability of rolling a prime on turn $s$ and not before. So $P(1)=\frac{4}{10}$, $P(2)=\frac{6}{10}\times\frac{4}{10}$, etc. It appears you just calculated $P(s)$ as the probability of getting a prime on turn $s$.
You also need to add up all the terms, not just the first four (you are not guaranteed to get a prime within four goes).
