Task

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:

  1. B + C < 1/2
  2. B*C < 1/2
  3. |B − C| < 1/2
  4. max{B,C} < 1/2
  5. min{B,C} < 1/2

Solution

library(ggplot2)

Randomly select 20,000 numbers from the interval [0, 1].

B <- runif(10000, min = 0, max = 1)
C <- runif(10000, min = 0, max = 1)
hist(B, probability = TRUE)

hist(C, probability = TRUE)

The probability density function for a uniform random variable in the interval [0,1] is the function

ρ(x)= 1 if x∈[0,1] OR 0 otherwise.

A uniform distribution, sometimes also known as a rectangular distribution, is a distribution that has constant probability.

As we see all outcomes are between 0 and 1 and equally likely (uniform density).

1. B + C < 1/2

If we consider B + C < 1/2 as a y = 0.5 - x and plot the line, then P( B + C < 1/2) is going to be an area under that line.

x <- seq(from=0,to=100,length.out=10000)
y <- 0.5-x

ggplot()+
  geom_rect(aes(xmin=0, xmax=1, ymin=0,ymax=1), alpha=0.5)+
  xlim(0,1)+ylim(0,1)+
  geom_line(aes(x,y))

P (B + C < 1/2) = 0.5*0.5/2 = 0.125

2. B*C < 1/2

We can consider BC < 1/2 as x = 0.5/y, then P (BC < 1/2) is going to be an area under that curve.

y <- 0.5/x
ggplot()+
  geom_rect(aes(xmin=0, xmax=1, ymin=0,ymax=1), alpha=0.5)+
  xlim(0,1)+ylim(0,1)+
  geom_line(aes(x,y))

P( B*C < 1/2 ) = 0.5 + \[\int_{0.5}^{1} 1/2x \,dx\] = 0.5 + 0.34657 = 0.84657

3. |B − C| < 1/2

x1 <- seq(from=0,to=100,length.out=10000)
x2<- seq(from=0,to=100,length.out=10000)

y1 <- x1-0.5
y2 <- x2+0.5

ggplot()+
  geom_rect(aes(xmin=0, xmax=1, ymin=0,ymax=1), alpha=0.5)+
  xlim(0,1)+ylim(0,1)+
  geom_line(aes(x1,y1))+
  geom_line(aes(x2,y2))

P (|B − C| < 1/2) = 1 - 2*0.125 = 0.75

4. max{B,C} < 1/2

max {B, C} = x1, if x1 > x2 or x2, otherwise

The maximum of any finitely many elements that are less than 0.5.

ggplot()+
  geom_rect(aes(xmin=0, xmax=1, ymin=0,ymax=1), alpha=0.5)+
  xlim(0,1)+ylim(0,1)+
  geom_polygon(aes(x = c(0,0,0.5,0.5)), y = c(0,0.5,0.5,0))

max{B,C} < 1/2 is colored in black on the graph.

P (max{B,C} < 1/2) = 0.5*0.5 = 0.25

5. min{B,C} < 1/2

ggplot()+
  geom_rect(aes(xmin=0, xmax=1, ymin=0,ymax=1), alpha=0.5)+
  xlim(0,1)+ylim(0,1)+
  geom_polygon(aes(x = c(0.5, 0.5, 1, 1)), y = c(0.5,1,1,0.5))

The minimum of any finitely many elements that are less than 0.5.

min{B,C} < 1/2 is colored in grey on the graph.

P(min{B,C} < 1/2) = 1 - 0.25 = 0.75