31
$\begingroup$

A game is played where a standard six sided dice is rolled until a $6$ is rolled, and the sum of all of the rolls up to and including the $6$ is taken. What is the probability that this sum is even?

I know that this is a geometric distribution and the expected number of rolls is $\frac1{1/6} = 6$ rolls until a $6$ occurs, along with the expected value being $21$ ($6$ rolls times expected value of $3.5$ per roll), but I'm not certain how to proceed from there. Would the expected range (if it is even relevant) be from $11 = 1·5+6$ to $31 = 5·5+6$? The answer is supposedly $\frac47$. I'm also curious about how this question would change if the stopping number was anything else, say a $3$ stopping the sequence rather than a $6$. Thank you in advance!

$\endgroup$
  • 1
    $\begingroup$ If you must stop at $1;\;3;\;5$ the probability is $\dfrac{3}{7}$. If you must stop at $2;\;4;\;6$ it is $\dfrac{4}{7}$. $\endgroup$ – Raffaele Jul 25 '17 at 10:38
  • $\begingroup$ Oh, I see! If we call $p$ the probability of the sum of rolls being odd, the equation for stopping on a $1$, $3$, or $5$ is the same as the one provided by carmichael561 and we can take $1-p$ for the probability of the sum being even. (Is that correct?) $\endgroup$ – Elk Chu Jul 25 '17 at 14:09
  • $\begingroup$ Shouldn't that be ⚅ instead of $6$? $\endgroup$ – Aaron Hall Jul 26 '17 at 2:25
51
$\begingroup$

Let $p$ be the desired probability, and consider the first roll. It is either a $6$, in which case we're done and the sum is even, a $2$ or $4$, in which case we want the sum of the rest of the terms to be even, or a $1,3$, or $5$, in which case we want the sum of the rest to be odd.

Thus $$p = \frac{1}{6}+ \frac{1}{3}p+\frac{1}{2}(1-p)$$ which simplifies to $p=\frac{4}{7}$.

$\endgroup$
  • 2
    $\begingroup$ Highly instructive and pedagogically valuable. I would appreciate to see a booklet with many examples presented this way. (+1) $\endgroup$ – Markus Scheuer Jul 25 '17 at 6:32
  • 1
    $\begingroup$ @MarkusScheuer: This is a standard technique, though one has to be careful to first prove that the desired quantity is finite. This is often missed out when dealing with expected value, since there could be nonzero probability of never stopping. Probabilities (as in this case) are always finite. $\endgroup$ – user21820 Jul 25 '17 at 8:36
  • 1
    $\begingroup$ @user21820: I know, thanks! What I really like in this answer is the clarity, ease and conciseness of the formulation. $\endgroup$ – Markus Scheuer Jul 25 '17 at 8:41
15
$\begingroup$

We need only consider the rolls before a $6$ is obtained, because rolling an even $6$ doesn't change the parity of our total. Let $p_n$ represent the probability that the sum of $n$ rolls, not including any $6$, is even. Then we have: $p_{n+1}=\frac25p_n + \frac35(1-p_n)$, because a $2$ or a $4$ keeps a previous even total even, while a $1$, $3$ or $5$ makes a previous odd total into an even total. This simplifies to: $p_{n+1}=\frac35-\frac15p_n$. We also have $p_0=1$. We can solve this recurrence, and find that

$$p_n=\frac12\left(1+\left(-\frac15\right)^n\right)$$

Now, let $x_n$ represent the probability of rolling $n$ non-6's before the first $6$, so $x_n=\frac16\left(\frac56\right)^n$. The number we need is:

$$\begin{align} \sum\limits_{n=0}^\infty x_np_n &= \sum\limits_{n=0}^\infty \left[\frac16\left(\frac56\right)^n\cdot\frac12\left(1+\left(-\frac15\right)^n\right)\right]\\ &=\frac1{12}\sum\limits_{n=0}^\infty \left[\left(\frac56\right)^n + \left(-\frac16\right)^n\right]\\ &=\frac1{12}\left(6 + \frac67\right) = \frac47 \end{align}$$

That said, @carmichael561's answer is much, much nicer.

$\endgroup$
  • 1
    $\begingroup$ Upvoted. (+1). Parallels very closely what I posted and appeared first. $\endgroup$ – Marko Riedel Jul 25 '17 at 23:08
10
$\begingroup$

Let $p$ be the probability that the sum of the die until(and including) the first six is even.

Let $R_1$ be the roll of the first die. So partitioning on this roll, and noticing the recurance:

$$p= \underline\qquad\,\mathsf P(R_1\in\{\underline\qquad\})+\underline\qquad\,\mathsf P(R_1\in\{\underline\qquad\})+\underline {~1~}\,\mathsf P(R_1=6)$$

Fill in the blanks, evalute the probabilities, and then solve for $p$.

$\endgroup$
7
$\begingroup$

Here is an answer using exponential generating functions. This problem has the features of a basic coupon collector (six coupons drawn with replacements). Note however that there is no requirement here of seeing all coupons. Now the probability that we took $m$ rolls to see the first six is by inspection given by

$$\frac{5^{m-1}}{6^m} = \frac{1}{6}\left(\frac{5}{6}\right)^{m-1}.$$

Observe that if the sum is even the odd values must have ocurred an even number of times, which gives the marked combinatorial class (one set of slots from the $m-1$ possible ones for each of the five admissible rolls of the die)

$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \textsc{SET}(\mathcal{U}\times\mathcal{Z}) \times \textsc{SET}(\mathcal{Z}) \times \textsc{SET}(\mathcal{U}\times\mathcal{Z}) \times \textsc{SET}(\mathcal{Z}) \times \textsc{SET}(\mathcal{U}\times\mathcal{Z}).$$

The corresponding EGF is

$$G(z, u) = \exp(2z)\exp(3uz).$$

Restricting to even sums we get

$$H(z) = \frac{1}{2} G(z, 1) + \frac{1}{2} G(z, -1) \\ = \frac{1}{2} \exp(5z) + \frac{1}{2} \exp(-z).$$

Extracting coefficients we find

$$(m-1)! [z^{m-1}] H(z) = \frac{1}{2} 5^{m-1} + \frac{1}{2} (-1)^{m-1}.$$

Hence the probability of an even sum given that we took $m$ draws is given by

$$\frac{1}{2} + \frac{1}{2} \left(-\frac{1}{5}\right)^{m-1}.$$

We thus get for the total probability

$$\frac{1}{12} \sum_{m\ge 1} \left(\frac{5}{6}\right)^{m-1} + \frac{1}{12} \sum_{m\ge 1} \left(-\frac{1}{6}\right)^{m-1} \\ = \frac{1}{12} \left(\frac{1}{1-5/6} + \frac{1}{1+1/6}\right) = \frac{4}{7}.$$

$\endgroup$
  • $\begingroup$ Very nice! (+1) $\endgroup$ – Markus Scheuer Jul 26 '17 at 21:10
0
$\begingroup$

The probability of any number 1 to 6 in rolling a dice is p1= 1/6 = 0.16666, therefore probability of getting desired number with condition of even or odd sum of numbers before getting desired number should be less than p1. lets investigate with python.

this is a simple function to simulate rolling dice

def onediceprobablity(Num,numoftry):

countNum = 0
for i in range(numoftry):
    if random.randint(1,6) == Num :
        countNum = countNum +1

return countNum/numoftry

Num is a number 1 to 6 and numoftry is our tries from 100000 to 1000000

here is the function that checks condition of problem

def dicesumeven(Num,numoftry):

EvenSum = 0
L = []
for i in range(numoftry):        
    N = random.randint(1,6)       
    L.append(N)

    if N == Num :
        Sum = sum(L)             
        L = []
        if (Sum % 2)  == 0:                
            EvenSum = EvenSum + 1                 

return EvenSum/numoftry

with Num = 6 and numoftry =1000000 probability p = 0.09538

this is the function for sum equals odd number

def dicesumodd(Num,numoftry):

oddSum = 0
L = []
for i in range(numoftry):        
    N = random.randint(1,6)       
    L.append(N)

    if N == Num :
        Sum = sum(L)             
        L = []
        if (Sum % 2)  == 1:                
            oddSum = oddSum + 1                 

return oddSum/numoftry

for 1000000 tries result is p2 = 0.071222

sum of p1 and p2 is about 1/6

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.