ASSIGNMENT 5

IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS

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.

B and C are proper probabilty distrubution if both B and C have a 100% chance of falling in between [0,1] and B+C combined have a 100% chance of falling between [0,2].

#Randomly select 10000 numbers between 0 and 1
B <- runif(10000, min = 0, max =1)
head(B)
## [1] 0.74057450 0.03068801 0.88627389 0.03548966 0.24201665 0.35657772
tail(B)
## [1] 0.02326991 0.10574362 0.25785019 0.07701901 0.15139494 0.56881892
#Randomly select 10000 numbers between 0 and 1
C <- runif(10000, min = 0, max =1)
head(C)
## [1] 0.3987328 0.4601704 0.0364226 0.5340102 0.8581715 0.7288408
tail(C)
## [1] 0.6216544 0.4575811 0.8052547 0.8376759 0.5139549 0.1776830
head(B+C)
## [1] 1.1393073 0.4908584 0.9226965 0.5694999 1.1001881 1.0854185
tail(B+C)
## [1] 0.6449243 0.5633247 1.0631049 0.9146949 0.6653498 0.7465020

Find the probability that

  1. B + C < 1/2.
a <- sum((B+C) < .5)/10000
print(paste("The probability that B+C will be less than 1/2 is",a))
## [1] "The probability that B+C will be less than 1/2 is 0.1214"
  1. BC < 1/2.
b <- (sum((B*C) < .5)/10000)
print(paste("The probability that B*C will be less than 1/2 is",b))
## [1] "The probability that B*C will be less than 1/2 is 0.8527"
  1. |B ??? C| < 1/2.
c <- sum(abs((B-C)) < .5)/10000
print(paste("The probability that |B-C| will be less than 1/2 is",c))
## [1] "The probability that |B-C| will be less than 1/2 is 0.7509"
  1. max{B,C} < 1/2.
t <- 0
for(i in 1:10000){
  if(max(c(B[i],C[i])) < 0.5){
    t = t+1
  }
}
d <- t/10000
print(paste("The probability that max{B,C} will be less than 1/2 is",d))
## [1] "The probability that max{B,C} will be less than 1/2 is 0.2517"
  1. min{B,C} < 1/2.
t <- 0
for(i in 1:10000){
  if(min(c(B[i],C[i])) < 0.5){
    t = t+1
  }
}
e <- t/10000
print(paste("The probability that min{B,C} will be less than 1/2 is",e))
## [1] "The probability that min{B,C} will be less than 1/2 is 0.7538"