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.
#B and C choosen randomly from the interval [0, 1] with uniform density
library(tidyverse)
set.seed(123)
n <- 100000
B <- runif(n, 0, 1)
C <- runif(n, 0, 1)
#Proof that B and C are proper probability distributions
as.data.frame(B) %>%
ggplot(aes(B)) +
geom_density(color="darkblue", fill="lightblue") +
theme_minimal() +
labs(title = "Proper Probability Distributions",
x = "All the probabilities is between 0 and 1 inclusive",
y = "Sum of the probabilities of the outcome is 1")
as.data.frame(C) %>%
ggplot(aes(C)) +
geom_density(color="#E69F00", fill="#56B4E9") +
theme_minimal() +
labs(title = "Proper Probability Distributions",
x = "All the probabilities is between 0 and 1 inclusive",
y = "Sum of the probabilities of the outcome is 1")
Find the probability that
\[B+C<\frac{1}{2} \]
(sum((B + C) < 1/2)) / n
## [1] 0.12426
\[BC<\frac{1}{2}\]
(sum((B*C) < 1/2)) / n
## [1] 0.84809
\[|B-C|<\frac{1}{2} \]
(sum(abs(B-C) < 1/2)) / n
## [1] 0.74896
\[max{B,C}<\frac{1}{2} \]
(sum(pmax(B,C) < 1/2)) / n
## [1] 0.24993
\[min{B,C}<\frac{1}{2} \]
(sum(pmin(B,C) < 1/2)) / n
## [1] 0.75264