### Elina Azrilyan

September 23rd, 2019

#### Problem

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. Find the probability that

1. B + C < 1/2.

I am going to solve this problem by sumilating this data with 10,000 observations for each of these values (B and C). I will create a data frame with values from this dataset and calculate the probability based on the ratio of my observations. 10,000 observations should give me a large enough dataset for an accurate calculation.

n <- 10000
y <- as.data.frame(runif(n, min=0, max=1)+(runif(n, min=0, max=1)))
sum(punif(y<0.5, min=0, max=1)) / n
##  0.1253
1. BC < 1/2.
n <- 10000
y <- as.data.frame(runif(n, min=0, max=1)*(runif(n, min=0, max=1)))
sum(punif(y<0.5, min=0, max=1)) / n
##  0.8514
1. |B − C| < 1/2.
n <- 10000
y <- as.data.frame(abs((runif(n, min=0, max=1)-(runif(n, min=0, max=1)))))
sum(punif(y<0.5, min=0, max=1)) / n
##  0.7484
1. max{B,C} < 1/2.
n <- 10000
y <- as.data.frame(pmax((runif(n, min=0, max=1)),(runif(n, min=0, max=1))))
sum(punif(y<0.5, min=0, max=1)) / n
##  0.2522
1. min{B,C} < 1/2.
n <- 10000
y <- as.data.frame(pmin((runif(n, min=0, max=1)),(runif(n, min=0, max=1))))
sum(punif(y<0.5, min=0, max=1)) / n
##  0.7484