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.
P( B + C < 1/2 )
P(0 <= B <= 1/2) * P(0 <= C <= 1/2) * P(B.or.C < 1/2 - C.or.B)
1/2 * 1/2 * 1/2
1/8
P(BC < 1/2) = 1 - Integral from 0 to .5
fun <- function(x) {x}
FunInt <- integrate(fun, lower = 0, upper = .5)
1 - FunInt$value
## [1] 0.875
P(B > 1/2 , C > 1/2) + P(C < 1/2, B < 1/2) + P()
1/2 * 1/2 + 1/2 * 1/2
1/2
P(B<1/2) * P(C<1/2)
1/2 * 1/2
1/4
1 - (P(B>1/2) * P(C>1/2))
1 - (.5 * .5)
1 - .25
.75
Pepare Data Frame
set.seed(123)
B <- runif(100000, min = 0, max = 1)
C <- runif(100000, min = 0, max = 1)
DF <- data.frame(B,C)
DF$p1 <- DF$B + DF$C
DF$p2 <- DF$B*DF$C
DF$p3 <- DF$B - DF$C
Check Values
### B + C < 1/2
nrow(DF[DF$p1<.5,])/nrow(DF)
## [1] 0.12426
### BC < 1/2.
nrow(DF[DF$p2<.5,])/nrow(DF)
## [1] 0.84809
### |B − C| < 1/2.
(nrow(DF[DF$p3<.5,]) + nrow(DF[DF$p3>-.5,]))/nrow(DF)
## [1] 1.74896
### max{B,C} < 1/2.
nrow(DF[DF$B<.5 & DF$C<.5,])/nrow(DF)
## [1] 0.24993
### min{B,C} < 1/2.
nrow(DF[DF$B<.5 | DF$C<.5,])/nrow(DF)
## [1] 0.75264
As we see - these match our above calculations considerably.