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.

Part 1

Prove that B and C are proper probability distributions:

Answer:

B and C are proper probability distributions happens only if both B and C are uniformly distributed between the interval [0, 1].

Consider a continuous, random variable X with the support over the domain \(\chi\), [0,1]. The probability density function (PDF) of X is the function \({ f }_{ X }(x)\) such that for any two numbers a and b in the domain [0,1], with a < b,

\[P\left[ a<X\le b \right] =\int _{ a }^{ b }{ { f }_{ X } } (x)dx\]

For \({ f }_{ X }(x)\) to be a proper probability distribution, it must satisfy the following two properties:

  1. The PDF \({ f }_{ X }(x)\) is positive-valued; \({ f }_{ X }(x)\ge 0\) for all values of $x$

  2. The rule of total probability holds where the total area under \({ f }_{ X }(x)\) is 1; \(\int _{ \chi }^{ } \int _{ X }^{ }{ (x)dx=1 }\).

From the demonstration below, we can see that both B and C meet above two properties. We can see from the empirical cumulative distribution plot shows the non-decreasing positive Fn(x) values for all values between the unit interval meets the first property condition. The density histogram shows the total area under the curve is 1 meets the second property condition.

Further, we can see that the 1 million samples randomly drawn from a uniform distribution (histogram plot) approximate well the uniform probability distribution (line plot).

Proof of B:

n <- 1000000

# 1 million random numbers between 0 to 1 for B
B <- runif(n, min=0, max=1)

# Check values are all positive
min(B)
## [1] 1.565088e-06
max(B)
## [1] 0.9999998
# Empirical cumulative distribution plot 
plot(ecdf(B), main = "Empirical Cumulative Distribution for the Interval [0,1]")

# Check areas under the curve is 1
hist(B, freq = FALSE, xlab = 'x', density = 20, probability = TRUE)

# Uniform distribution
hist(B, 
     freq = FALSE, 
     xlab = 'x',  
     ylim = c(0, 1.2),
     xlim = c(-0.2,1.2),
     density = 20,
     probability = TRUE,
     main = "Uniform Distribution for the Interval [0,1]")
curve(dunif(x, min = 0, max = 1), 
      from = -5, to = 5, 
      n = 1000000, 
      col = "darkblue", 
      lwd = 2, 
      add = TRUE, 
      yaxt = "n",
      ylab = 'probability')

Proof of C:

# 1 million random numbers between 0 to 1 for C
C <- runif(n, min=0, max=1)

# Check values are all positive
min(C)
## [1] 3.49246e-08
max(C)
## [1] 0.9999999
# Empirical cumulative distribution plot 
plot(ecdf(C), main = "Empirical Cumulative Distribution for the Interval [0,1]")

# Check areas under the curve is 1
hist(C, freq = FALSE, xlab = 'x', density = 20, probability = TRUE)

# Uniform distribution
hist(C, 
     freq = FALSE, 
     xlab = 'x',  
     ylim = c(0, 1.2),
     xlim = c(-0.2,1.2),
     density = 20,
     probability = TRUE,
     main = "Uniform Distribution for the Interval [0,1]")
curve(dunif(x, min = 0, max = 1), 
      from = -5, to = 5, 
      n = 1000000, 
      col = "darkblue", 
      lwd = 2, 
      add = TRUE, 
      yaxt = "n",
      ylab = 'probability')

Part 2

Since B and C are two randomly chosen numbers from a unit square [0,1], the probability satisfying a condition simply the area because the denominator is 1.

Find the probability that:

(A)

\[B+C<\frac { 1 }{ 2 }\]

Answer:

The area of XYO = 1/2 * 1/2 * 1/2
= 1/8

So, P(B+C < 1/2) = 1/8 (0.125)

or using the “punif” function to estimate the probability as demonstrated in below.

sum(punif((B+C)<0.5, min=0, max=1)) / n
## [1] 0.125363

(B)

\[BC<\frac { 1 }{ 2 }\]

Answer:

The area of PXZRYOP = area of PXYO + area of XZRYX
= (1/2)*1 + \(\frac { 1 }{ 2 } \int _{ 1/2 }^{ 1 }{ \frac { 1 }{ b } } db\)
= 1/2 + \(\frac { ln(1) }{ 2 } - \frac { ln(1/2) }{ 2 }\)
= 1/2 + \(\frac { 0 }{ 2 } - \frac { ln(1) - ln(2) }{ 2 }\)
= 1/2 + \(\frac { ln(2) }{ 2 }\)
\(\simeq\) 0.8466

So, P(BC < 1/2) \(\simeq\) 0.8466

or using the “punif” function to estimate the probability as demonstrated in below.

sum(punif((B*C)<0.5, min=0, max=1)) / n
## [1] 0.846695

(C)

\[\left| B-C \right| <\frac { 1 }{ 2 }\]

Answer:

The area of XQYZOW = 1 - area of PXW - area of YRZ
= 1 - (1/2)(1/2)(1/2) - (1/2)(1/2)(1/2)
= 1 - 1/8 - 1/8
= 6/8
= 3/4

So,P(|B-C| < 1/2) = 3/4

or using the “punif” function to estimate the probability as demonstrated in below.

sum(punif(abs(B-C)<0.5, min=0, max=1)) / n
## [1] 0.749665

(D)

\[max\left\{ B,C \right\} <\frac { 1 }{ 2 }\]

Answer:

The area of XYZO = 1/2 * 1/2
= 1/4

So, P(max{B,C} < 1/2) = 1/4

or using the for loop and if function to count the number of maximum B or C less than 1/2 as demonstrated in below.

sum <- 0
for(i in 1:length(B)){
  if(max(B[i], C[i]) < 0.5){
    sum = sum+1
  }
}

print(noquote(paste("The probability for max{B,C} < 1/2 is: ", round(sum/length(B), digits=2))))
## [1] The probability for max{B,C} < 1/2 is:  0.25

(E)

\[min\left\{ B,C \right\} <\frac { 1 }{ 2 }\]

Answer:

The area of PXYZRO = 1 - area of XYZQ
= 1 - 1/2*1/2
= 1 -1/4
= 3/4

So, P(min{B,C} < 1/2) = 3/4

or using the for loop and if function to count the number of minimum B or C less than 1/2 as demonstrated in below.

sum <- 0
for(i in 1:length(B)){
  if(min(B[i], C[i]) < 0.5){
    sum = sum+1
  }
}

print(noquote(paste("The probability for min{B,C} < 1/2 is: ", round(sum/length(B), digits=2))))
## [1] The probability for min{B,C} < 1/2 is:  0.75