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.

The first step to solving this problem is to define B and C. To do this, we can use R’s runif() function. The runif() function takes 3 arguments: n (the number of observations we wish to make), min (the lower limit of the distribution), and finally max, (the upper limit of the distribution). These arguments combined make this function is a good fit for defining the numbers B and C as per the assignment instructions.

# Randomly define numbers B and C from the interval [0, 1], with 10000 observations.
B <- runif(10000, 0, 1)
C <- runif(10000, 0, 1)
Prove that B and C are proper probability distributions.

In order for B and C to be considered proper probability distributions, their cumulative distribution function must be equal to one. The below two plots prove that this is the case.

# Create a plot to Prove that B is a proper probability distribution.
dataframe_b <- as.data.frame(B)
ggplot2::ggplot(dataframe_b, ggplot2::aes(B)) +
  geom_density(color = 'black', fill = 'PaleVioletRed') +
  theme_minimal() +
  labs(title = 'Proof That B is a Proper Probability Distribution',
       x = "Probabilities of B are between 0 and 1",
       y = "The sum of all probabilities of B is equal to 1")

# Create a plot to Prove that C is a proper probability distribution.
dataframe_c <- as.data.frame(C)
ggplot2::ggplot(dataframe_c, ggplot2::aes(C)) +
  geom_density(color = 'black', fill = 'SteelBlue') +
  theme_minimal() +
  labs(title = 'Proof That C is a Proper Probability Distribution',
       x = "Probabilities of C are between 0 and 1",
       y = "The sum of all probabilities of C is equal to 1")

Find the probability that:

(a) B + C < 1/2.
probability_a <- round(sum((B + C) < .5) / 10000, 2)
probability_a
## [1] 0.13

Answer: The probability that B + C < 1/2 is 0.13.

(b) BC < 1/2.
probability_b <- round(sum((B * C) < .5) / 10000, 2)
probability_b
## [1] 0.85

Answer: The probability that BC < 1/2 is 0.84.

(c) |B − C| < 1/2.
probability_c <- round(sum(abs((B - C)) < .5) / 10000, 2)
probability_c
## [1] 0.75

Answer: The probability that |B − C| < 1/2 is 0.75.

(d) max{B,C} < 1/2.
probability_d <- round(sum(pmax(B, C) < .5) / 10000, 2)
probability_d
## [1] 0.25

Answer: The probability that max{B,C} < 1/2 is 0.25.

(e) min{B,C} < 1/2.
probability_e <- round(sum(pmin(B, C) < .5) / 10000, 2)
probability_e
## [1] 0.75

Answer: The probability that min{B,C} < 1/2 is 0.75.