Choose independently two numbers B and C at random from the interval [0, 1] with uniform density. Prove that B and C are proper probability distributions.
All the probabilities must be between 0 and 1 inclusive The sum of the probabilities of the outcomes must be 1.
b <- runif(n = 1000000,0,1)
c <- runif(n = 1000000,0,1)
hist(b)
hist(c)
B and C are between 0 and 1 inclusive and the sum of the probabilities of the outcomes must be 1 therefore B and C are proper probability distributions
Note that the point (B,C) is then chosen at random in the unit square. Find the probability that
P1 <-sum((b+c) < 1/2)/length(c)
P1
## [1] 0.124838
P2 <-sum((b*c) < 1/2)/length(b)
P2
## [1] 0.846191
P3 <-sum( abs((b-c)) < 1/2)/length(b)
P3
## [1] 0.750129
By simulation:
s1<- 0
for (i in 1:length(b)) {
if (abs(b[i]-c[i]) < 1/2) {
s1 <- s1 + 1
}
}
P3<- s1 / length(b)
P3
## [1] 0.750129
s2<- 0
for (i in 1:length(b)) {
if (max(b[i],c[i]) < 1/2) {
s2 <- s2 + 1
}
}
P4<- s2 / length(b)
P4
## [1] 0.249978
s3 <- 0
for (i in 1:length(b)) {
if (min(b[i],c[i]) < 1/2) {
s3 <- s3 + 1
}
}
P5<- s3/ length(b)
P5
## [1] 0.750156