Question

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.

Answer

Create two numbers B and C using runif() function at random interval [0,1] with uniform distribution.

runif(n, min=0, max=1)

n <- 1000
B= runif(n, min = 0, max = 1)
C= runif(n, min = 0, max = 1)
head(B)
## [1] 0.92073083 0.67166870 0.00817044 0.72167689 0.66952487 0.23192298
head(C)
## [1] 0.1184130 0.1800139 0.9050050 0.8909407 0.3347253 0.8082520

Prove that B and C are proper probability distributions.

In order for B and C to be proper distribution. It needs to

\[f(x) \ge 0\]

for all values of x and;

\[\sum{f(x)}=1\]

hist(B)

hist(C)

Based on the histogram, we can see that B and C are proper distributions.

Find the probability B + C <1/2

D <- B+C
P1 <- sum(punif(D<1/2, min=0, max = 1))/n
P1
## [1] 0.121

Find the probability B*C < 1/2

E <- B*C
P2 <- sum(punif(E<1/2, min=0, max = 1))/n
P2
## [1] 0.829

Find the probability of absolute value of B-C < 1/2

G <- abs(B-C)
P3 <- sum(punif(G<1/2, min=0, max = 1))/n
P3
## [1] 0.741

Find the probability of maximum for each position in vector B and C <1/2

H <- pmax(B,C)
P4 <- sum(punif(H<1/2, min=0, max = 1))/n
P4
## [1] 0.249

Find the probability of minimum for each position in vector B and C <1/2

I <- pmin(B,C)
P5 <- sum(punif(I<1/2, min=0, max = 1))/n
P5
## [1] 0.734