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.
We can use the runif function in R to choose random numbers from a uniform distribution in the interval [0, 1].
B <- runif(10000, min = 0, max = 1)
C <- runif(10000, min = 0, max = 1)
We can see that both B and C are proper uniform probability distributions by creating histograms of each random variable.
hist(B)
hist(C)
By creating a histogram of B + C we can see that although the two variables are uniform distributions their sum is not a uniform distribution. So we can find the probability that their sum would be less than 1/2 using simulation.
X <- B + C
hist(X, main = "Histogram of B + C")
a <- sum(X < .5) / 10000
a
## [1] 0.1243
We can see in the histogram below that B times C is a right skewed distribution, so once again, we can find the probability that BC < 1/2 using simulation.
X <- B * C
hist(X, main = "Histogram of B x C")
b <- sum(X < .5) / 10000
b
## [1] 0.8421
The absolute value of the difference between B and C is also not a uniform or normal distribution, so we will use simulation again to determine the probability that |B − C| < 1/2.
X <- abs(B - C)
hist(X, main = "Histogram of |B − C|")
c <- sum(X < .5) / 10000
c
## [1] 0.7535
We can also use simulation to find the probability that the max of B and C is less than 1/2.
X <- pmax(B,C)
hist(X, main = "Histogram of max{B,C}")
d <- sum(X < .5) / 10000
d
## [1] 0.2456
Finally, we will use simulation to find the probability that the min of B and C is less than 1/2.
X <- pmin(B,C)
hist(X, main = "Histogram of min{B,C}")
e <- sum(X < .5) / 10000
e
## [1] 0.7438