1. What is the probability of rolling a sum of 12 on three rolls of six-sided dice?

expand.grid(die1=1:6,
            die2=1:6,
            die3=1:6)
##     die1 die2 die3
## 1      1    1    1
## 2      2    1    1
## 3      3    1    1
## 4      4    1    1
## 5      5    1    1
## 6      6    1    1
## 7      1    2    1
## 8      2    2    1
## 9      3    2    1
## 10     4    2    1
## 11     5    2    1
## 12     6    2    1
## 13     1    3    1
## 14     2    3    1
## 15     3    3    1
## 16     4    3    1
## 17     5    3    1
## 18     6    3    1
## 19     1    4    1
## 20     2    4    1
## 21     3    4    1
## 22     4    4    1
## 23     5    4    1
## 24     6    4    1
## 25     1    5    1
## 26     2    5    1
## 27     3    5    1
## 28     4    5    1
## 29     5    5    1
## 30     6    5    1
## 31     1    6    1
## 32     2    6    1
## 33     3    6    1
## 34     4    6    1
## 35     5    6    1
## 36     6    6    1
## 37     1    1    2
## 38     2    1    2
## 39     3    1    2
## 40     4    1    2
## 41     5    1    2
## 42     6    1    2
## 43     1    2    2
## 44     2    2    2
## 45     3    2    2
## 46     4    2    2
## 47     5    2    2
## 48     6    2    2
## 49     1    3    2
## 50     2    3    2
## 51     3    3    2
## 52     4    3    2
## 53     5    3    2
## 54     6    3    2
## 55     1    4    2
## 56     2    4    2
## 57     3    4    2
## 58     4    4    2
## 59     5    4    2
## 60     6    4    2
## 61     1    5    2
## 62     2    5    2
## 63     3    5    2
## 64     4    5    2
## 65     5    5    2
## 66     6    5    2
## 67     1    6    2
## 68     2    6    2
## 69     3    6    2
## 70     4    6    2
## 71     5    6    2
## 72     6    6    2
## 73     1    1    3
## 74     2    1    3
## 75     3    1    3
## 76     4    1    3
## 77     5    1    3
## 78     6    1    3
## 79     1    2    3
## 80     2    2    3
## 81     3    2    3
## 82     4    2    3
## 83     5    2    3
## 84     6    2    3
## 85     1    3    3
## 86     2    3    3
## 87     3    3    3
## 88     4    3    3
## 89     5    3    3
## 90     6    3    3
## 91     1    4    3
## 92     2    4    3
## 93     3    4    3
## 94     4    4    3
## 95     5    4    3
## 96     6    4    3
## 97     1    5    3
## 98     2    5    3
## 99     3    5    3
## 100    4    5    3
## 101    5    5    3
## 102    6    5    3
## 103    1    6    3
## 104    2    6    3
## 105    3    6    3
## 106    4    6    3
## 107    5    6    3
## 108    6    6    3
## 109    1    1    4
## 110    2    1    4
## 111    3    1    4
## 112    4    1    4
## 113    5    1    4
## 114    6    1    4
## 115    1    2    4
## 116    2    2    4
## 117    3    2    4
## 118    4    2    4
## 119    5    2    4
## 120    6    2    4
## 121    1    3    4
## 122    2    3    4
## 123    3    3    4
## 124    4    3    4
## 125    5    3    4
## 126    6    3    4
## 127    1    4    4
## 128    2    4    4
## 129    3    4    4
## 130    4    4    4
## 131    5    4    4
## 132    6    4    4
## 133    1    5    4
## 134    2    5    4
## 135    3    5    4
## 136    4    5    4
## 137    5    5    4
## 138    6    5    4
## 139    1    6    4
## 140    2    6    4
## 141    3    6    4
## 142    4    6    4
## 143    5    6    4
## 144    6    6    4
## 145    1    1    5
## 146    2    1    5
## 147    3    1    5
## 148    4    1    5
## 149    5    1    5
## 150    6    1    5
## 151    1    2    5
## 152    2    2    5
## 153    3    2    5
## 154    4    2    5
## 155    5    2    5
## 156    6    2    5
## 157    1    3    5
## 158    2    3    5
## 159    3    3    5
## 160    4    3    5
## 161    5    3    5
## 162    6    3    5
## 163    1    4    5
## 164    2    4    5
## 165    3    4    5
## 166    4    4    5
## 167    5    4    5
## 168    6    4    5
## 169    1    5    5
## 170    2    5    5
## 171    3    5    5
## 172    4    5    5
## 173    5    5    5
## 174    6    5    5
## 175    1    6    5
## 176    2    6    5
## 177    3    6    5
## 178    4    6    5
## 179    5    6    5
## 180    6    6    5
## 181    1    1    6
## 182    2    1    6
## 183    3    1    6
## 184    4    1    6
## 185    5    1    6
## 186    6    1    6
## 187    1    2    6
## 188    2    2    6
## 189    3    2    6
## 190    4    2    6
## 191    5    2    6
## 192    6    2    6
## 193    1    3    6
## 194    2    3    6
## 195    3    3    6
## 196    4    3    6
## 197    5    3    6
## 198    6    3    6
## 199    1    4    6
## 200    2    4    6
## 201    3    4    6
## 202    4    4    6
## 203    5    4    6
## 204    6    4    6
## 205    1    5    6
## 206    2    5    6
## 207    3    5    6
## 208    4    5    6
## 209    5    5    6
## 210    6    5    6
## 211    1    6    6
## 212    2    6    6
## 213    3    6    6
## 214    4    6    6
## 215    5    6    6
## 216    6    6    6
total <- rowSums(expand.grid(die1 = 1:6, die2 = 1:6, die3 = 1:6))
total 
##   [1]  3  4  5  6  7  8  4  5  6  7  8  9  5  6  7  8  9 10  6  7  8  9 10 11  7
##  [26]  8  9 10 11 12  8  9 10 11 12 13  4  5  6  7  8  9  5  6  7  8  9 10  6  7
##  [51]  8  9 10 11  7  8  9 10 11 12  8  9 10 11 12 13  9 10 11 12 13 14  5  6  7
##  [76]  8  9 10  6  7  8  9 10 11  7  8  9 10 11 12  8  9 10 11 12 13  9 10 11 12
## [101] 13 14 10 11 12 13 14 15  6  7  8  9 10 11  7  8  9 10 11 12  8  9 10 11 12
## [126] 13  9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16  7  8  9 10 11 12
## [151]  8  9 10 11 12 13  9 10 11 12 13 14 10 11 12 13 14 15 11 12 13 14 15 16 12
## [176] 13 14 15 16 17  8  9 10 11 12 13  9 10 11 12 13 14 10 11 12 13 14 15 11 12
## [201] 13 14 15 16 12 13 14 15 16 17 13 14 15 16 17 18
?length
## starting httpd help server ... done
length(total[total==12])
## [1] 25
## P=N/D

x<-25/216
x
## [1] 0.1157407
round(x, digits = 3)
## [1] 0.116

Answer is 0.116 or 11.6%

Q2

install.packages(“Matrix”)

install.packages(“concatenate”)

mymat = matrix(data = c(200,200,100,200,200, 300,100,200,100,100), nrow = 5, byrow = FALSE # implies sequence is filled into columns )

cbind(mymat, rowSums(mymat))

mymat = rbind(mymat, colSums(mymat) )


#Q3

#Two cards are drawn without replacement from a standard deck of 52 playing cards. #What is the probability of choosing a diamond for the second card drawn, if the first #card, drawn without replacement, was a diamond?

#A= First card drawn #B= Second card drawn

#Conditional Probability Formula will be applied.

x<-(13/52) * (12/51) / (13/52)

x

#Answer 0.2352941

round(x, digits = 3)

#Answer: 0.235

#Q4

#Permutation Problem

Formula

#(20!)/(20!-10!)

factorial(20)/factorial(10)

#Answer: 670442572800

#Q5

#Answer can be fetched by Multiplication rule of counting

20 * 20* 18

#7200 is the answer

6

This question can be solved using permutation

#10!/10!-10! #10!

1098765432*1

#Answer 3628800

#Q7

#‘Multiplication rule of Counting’

2^76^3choose(52,4)

#Q8

factorial(3)*factorial(4)

#Q9

#Using Bayes Formula

#A=user, A’=Not a user, B=Positive , B’=Negative

.95 .03 / (.95 .03 + .01*.97 )

#Answer 0.7460733

#10

#Solved using Bayes Probability theorem

#g1g2, g2g1, b1b2, b2b1, g1b2, b2g1

x <- ((3/6) * (2/3) ) / (3/6)

#Answer 0.6666667

round(x,digits=3)

0.667