Page 72, Q8 - f, g, h, i
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<\frac{1}{2}\enspace and\enspace 1-C<\frac{1}{2} \]
sum((B < .5) & ((1-C) < .5))/n
## [1] 0.25266
\[|B-C|<\frac{1}{2}\enspace and\enspace B<\frac{1}{2}\enspace and\enspace 1-C<\frac{1}{2} \]
sum((abs(B-C) < 1/2) & ((B < .5) & ((1-C) < .5))) /n
## [1] 0.12682
\[B^2+C^2\leq\frac{1}{2}\]
sum((B^2+C^2) <.5) /n
## [1] 0.39261
\[(B-\frac{1}{2})^2+(C-\frac{1}{2})^2<\frac{1}{4} \]
sum(((B-.5)^2)+((C-.5)^2) < 1/4) /n
## [1] 0.78658