A. B + C < 1/2.

  • Prove its a proper pdf textbook

  • given equations above all integrals are positive which can be seen in f(z(z))
  • to prove integration equals 1 add integral over 0-1 function and 1-2 function

a <- as.numeric(integrate(function(x){x},0,1)[1])
b <- as.numeric(integrate(function(x){2-x},1,2)[1])
a+b
## [1] 1

Solve by simulation

sim_b_plus_c <- function(){
b <- runif(1)
c <- runif(1)
if (b+c<.5)
    return (1)
else
    return(0)
}
b_plus_c <-mean(replicate(1000000,sim_b_plus_c()))
paste("b+c< .5 ",b_plus_c*100, " % of the time")
## [1] "b+c< .5  12.4082  % of the time"

solve using PDF provided by textbook

\[ .5*z^2... if 1>z>0 \] \[ .5^3= .125 \]

Problem B: BC < 1/2.

  • Build graphs to attempt to verify pdf

link for ecdf

  • ECDF shows a total of 1, and all values of hist are positive
hist_btimes_c <-   replicate(100000,(runif(1)*runif(1)))
hist(hist_btimes_c,probability = TRUE)

P = ecdf(hist_btimes_c) 
plot(P)

P(.5)
## [1] 0.84691

solve by simulation

  • 84.6277 %
sim_b_times_c <- function(){
b <- runif(1)
c <- runif(1)
if (b*c<.5)
    return (1)
else
    return(0)
}
b_times_c <-mean(replicate(1000000,sim_b_times_c()))
paste("b*c< .5 ",b_times_c*100, " % of the time")
## [1] "b*c< .5  84.6854  % of the time"

Problem C: |B − C| < 1/2.

  • Build graphs to attempt to verify pdf
  • ECDF shows a total of 1, and all values of hist are positive
abs_bminus_c <-   replicate(100000,(abs(runif(1)-runif(1))))
hist(abs_bminus_c,probability = TRUE)

P = ecdf(abs_bminus_c) 
plot(P)

##extract CDf value
P(.5)
## [1] 0.75092

Solve using simulation

sim_abs_b_minus_c <- function(){
b <- runif(1)
c <- runif(1)
if (abs(b-c)<.5)
    return (1)
else
    return(0)
}
abs_b_minus_c <-mean(replicate(1000000,sim_abs_b_minus_c()))
paste("|b-c|< .5 ",abs_b_minus_c*100, " % of the time")
## [1] "|b-c|< .5  74.9758  % of the time"

Problem D: max{B,C} < 1/2.

  • Build graphs to attempt to verify pdf
  • ECDF shows a total of 1, and all values of hist are positive
max_b_c <-   replicate(100000,(max(runif(1),runif(1))))
hist(max_b_c,probability = TRUE)

P = ecdf(max_b_c) 
plot(P)

##extract CDf value
P(.5)
## [1] 0.24785

Solve by simulation

sim_max_b_c <- function(){
b <- runif(1)
c <- runif(1)
if (max(b,c)<.5)
    return (1)
else
    return(0)
}
max_b_c <-mean(replicate(1000000,sim_max_b_c()))
paste("max(b,c) < .5 ",max_b_c*100, " % of the time")
## [1] "max(b,c) < .5  24.9756  % of the time"

Problem E: min{B,C} < 1/2.

  • Build graphs to attempt to verify pdf
  • ECDF shows a total of 1, and all values of hist are positive
min_b_c <-   replicate(100000,(min(runif(1),runif(1))))
hist(min_b_c,probability = TRUE)

P = ecdf(min_b_c) 
##extract CDf value
P(.5)
## [1] 0.75055

Solve by simulation

sim_min_b_c <- function(){
b <- runif(1)
c <- runif(1)
if (min(b,c)<.5)
    return (1)
else
    return(0)
}
min_b_c <-mean(replicate(1000000,sim_min_b_c()))
paste("min(b,c) < .5 ",min_b_c*100, " % of the time")
## [1] "min(b,c) < .5  74.9267  % of the time"