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.
For B and C to be proper probability distriubtions, their CDF over the whole interval must equal 1. We make sure that is the case:
\(\int _{ 0 }^{ 1 }{ 1dx }\)
\(=x{ | }_{ 0 }^{ 1 }\) =1
Different funcions of B & C represent a bivariate uniform distriubtion. These probabilities can be solved with either double integration, geometry, or simulation. For this excercise, simulation is by far the most effective method.
This can be rewritten B = C - 1/2. This is going to be a triangle with heigth 1/2 and length 1/2, whose area is .125
B <- runif(1000000)
C <- runif(1000000)
Z <- B + C
prob <- length(Z[Z<= .5])/1000000
prob
## [1] 0.125276
Looking at the unit square, this will be everything but the upper right hand arc with base and height 1/2. It will be the around \(1-{ 1/2 }^{ 3 }\) = .875
Z <- B * C
prob <- length(Z[Z<= .5])/1000000
prob
## [1] 0.8466
This will be the area bewteen two parrallel lines with slope 1 starting at (0, .5) and (.5, 0). It can be easily computed as 1-2*{ (1/2 }^{ 3 }) = .75
Z <- abs(B - C)
prob <- length(Z[Z<= .5])/1000000
prob
## [1] 0.749801
This is represented by everything except the square in the lower left hand corcer with sides of .5. It is equal to \(1-{ .5 }^{ 2 }\) or .75
D <- matrix(c(B,C), nrow = 1000000, ncol = 2)
Z <- apply(D, 1, max)
prob <- length(Z[Z<= .5])/1000000
prob
## [1] 0.250484
This will be the compliment of the previous probability, so we expect .25
D <- matrix(c(B,C), nrow = 1000000, ncol = 2)
Z <- apply(D, 1, min)
prob <- length(Z[Z<= .5])/1000000
prob
## [1] 0.750252
In all cases the probabilites checked out with what we expected intuitively.