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.

#runif allows me to choose two numbers at random from the interval [0,1]. I will call these numbers B and C
B <- runif(10000, min=0, max=1)
C <- runif(10000, min=0, max=1)

Histograms below prove that B and C are proper probability distributions.

# uniform and total frequency = 10000
hist (B, probability = TRUE)

# uniform and total frequency = 10000
hist (C, probability = TRUE) 

Find the probability that

\[{(a)} B + C < 1/2\]

# numerator = count of how many (B,C) points have a sum less than 0.5
# denominator = 10000 or the length of B or the length of C
sum ((B+C) < 0.5) / length(B)
## [1] 0.124
a <- B + C
#histogram part a
hist (a, main = 'BC Sums', probability = TRUE)

\[{(b)} BC < 1/2\]

# numerator = count of how many (B,C) points have a product less than 0.5
# denominator = 10000 or the length of B or the length of C
sum ((B*C) < 0.5) / length(C)
## [1] 0.847
b <- B * C
#histogram part b
hist (b, main = 'BC Products', probability = TRUE)

\[{(c)} |B-C| < 1/2 \]

# numerator = count of how many (B,C) points have an absolute value difference of B and C less than 0.5
# denominator = 10000 or the length of B or the length of C
sum (abs(B-C) < 0.5) / 10000
## [1] 0.7496
c <- abs(B - C)
#histogram part c
hist (c, main = '|B-C|', probability = TRUE)

\[{(d)} max[B,C] < 1/2 \]

#use pmax function
bc_max <- pmax (B,C)
# numerator = count of how many (B,C) points have a maximum value less than 0.5
# denominator = 10000 or the length of B or the length of C
probability_max <- sum(bc_max < 0.5) / 10000
probability_max
## [1] 0.2468
#histogram part d
hist (bc_max, main = 'max{B,C}', probability = TRUE)

\[{(e)} min[B,C] < 1/2 \]

#use pmin function
bc_min <- pmin (B,C)
# numerator = count of how many (B,C) points have a minimum value less than 0.5
# denominator = 10000 or the length of B or the length of C
probability_min <- sum(bc_min < 0.5) / 10000
probability_min
## [1] 0.7499
#histogram part e

hist (bc_min, main = 'min{B,C}', probability = TRUE)