Chapter 5 Exercise 12

Let a number \(U\) be chosen at random in the interval \([0, 1]\). Find the probability that:

(a) \(R = U^2 < \frac{1}{4}\)

# Create a sequence of numbers from 0 to 1
u_values <- seq(0, 1, by = 0.01)

# Calculate R for each value of U
r_values <- u_values^2

# Count how many R values are less than 1/4
prob_a <- mean(r_values < 0.25)

# Print the probability
print(prob_a)
## [1] 0.4950495

(b) \(S = U(1 - U) < \frac{1}{4}\)

Similarly, we calculate \(S = U(1 - U)\) for each value in the sequence and check how many of them satisfy the condition.

# Calculate S for each value of U
s_values <- u_values * (1 - u_values)

# Count how many S values are less than 1/4
prob_b <- mean(s_values < 0.25)

# Print the probability
print(prob_b)
## [1] 0.990099

(c) \(T = \frac{U}{1 - U} < \frac{1}{4}\)

Again, we compute \(T = \frac{U}{1 - U}\) for each value in the sequence, avoiding division by zero, and check the condition.

# Calculate T for each value of U, avoiding division by zero for U = 1
t_values <- ifelse(u_values < 1, u_values / (1 - u_values), NA)

# Count how many T values are less than 1/4
prob_c <- mean(t_values < 0.25, na.rm = TRUE)

# Print the probability
print(prob_c)
## [1] 0.2