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. Note that the point (B,C) is then chosen at random in the unit square.
B <- runif(10000, min = 0, max = 1)
C <- runif(10000, min = 0, max = 1)
head(B)
## [1] 0.2452038 0.6086263 0.9209765 0.9175817 0.6109816 0.3463886
head(C)
## [1] 0.239169553 0.464629650 0.145858699 0.001651942 0.145754649 0.255741605
head(B+C)
## [1] 0.4843733 1.0732559 1.0668352 0.9192336 0.7567363 0.6021302
After creating a random sample space, the values of B and C fall between 0 and 1 and the sum of their probabilites, B and C, will equal 1.
x <- sum((B+C) < .5)/10000
print(paste("The probability of B+C being less than 1/2 is",x))
## [1] "The probability of B+C being less than 1/2 is 0.1169"
y <- (sum((B*C) < .5)/10000)
print(paste("The probability of BC being less than 1/2 is",y))
## [1] "The probability of BC being less than 1/2 is 0.8432"
w <- sum(abs((B-C)) < .5)/10000
print(paste("The probability of |B-C| being less than 1/2 is",w))
## [1] "The probability of |B-C| being less than 1/2 is 0.7473"
x <- 0
for(i in 1:10000){
if(max(c(B[i],C[i])) < 0.5){
x = x+1
}
}
y <- x/10000
print(paste("The probability that max{B,C} will be less than 1/2 is",y))
## [1] "The probability that max{B,C} will be less than 1/2 is 0.2487"
z <- 0
for(j in 1:10000){
if(min(c(B[j],C[j])) < 0.5){
z = z+1
}
}
w <- x/10000
print(paste("The probability that min{B,C} will be less than 1/2 is",w))
## [1] "The probability that min{B,C} will be less than 1/2 is 0.2487"