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.
Our general approach here will be to simulate the values using a large sample size and then solve the probability questions mathematically.
(a) Find the probability that (a) B + C < 1/2.
Simulation:
B <- runif(10000, min = 0, max = 1)
C <- runif(10000, min = 0, max = 1)
sum((B + C) < .5) / 10000
## [1] 0.1292
Math:
integrate(function(x){x}, lower = 0, upper = .5)
## 0.125 with absolute error < 1.4e-15
.125 chance B + C is less than .5.
(b) BC < 1/2.
Simulation:
sum((B*C) < .5) / 10000
## [1] 0.8525
Math:
B * C < 1/2 Let’s use B = .5/C Can’t figure out how to integrate this from 0 to .5 using r. But the 0 to .5 segment of this is going to = 1, so 1 * .5. We’ll add that to the integral of this equation from .5 to 1.
bc <- integrate(function(x){.5/x}, lower = .5, upper = 1, subdivisions = 1000)
bc$value + .5
## [1] 0.8465736
(c) |B - C| < 1/2.
Simulation:
sum(abs(B - C) < .5) / 10000
## [1] 0.7475
Math:
I can’t figure out how to do this one using legit math.
(d) max{B,C} < 1/2.
Simulation:
#pmax will give you maximum per B and C, whereas max would give
sum(pmax(B,C) < .5) / 10000
## [1] 0.2584
Math:
Probability that two independent numbers will be less than .5 = .5 ^ 2 = .25
(e) min{B,C} < 1/2.
Simulation:
sum(pmin(B,C) < .5) / 10000
## [1] 0.7565
Math:
Probability that minimum of two number will be less than .5. Complement of above. 1 - .5^2 = .75