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
For uniform distribution http://www.r-tutor.com/elementary-statistics/probability-distributions/continuous-uniform-distribution
# B + C < 1/2.
p = vector("numeric", 500)
for (i in 1:500) {
B = runif(1, min=0, max=1)
C = runif(1, min=0, max=1)
if (B+C < 0.5) {
p[i] = 1
}
else {
p[i] = 0
}
}
paste("The probablity of B+C < 1/2: " , sum(p)/500)
## [1] "The probablity of B+C < 1/2: 0.12"
# BC < 1/2.
p = vector("numeric", 500)
for (i in 1:500) {
B = runif(1, min=0, max=1)
C = runif(1, min=0, max=1)
if (B*C < 0.5) {
p[i] = 1
}
else {
p[i] = 0
}
}
paste("The probablity of B*C < 1/2: " , sum(p)/500)
## [1] "The probablity of B*C < 1/2: 0.828"
# |B-C| < 1/2.
p = vector("numeric", 500)
for (i in 1:500) {
B = runif(1, min=0, max=1)
C = runif(1, min=0, max=1)
if (abs(B-C) < 0.5) {
p[i] = 1
}
else {
p[i] = 0
}
}
paste("The probablity of |B-C| < 1/2: " , sum(p)/500)
## [1] "The probablity of |B-C| < 1/2: 0.766"
# max{B,C} < 1/2.
p = vector("numeric", 500)
for (i in 1:500) {
B = runif(1, min=0, max=1)
C = runif(1, min=0, max=1)
if (max(B, C) < 0.5) {
p[i] = 1
}
else {
p[i] = 0
}
}
paste("The probablity of max{B,C} < 1/2: " , sum(p)/500)
## [1] "The probablity of max{B,C} < 1/2: 0.244"
# min{B,C} < 1/2.
p = vector("numeric", 500)
for (i in 1:500) {
B = runif(1, min=0, max=1)
C = runif(1, min=0, max=1)
if (min(B, C) < 0.5) {
p[i] = 1
}
else {
p[i] = 0
}
}
paste("The probablity of min{B,C} < 1/2: " , sum(p)/500)
## [1] "The probablity of min{B,C} < 1/2: 0.752"