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.
Lets consider a sample size of 100000
n <- 100000
B <- runif(n)
C <- runif(n)
b <- as.data.frame(runif(n, min=0, max=1))
c <- as.data.frame(runif(n, min=0, max=1))
hist(b[,1], prob=TRUE, ylim=c(0,2), main = 'Histogram of B',col = "orange")
The Above Historgrams confirms that B and C are proper Probability Distributions.
Find the probability that
(a) B + C < 1/2.
## [1] "The probability of B+C less than 1/2 is 0.1245"
(b) BC < 1/2.
## [1] "The probability of B*C less than 1/2 is 0.847"
(c) |B − C| < 1/2.
## [1] "The probability of |B-C| be less than 1/2 is 0.75102"
(d) max{B,C} < 1/2.
max <- 0
for(i in 1:n){
if(max(B[i], C[i]) < 0.5){
max = max + 1
max
}
}
max <- max/n
print(paste("The probability of max{B,C} less than 1/2 is",max))
## [1] "The probability of max{B,C} less than 1/2 is 0.2488"
(e) min{B,C} < 1/2.
min <- 0
for(i in 1:n){
if(min(B[i], C[i]) < 0.5){
min = min + 1
min
}
}
min <- min/n
print(paste("The probability of min{B,C} less than 1/2 is",min))
## [1] "The probability of min{B,C} less than 1/2 is 0.74821"