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.
n = 10000
B = runif(n, min = 0, max = 1)
C = runif(n, min = 0, max = 1)
sum((B+C) <0.5)/n
## [1] 0.124
hist((B+C), main = "Histogram of B + C")
hist((B*C), main = "Histogram of B * C")
sum((B*C)<0.5)/n
## [1] 0.846
hist(abs(B-C), main = "Histogram of |B ??? C|")
sum(abs(B-C)<0.5)/n
## [1] 0.7536
hist(pmax(B,C), main = "Histogram of max{B,C}")
index <- 0
for (x in 1:n){
if(max(c(B[x],C[x])) < 0.5 ){
index = index + 1
}
}
index/n
## [1] 0.2481
hist(pmin(B,C), main = "Histogram of min{B,C}")
index <- 0
for (x in 1:n){
if(min(c(B[x],C[x])) < 0.5 ){
index = index + 1
}
}
index/n
## [1] 0.7507