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.

Using an R function runif, we were able to generate a randomised set of values thousand times between 0 and 1, and assign these values to A and B. When we plot these A and B, we can clearly see that these are well distributed with a uniform density, proving that these are with proper probability distribution.

n = 1000
min = 0
max = 1

B = runif(n,min,max)

C = runif(n,min,max)

plot(B, xlab = 'index', ylab = 'B value')

plot(C, xlab = 'index', ylab = 'C value')

Find the probability that

(a) B + C < 1/2.

count <- 0
for (i in 1:n) {
  if((B[i] + C[i]) < 0.5) {
    count = count + 1
  }
}

print(paste("The probability B+C less than 1/2 is ", count/n))
## [1] "The probability B+C less than 1/2 is  0.133"

(b) BC < 1/2.

count <- 0
for (i in 1:n) {
  if((B[i] * C[i]) < 0.5) {
    count = count + 1
  }
}

print(paste("The probability BC less than 1/2 is ", count/n))
## [1] "The probability BC less than 1/2 is  0.848"

(c) |B - C| < 1/2.

count <- 0
for (i in 1:n) {
  if(abs(B[i] - C[i]) < 0.5) {
    count = count + 1
  }
}

print(paste("The probability BC less than 1/2 is ", count/n))
## [1] "The probability BC less than 1/2 is  0.745"

(d) max{B, C} < 1/2.

count <- 0
for (i in 1:n) {
  if(max(B[i], C[i]) < 1/2) {
    count = count + 1
  }
}

print(paste("The probability max{B, C} less than 1/2 is ", count/n))
## [1] "The probability max{B, C} less than 1/2 is  0.262"

(e) min{B, C} < 1/2.

count <- 0
for (i in 1:n) {
  if(min(B[i], C[i]) < 1/2) {
    count = count + 1
  }
}

print(paste("The probability min{B, C} less than 1/2 is ", count/n))
## [1] "The probability min{B, C} less than 1/2 is  0.767"