Probability and Areas Under Curve

Load Packages

library(knitr)
library(matlib)

Problem Set

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 < 1/2.

Answer:
First, I graphed the function, with an online graphing calculator (https://www.geogebra.org/graphing?lang=en), and copied that as JPG file. The graph is copied below:

We obsere that the blue area satisfies the inequality B + C < 1/2. It’s the area under the straight line, passing through (0.5, 0) and (0, 0.5), which lie within the unit square. Computation of the area of the blue right-triangle is done in below code-chunk.

1/2 * 0.5 * 0.5
## [1] 0.125

The area of the unit square is 1. Therefore, the proportion of area under the right-triangle = 0.125 / 1 = 0.125.

Therefore probability of B + C < 1/2 is 0.125.

  1. BC < 1/2.

Answer:

We observe that within the unit square, graph runs from the point (0.5, 1) to (1, 0.5). The total area within the blue region can be split into two parts:

  1. The rectangle through the points: (0, 0), (0.5, 0), (0.5, 1), (1, 0). Let’s call this region R1.
  2. Area under the curve through (0.5, 1) to (1, 0.5). Let’s call this region R2.

Now, we’ll compute the areas of R1 and R2, in the below code-chunks.

R1 <- 0.5 * 1
R1
## [1] 0.5

To find the area of R2, we have to integrate the curve y = (1/2.x), from 0.5 to 1. We already saw the integrand function of the curve earlier. We’ll do that in the following:

func <- function(x) {1/(2 * x)}
R2 <- integrate(func, lower = .5, upper = 1)
R2
## 0.3465736 with absolute error < 3.8e-15

We observe that R1 is 0.5 and R2 is 0.3465736.
Therefore, the total area (R1 + R2) is:

0.5 + 0.3465736
## [1] 0.8465736

Therefore probability of BC < 1/2 is 0.8465736.

  1. |B - C| < 1/2.

Answer:

First, I graphed the function, with calculator, and copied the JPG file. The graph is copied below:

Now, we’ll compute the area of the blue shaded region. It covers the whole unit square, except for the two right triangles at the top and bottom right corners. Two sides of each of the triangles are: 0.5 & 0.5.

Area of each of the triangles are computed below:

A <- 1/2 * 0.5 * 0.5
print(paste('A = ', A))
## [1] "A =  0.125"
print(paste('Sum of areas of two triangles = ', 2 * A))
## [1] "Sum of areas of two triangles =  0.25"

Therefore, area of the shaded region is complement of the triangular areas in the unit square, which is computed below:

print(paste('Shaded area = ', 1 - 2 * A))
## [1] "Shaded area =  0.75"

Therefore probability of |B - C| < 1/2 is 0.75.

  1. max{B, c} < 1/2.

Answer:

P(max{B, c} < 1/2) = P(B <= 1/2, C <= 1/2) = P(B <= 1/2).P(C <= 1/2) = 1/2 . 1/2 = 1/4 = 0.25.

Therefore probability of max{B, C} < 1/2 is 0.25.

  1. min{B, c} < 1/2.

Answer:

P(min{B, c} <= 1/2) = 1 - P(min{B, c} > 1/2) = 1 - P(B > 1/2, C > 1/2) = 1 - P(B > 1/2).P(C > 1/2)
= 1 - { 1 - P(B <= 1/2) }.{ 1 - P(C <= 1/2) }
= 1 - (1 - 1/2).(1 - 1/2)
= 1 - (1/2) . (1/2) = 1 - 1/4 = 3/4 = 0.75

Therefore probability of min{B, C} < 1/2 is 0.75.

Marker: 605-05