Probability of rolling 1 and 2 when rolling an unfair die 8 times

If you roll a die 8 times, what is the probabiliy of getting both 1 and 2.

$P(1) = .3$

$P(2) = .1$

$P(3) = .15$

$P(4) = .15$

$P(5) = .15$

$P(6) = .15$

-
Sometimes it helps to think up ways of partitioning the set of all outcomes into disjoint sets. Maybe the outcomes where the 2 comes before the 1 and vice versa? – Seth May 31 '12 at 3:10

I guess the easiest way to solve this is: 1-P(no 1)-P(no 2)+P(no 1 or 2) = $1-0.7^8-0.9^8+0.6^8$

We have to add +P(no 1 or 2) because otherwise we would be subtracting it twice. Ie. P(no 1) includes the case where we don't roll 1 or 2 and so does the P(no 2).

Another way would be to use Markov chain with states S={no 1 or 2, only 1, only 2, 1 and 2}. Corresponding transition matrix is:

$D = \left[ \begin{array}{ccc} 0.6 & 0.3 & 0.1 & 0 \\ 0 & 0.9 & 0 & 0.1 \\ 0 & 0 & 0.7 & 0.3 \\ 0 & 0 & 0 & 1 \end{array} \right]$

Then calculate $D^8$ etc.

-
+1 Interestingly, when you calculate the $(1,4)$ entry in $D^8$ by diagonalizing it, the resulting formula is identical to the one produced by the "easiest way": the eigenvalues are $1$, $0.7$, $0.9$, and $0.6$ and the signs $1,-1,-1,1$ come from the last row (or column) in the inverse of the transition matrix (matrix of eigenvectors). – whuber May 31 '12 at 15:29

If you know about generating functions, you can do it as follows:

Let $a=0.3, b= 0.1, c=1-a-b$, then the answer is: \begin{align} \int_0^r\int_0^s\left.\frac{d^2(ax + by + c)^8}{dxdy}dxdy\right|_{r=s=1} \end{align}

But, really, for this problem Seth's suggestion is best. Try to break it into different cases whose probability you can easily calculate. (You can do it with three terms.)

-

=1- P(you don't roll a 1 or 2)

-
In this case is it much easier to compute P(you don't roll a 1 or 2)? If so shouldn't you show why? – Michael Chernick May 31 '12 at 10:36
Maybe you want 1-P(not (1 and 2)) – Seth May 31 '12 at 16:18

The probability of exactly a 1 once and a 2 once is 0.3(0.1)(0.6$^6$)=0.03(0.046656)=0.00139968 for each possible position of a 1 and a 2 to occur. So we multiply 0.03 by that number. The possiblilities are

(1) 12NNNNNN (2) 21NNNNNN (3) 1N2NNNNN (4) 2N1NNNNN
(5) 1NN2NNNN (6) 2NN1NNNN (7) 1NNN2NNN (8) 2NNN1NNN
(9) 1NNNN2NN (10)2NNNN1NN (11)1NNNNN2N (12)2NNNNN1N
(13)1NNNNNN2 (14)2NNNNNN1 (15)N12NNNNN (16)N21NNNNN
(17)N1N2NNNN (18)N2N1NNNN (19)N1NN2NNN (20)N2NN1NNN
(21)N1NNN2NN (22)N2NNN1NN (23)N1NNNN2N (24)N2NNNN1N
(25)N1NNNNN2 (26)N2NNNNN1 (27)NN12NNNN (28)NN21NNNN
(29)NN1N2NNN (30)NN2N1NNN (31)NN1NN2NN (32)NN2NN1NN
(33)NN1NNN2N (34)NN2NNN1N (35)NN1NNNN2 (36)NN2NNNN1
(37)NNN12NNN (38)NNN21NNN (39)NNN1N2NN (40)NNN2N1NN
(41)NNN1NN2N (42)NNN2NN1N (43)NNN1NNN2 (44)NNN2NNN1
(45)NNNN12NN (46)NNNN21NN (47)NNNN1N2N (48)NNNN2N1N
(49)NNNN1NN2 (50)NNNN2NN1 (51)NNNNN12N (52)NNNNN21N
(53)NNNNN1N2 (54)NNNNN2N1 (55)NNNNNN12 (56)NNNNNN21


So the probability of exactly one 1 and one 2 is 56(0.00139968)=0.07838208 In addition to this we would add probability of two 1s and one two, one 1 and two 2s, two 1s and two 2s etc.

-
The probability of rolling a 1 once and a 2 once is $\binom{8}{2} 0.3 \cdot 0.1 \cdot 0.6^6$, but the question asks for the probability that you get at least one 1 and at least one 2. – Neil G May 31 '12 at 5:51
@NeilG I chose to list the specific terms to get one 1 snd one 2 and pointed out how to get the other terms. So I was aware of the question and pointed out how to get it without doing all the work for the OP. One can do the combinatorics but sometimes for beginners it helps to show how those results come about. – Michael Chernick May 31 '12 at 10:33
Illustrations like this indeed can be good, Michael, but basing this one on the problem as stated produces so much detail that insight may be hard to come by. Producing a similar illustration for a simplified version of the problem (such as four throws) and formatting it neatly (as a table or graphic) would better communicate your idea. – whuber May 31 '12 at 13:42
(1) Removing the spaces between 1,2,N helps. (2) Beautiful pictures no longer take much effort or time; they only need facility with appropriate software. One thing about this site that initially impressed me was how easily people were able to offer great illustrations using R, typically needing just an extra (short) line of code. (To get the resulting image into a reply requires two short dialogs: one to save it on disk and another to load that onto the Web.) So, in practice, "extraordinary effort" often amounts just to an extra minute of work. – whuber May 31 '12 at 14:36
@whuber Thanks for doing that for me Bill. Maybe I should have said "extra effort". I appreciate the nice answers that you and many others have given on the site. Your unit roots response was one great example of that. I spend way too much time on this site. That is how I got my reputation points up so fast (maybe with the help of a lot of good answers). But I guess I don't want to go to the extra effort myself and I don't expect the moderators and other members to do it for me either (even though you often do). I think people appreciate what I write anyway. – Michael Chernick May 31 '12 at 14:49
show 1 more comment