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:

A

\(B+C<\frac{1}{2}\)

\(C<\frac{1}{2}-B\)

\(B<\frac{1}{2}-C\)

When \(B=0\), \(C<\frac{1}{2}\)

When \(C=0\), \(B<\frac{1}{2}\)

B <- c(0,.5)
C <- c(.5,0)
plot(B, C, type = "l", xlim = c(0,1), ylim = c(0,1))

The area of the triangle is our percentage of probability, so \(B \times C \times \frac{1}{2}\) = \(\frac{1}{2} \times \frac{1}{2} \times \frac{1}{2} = \frac{1}{8}\)

Results of the simulation

i <- 1
x <- c()
while(i <= 100000) {
  B <- runif(1, 0, 1)
  C <- runif(1, 0, 1)
  x <- c(x, B+C)
  i <- i + 1
}

count <- c()
for(i in x) {if(i<.5) count <- c(count, i)}

prob <- length(count)/100000
print(paste0("The probability result from the simulation is ", round(prob, 3)))
## [1] "The probability result from the simulation is 0.125"
print(paste0("The actual probability is ", 1/8))
## [1] "The actual probability is 0.125"

B

\(BC < \frac{1}{2}\)

\(C < \frac{1}{2B}\)

\(B < \frac{1}{2C}\)

When \(B=1\), \(C<\frac{1}{2}\)

When \(C=1\), \(B<\frac{1}{2}\)

plot(0, 0, type = 'p', xlab = "B", ylab = "C", xlim = c(0,1), ylim = c(0,1))
curve(1/(2*x), from = .5, to = 1, n =100, add = TRUE)

In the unit square, \(\frac{1}{2}\) of the square’s area is in the earea under the curve. The rectangle B(0,.5) and C(0,1). To find the area under the curve, we need to find the area under the curve when \(1<C<\frac{1}{2}\) plus \(\frac{1}{2}\)

\(\frac{1}{2} + \int \frac{1}{2B}db\) = \(\frac{1}{2} + \frac{1}{2}log(2)\) = 84.7%

Results of the simulation.

i <- 1
x <- c()
while(i <= 100000) {
  B <- runif(1, 0, 1)
  C <- runif(1, 0, 1)
  x <- c(x, B*C)
  i <- i + 1
}

count <- c()
for(i in x) {if(i<.5) count <- c(count, i)}

prob <- length(count)/100000

print(paste0("The probability result from the simulation is ", round(prob, 3)))
## [1] "The probability result from the simulation is 0.847"
print(paste0("The actual probability is ", round(.5*(1+log(2)),3)))
## [1] "The actual probability is 0.847"

C

\(|B-C|< \frac{1}{2}\)

\(= -\frac{1}{2} < |B-C| < \frac{1}{2}\)

When \(B=0\), \(C<\frac{1}{2}\) & \(C>1\frac{1}{2}\)(outside the limit)

When \(B=\frac{1}{2}\), \(C>0\) & \(C<1\)

When \(B=1\), \(C>\frac{1}{2}\) & \(C<\frac{3}{2}\)(outside the limit)

The area of probability is between the two lines, ignoring the vertical line in the middle. To find this, we take the area of the square and subtract the upper-left triangle and lower-right triangle areas.

\(1 - (\frac{1}{2} \times \frac{1}{2} \times \frac{1}{2}) - (\frac{1}{2} \times \frac{1}{2} \times \frac{1}{2}) = \frac{3}{4}\)

B <- c(0,.5)
C <- c(.5,1)
D <- c(.5, 1)
E <- c(0, .5)
plot(c(B, C), c(D,E), type = "l", xlim = c(0,1), ylim = c(0,1), xlab = "B", ylab = "C")

Results of the simulation

i <- 1
x <- c()
while(i <= 100000) {
  B <- runif(1, 0, 1)
  C <- runif(1, 0, 1)
  x <- c(x, abs(B-C))
  i <- i + 1
}

count <- c()
for(i in x) {if(i<.5) count <- c(count, i)}

prob <- length(count)/100000

print(paste0("The probability result from the simulation is ", round(prob, 3)))
## [1] "The probability result from the simulation is 0.748"
print(paste0("The actual probability is ", round(3/4),3))
## [1] "The actual probability is 13"

D

\(max\{B,C\}<\frac{1}{2}\)

For this to make sense, both \(B\) AND \(C\) need be less than \(\frac{1}{2}\)

plot(c(0,1), c(0,1), type = 'n', xlab = "B", ylab = "C")
rect(0,0,.5,.5, col = 4)

With all B and C coordinates less than \(\frac{1}{2}\), we find the area of the blue square.

\(\frac{1}{2} \times \frac{1}{2} = \frac{1}{4}\)

i <- 1
x <- c()
while(i <= 100000) {
  B <- runif(1, 0, 1)
  C <- runif(1, 0, 1)
  x <- c(x, max(c(B,C)))
  i <- i + 1
}

count <- c()
for(i in x) {if(i<.5) count <- c(count, i)}

prob <- length(count)/100000

print(paste0("The probability result from the simulation is ", round(prob, 3)))
## [1] "The probability result from the simulation is 0.253"
print(paste0("The actual probability is ", .75))
## [1] "The actual probability is 0.75"

E

\(min\{B,C\} < \frac{1}{2}\)

For this to make sense, either \(B\) OR \(C\) need be less than \(\frac{1}{2}\)

plot(c(0,1), c(0,1), type = 'n', xlab = "B", ylab = "C")
rect(0,0,.5,1, col = 4)
rect(.5,0,1,.5, col=4)

Since if BOTH B and C coordinates are greater than \(\frac{1}{2}\), they fall outside the area of probability, so we subract the area of the white square from the total area.

\(1 - (\frac{1}{2} \times \frac{1}{2}) = \frac{3}{4}\)

i <- 1
x <- c()
while(i <= 100000) {
  B <- runif(1, 0, 1)
  C <- runif(1, 0, 1)
  x <- c(x, max(c(B,C)))
  i <- i + 1
}

count <- c()
for(i in x) {if(i<.5) count <- c(count, i)}

prob <- length(count)/100000

print(paste0("The probability result from the simulation is ", round(prob, 3)))
## [1] "The probability result from the simulation is 0.251"
print(paste0("The actual probability is ", 0.25))
## [1] "The actual probability is 0.25"