(a) To generate an exponential random variable with parameter lambda = 2.5 using a standard uniform random variable U, we can use the inverse transform method. The inverse of the cumulative distribution function (cdf) of an exponential distribution is given by:
F^(-1)(U) = -ln(1 - U) / lambda
Therefore, to generate an exponential random variable X with parameter lambda = 2.5, we can compute:
X = -ln(1 - U) / 2.5
If U = 0.3972, then:
X = -ln(1 - 0.3972) / 2.5 = 0.3146
(b) To generate a Bernoulli random variable with probability of success p = 0.77 using a standard uniform random variable U, we can use the following algorithm:
Generate U from a standard uniform distribution.
If U is less than p, set the Bernoulli random variable to 1 (success); otherwise, set it to 0 (failure).
If U = 0.3972 and p = 0.77, then:
Since U < p, the Bernoulli random variable is 1 (success).
(c) To generate a binomial random variable with parameters n = 15 and p = 0.4 using a standard uniform random variable U, we can use the following algorithm:
Generate U from a standard uniform distribution.
If U is less than p, count the trial as a success; otherwise, count it as a failure.
Repeat steps 1 and 2 for a total of n trials.
The binomial random variable is the number of successes.
If U = 0.3972 and n = 15, p = 0.4, then:
First trial: U > p, count as a failure.
Second trial: U < p, count as a success.
Third trial: U < p, count as a success.
Fourth trial: U > p, count as a failure.
Fifth trial: U > p, count as a failure.
Sixth trial: U > p, count as a failure.
Seventh trial: U > p, count as a failure.
Eighth trial: U < p, count as a success.
Ninth trial: U > p, count as a failure.
Tenth trial: U > p, count as a failure.
Eleventh trial: U > p, count as a failure.
Twelfth trial: U < p, count as a success.
Thirteenth trial: U > p, count as a failure.
Fourteenth trial: U > p, count as a failure.
Fifteenth trial: U < p, count as a success.
Therefore, the binomial random variable is 5 (number of successes).
(d) To generate a discrete random variable with distribution P(x), where P(0) = 0.2, P(2) = 0.4, P(7) = 0.3, P(11) = 0.1 using a standard uniform random variable U, we can use the following algorithm:
Generate U from a standard uniform distribution.
If U is less than P(0), set the random variable to 0; otherwise, check the next interval.
If U is less than P(0) + P(2), set the random variable to 2; otherwise, check the next interval.
If U is less than P(0) + P(2) + P(7), set the random variable to 7; otherwise, set it to 11.
If U = 0.3972, then:
First, we need to compute the cumulative probabilities for the distribution:
P(0) = 0.2
P(2) = 0.2 + 0.4 = 0.6
P(7) = 0.6 + 0.3 = 0.9
P(11) = 0.9 + 0.1 = 1.0
Since U is between 0.6 and 0.9, the random variable is 7.
(e) To generate a continuous random variable with the density f(x) = 3x^2, 0 < x < 1 using a standard uniform random variable U, we can use the inverse transform method. The cumulative distribution function of the continuous random variable is:
F(x) = ∫0x f(t) dt = x^3
Solving for x in terms of U, we get:
U = F(x) = x^3
x = U^(1/3)
If U = 0.3972, then:
x = 0.3972^(1/3) = 0.7269
Therefore, the continuous random variable is approximately 0.7269.
(f) To generate a continuous random variable with the density f(x) = 1.5x^2, -1 < x < 1 using a standard uniform random variable U, we can use the following algorithm:
Generate U from a standard uniform distribution.
If U is less than 0.5, set the random variable to
- 1; otherwise, set it to 1 -

If U = 0.3972, then:
Since U < 0.5, the random variable is:

(g) To generate a continuous random variable with the density f(x) = |x|, -1 < x < 1 using a standard uniform random variable U, we can use the following algorithm:
Generate U from a standard uniform distribution.
If U is less than 0.5, set the random variable to
otherwise, set it to

If U = 0.3972, then:
Since U < 0.5, the random variable is:
