Assignment 5

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.

The variables \(B\) and \(C\) are set below using uniform distribution for 1000 observations on the designated interval:

B <-runif(1000,min=0,max=1)
C <-runif(1000,min=0,max=1)

Let \(X\) representing variables \(B\) and \(C\):

\[P\begin{pmatrix}a< X < b\end{pmatrix}=\int_{a}^{b}f(x)\space dx = \text{area under the curve}\]

Probability A

Find the probability that: \(B + C < \frac{1}{2}\)

The probability distribution can also be visualized as follows:

## [1] "The probability of B + C < 0.5 can be approximated from the area: 0.1"

This can also be calculated:

\[P\begin{pmatrix}0< X < \frac{1}{2}\end{pmatrix}=\int_{0}^{\frac{1}{2}}1\space{dx}=1\]

# Calculate Intergral
f <- function(x){x}
integrate(f = f, lower = 0, upper = .5) -> integralA
## [1] "The probability B + C < 0.5 is 0.125"

Probability B

Find the probability that: \(BC < 1/2\)

## [1] "The probability of BC < 0.5 can be approximated from the area: 0.839"
# Calculate Intergral
f <- function(x){x}
integrate(f = f, lower = .5, upper = 1) -> integralB

# Calculate area 
round((.5 + integralB$value), 3) -> answerB
## [1] "The probability BC < 1/2 is 0.875"

Probability C

Find the probability that: \(|B - C| < 1/2\)

## [1] "The probability of |B - C| < 0.5 can be approximated from the area: 0.773"
# Calculate Intergral
f <- function(x){2-2*x}
integrate(f = f, lower = 0, upper = .5) -> integralC
## [1] "The probability of |B - C| < 0.5  is 0.75"

Probability D

Find the probability that: \(max{B,C} < 1/2\)

## [1] "The probability of max{B,C} < 1/2 can be approximated from the area: 0.284"
# Calculate Intergral
f <- function(x){2*x}
integrate(f = f, lower = 0, upper = .5) -> integralD
## [1] "The Probability max{B,C} < 1/2 is 0.25"

Probability E

Find the probability that: \(min{B,C} < 1/2\)

## [1] "The probability of min{B,C} < 1/2 can be approximated from the area: 0.738"
# Calculate Intergral
f <- function(x){2-2*x}
integrate(f = f, lower = 0, upper = .5) -> integralE
## [1] "The Probability min{B,C} < 1/2 is 0.75"