Let the expected number of throws needed be $x$.
Now, if we throw a dice we can have 2 cases:
- The resulting throw is not a 6. So now the expected number of throws becomes $(x+1)$ as we are back where we started and we have used up 1 throw.
- The resulting throw is a 6.
- If the next throw also results in a 6 then expected number of throws is 2.
- If the next throw is not a 6 then the expected number of throws becomes $(x+2)$ as we are back where we started and we have used up 2 throws.
$\therefore E[X]= \frac{5}{6}(x+1) + \frac{1}{36}(2) + \frac{5}{36}(x+2)$
$x= \frac{5}{6}(x+1) + \frac{1}{36}(2) + \frac{5}{36}(x+2)$
After solving you get $x=42$
Regarding how to solve these kinds of problems:
- For above example you can have infinite amount of cases. So you can try above solution approach.
- But if the number of cases are finite and you can find them easily then refer to this question GATE 2021 probability