Random Variable Modified PDF
Random Variable Modified PDF
Random variable:
A random variable is a variable whose possible values are numerical outcomes of a random
experiments. Usually written as X.
There are two types of random variables,
a) Discrete random variable
b) Continuous random variable
1
Random variable
The probability distribution of the random variable X can be easily summarized in a table as:
X 0 1 2 Total
p(x) 1 2 1 1
4 4 4
This p(x) is also a probability function.
2
Random variable
When X and Y are continuous, the probabilities f(x, y) must satisfy the following:
1. f(x, y) ≥ 0
∞ ∞
2. ∫−∞ ∫−∞ 𝑓(𝑥, 𝑦) d𝑥d𝑦 = 1.
Mean: The average value of a random variable is called the expected value of the random
variable. If X is a random variable, then its mean (expectation) is given by-
E(X) = ∑∞
𝑥=0 𝑥 𝑝(x), if X is discrete
∞
= ∫−∞ 𝑥 𝑓(𝑥)dx, if X is continuous.
Where, E(X 2 ) = ∑∞ 2
𝑥=0 𝑥 𝑝(𝑥), if X is discrete
∞
= ∫−∞ 𝑥 2 𝑓(𝑥)dx, if X is continuous.
3
Random variable
Example 4.1: A random sample of graduates was surveyed at AIUB. A question that was asked
is: How many times did you change majors? The results are shown in a probability distribution
as:
X 0 1 2 3 4 5 Total
P(X) 0.28 0.37 0.23 0.09 0.02 0.01 1
Find the probability that a randomly selected graduate changed majors (a) more than once, (b)
less or two times, and (c) four or more times.
Solution:
(a) P(X > 1) = P(X = 2) + P(X = 3) + P(X = 4) + P(X = 5) = 0.23 + 0.09 + 0.02 + 0.01 = 0.35.
(b) P(X ≤ 2) = P(X = 0) + P(X = 1) + P(X = 2) = 0.28 + 0.37 + 0.23 = 0.88.
(c) P(X ≥ 4) = P(X = 4) + P(X = 5) = 0.02 + 0.01 = 0.03.
4
Random variable
Example 4.2: A fair coin is tossed three times. Let the random variable X be the number of
heads. Find the mean, variance and standard deviation of X. Also, find E (X + 1), E (2X - 1), V(X
- 1), V (2X + 1).
Solution: Sample space, S = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT}. Then,
X 0 1 2 3 Total
P(X) 1 3 3 1 1
8 8 8 8
1 3 3 1 12 3
Mean: E(X) = ∑∞
𝑥=0 𝑥 𝑝(𝑥) = (0 × 8) + (1 × 8) + (2 × 8) + (3 × 8) = = 2 = 1.5.
8
1 3 3 1
E(𝑋 2 ) = ∑∞ 2 2 2 2 2
𝑥=0 𝑥 𝑝(𝑥) = (0 × 8) + (1 × 8) + (2 × 8) + (3 × 8) = 3,
3 3
Variance: V(X) = E(𝑋 2 ) – [E(X)]2 = 3 − (2)2 = = 0.75, Standard deviation, σ = √V(𝑋) =
4
√0.75 .
E(X + 1) = E(X) + 1 = 1.5 + 1 = 2.5.
E(2X− 1) = 2E(X) − 1 = 3 − 1 = 2.
V(X − 1) = V(X) = 0.75.
V(2X + 1) = 22 V(X) = 4 × 0.75 = 3.
Example 4.3: Find the mean and variance of the numbers obtained on a single roll of a fair die.
Solution: Let X = numbers obtained on a single roll. Then,
X 1 2 3 4 5 6 Total
P(X) 1 1 1 1 1 1 1
6 6 6 6 6 6
1 1 1 1 1 1 21
Mean, E (X) = ∑∞
𝑥=0 𝑥 𝑝(𝑥) = (1 × 6) + (2 × 6) + (3 × 6) + (4 × 6) + (5 × 6) + (6 × 6) = ,
6
1 1 1 1 1 1
E (𝑋 2 ) = ∑∞ 2 2 2 2 2 2 2
𝑥=0 𝑥 𝑝(𝑥) = (1 × ) + (2 × ) + (3 × ) + (4 × ) + (5 × ) + (6 × ) =
6 6 6 6 6 6
91
,
6
91 21 105
Variance, V(X) = E(𝑋 2 ) – [E(X)]2 = − ( 6 )2 = .
6 36
5
Random variable
Example 4.4: Walton’s production line produces a variable number of defective parts in an hour,
with probabilities shown in this table:
X 0 1 2 3 4 Total
P(X) 0.15 0.30 0.25 0.20 0.10 1
How many defective parts are expected to be produced in an hour on Walton’s production line?
Solution: E(X) = ∑∞
𝑥=0 𝑥 𝑝(𝑥) = (0 × 0.15) + (1 × 0.3) + (2 × 0.25) + (3 × 0.2) + (4 × 0.1) =
1.8.
Example 4.5: The length of time X, needed by students in a Math course at AIUB, to complete a
1-hour exam is a random variable with probability density function (pdf) given by:
𝑘(𝑥 2 + 𝑥); 0 < 𝑥 < 1
f(x) = {
0; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Estimate the value of k. Also, find the average time needed to complete a 1-hour exam.
Solution: A given pdf must integrate to 1. Hence,
∞ ∞
1 = ∫ 𝑓(𝑥)𝑑𝑥 E(𝑋) = ∫ 𝑥𝑓(𝑥)𝑑𝑥
−∞ −∞
1
6 1
= 𝑘 ∫ (𝑥 2 + 𝑥)𝑑𝑥 = ∫ 𝑥(𝑥 2 + 𝑥)𝑑𝑥
0 5 0
1
𝑥3 𝑥2 6 1 3
= 𝑘 ( + )| = ∫ (𝑥 + 𝑥 2 )𝑑𝑥
3 2 0 5 0
1
5 6 𝑥4 𝑥3
= 𝑘( ) = ( + )|
6 5 4 3 0
6
So, 𝑘 = 5. 6 1 1
= ( + )
5 4 3
7
= 10.
Example 4.6: The probability density function of a random variable X is given by:
𝑥
f(x) = 2 ; 0<x<2.
6
Random variable
Example 4.7: A University uses a certain software to check errors in any program. The number
of errors found is denoted by a random variable X whose probability density function (pdf) given
by:
2(𝑥+2)
; 0<𝑥<4
f(x) = { 5
0; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Find the average number of errors a University expects to find in a given program.
Solution: The average number of errors a university expects to find in a given program is
4
∞ 2 4 2 4 2 𝑥3 224
E (𝑋) = ∫−∞ 𝑥𝑓(𝑥)𝑑𝑥 = 5 ∫0 𝑥(𝑥 + 2)𝑑𝑥 = 5 ∫0 (𝑥 2 + 2𝑥)𝑑𝑥 = 5 ( 3 + 𝑥 2 )| = .
0 15
Example 4.8: Find the variance of a random variable X whose probability density function is:
2(1 − 𝑥); 0 < 𝑥 < 1
f(x) = {
0; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Also, find E (X - 1), E (3X + 1), V(X + 1) and V(3X - 1).
Solution:
1
∞ 1 1 𝑥2 𝑥3 1
E(𝑋) = ∫−∞ 𝑥𝑓(𝑥)𝑑𝑥 = ∫0 𝑥(2(1 − 𝑥))𝑑𝑥 = 2 ∫0 (𝑥 − 𝑥 2 )𝑑𝑥 = 2 ( 2 − )| = 3 ,
3 0
1
∞ 1 1 𝑥3 𝑥4 1
E(𝑋 2 ) = ∫−∞ 𝑥 2 𝑓(𝑥)𝑑𝑥 = ∫0 𝑥 2 (2(1 − 𝑥))𝑑𝑥 = 2 ∫0 (𝑥 2 − 𝑥 3 )𝑑𝑥 = 2 ( 3 − )| = 6,
4 0
1 1 2 1
V(X) = E(𝑋 2 ) – [E(X)]2 = 6 − (3) = 18,
E (3X + 1) = 3E(X) + 1 = 1 + 1 = 2. 1 2
E (X − 1) = E(X) − 1 = 3 − 1 = − 3.
1 1 1
V(X + 1) = V(X) = 18. V(3X − 1) = 32 V(X) = 9 × 18 = 2.
7
Random variable
Example 4.9: The joint probability density function of two random variables X and Y is given
by: f(x, y) = 2x, 0 < x < 1, 0 < y < 1. Find (a) marginal distribution of X, (b) marginal distribution
of Y, (c) E(X – 2Y), and (d) V(2X – Y). Are X and Y independent?
1
Solution: Marginal distribution of X: g(x) = ∫𝑦 𝑓(𝑥, 𝑦)dy = ∫0 2𝑥 dy = 2x (𝑦)|10 = 2x.
1
1 2𝑥 2
Marginal distribution of Y: h(y) = ∫𝑥 𝑓(𝑥, 𝑦) dx = ∫0 2𝑥 dx = ( )| = 1.
2 0
Hence, X and Y are independent random variables since g(x) × h(y)= 2x = f(x, y).
1
1 1 2𝑥 3
E(X) = ∫𝑥 𝑥 𝑔(𝑥) dx = ∫0 𝑥 2𝑥 dx = ∫0 2𝑥 2 dx = ( )| = ,
3 0
1
1 1 2𝑥 4 1
E(𝑋 2 ) = ∫𝑥 𝑥 2 𝑔(𝑥) dx = ∫0 𝑥 2 2𝑥 dx = ∫0 2𝑥 3 dx = [( )| = 2,
4 0
1 1
1 𝑦2 1 1 𝑦3 1
E(Y) = ∫𝑦 𝑦 ℎ(𝑦) dy = ∫0 𝑦 dy = ( 2 )| = 2, E(𝑌 2 ) = ∫𝑦 𝑦 2 ℎ(𝑦) dy = ∫0 𝑦 2 dy = ( 3 )| = 3,
0 0
1 2 2 1 1 1 1
V(X) = E(𝑋 2 ) – [E(X)]2 = −( ) = 18. V(Y) = E(𝑌 2 ) – [E(Y)]2 = 3 − (2)2 = 12.
2 3
2 1 1 1 1 11
E(X – 2Y) = E(X) – 2E(Y) = 3 – (2× 2) = – 3. V(2X-Y) = 4V(X) + V(Y) = (4× 18) + 12 = 36.
8
Random variable
Example 4.10: The joint probability function of two random variables X and Y is given as:
Y 1 2 3 4 5 6 g(X)
X
1 1 1 1 1 1 1 1
18 18 18 18 18 18 3
2 1 1 1 1 1 1 1
18 18 18 18 18 18 3
3 1 1 1 1 1 1 1
18 18 18 18 18 18 3
h(Y) 1 1 1 1 1 1 1
6 6 6 6 6 6
Find (a) marginal distribution of X, (b) marginal distribution of Y, (c) E(X) and (d) E(Y).
1 1 1
E(X) = ∑∞
𝑥=0 𝑥 𝑝(𝑥) = (1 × ) + (2 × ) + (3 × ) = 2.
3 3 3
Marginal distribution of Y:
Y 1 2 3 4 5 6 Total
1 1 1 1 1 1
P(Y) 1
6 6 6 6 6 6
1 1 1 1 1 1 21
E(Y) = ∑∞
𝑦=0 𝑦 𝑝(𝑦) = (1 × 6) + (2 × 6) + (3 × 6) + (4 × 6) + (5 × 6) + (6 × 6) = .
6
9
Random variable
Exercise 4
4.1. Walton’s production line produces a variable number of defective parts in an hour, with
probabilities shown in this table:
X 1 2 3 4 Total
P(X) 0.10 0.30 0.45 0.15 1
How many defective parts are expected to be produced in an hour on Walton’s production line?
4.2. A random sample of graduates was surveyed at AIUB. A question that was asked is: How
many times did you change majors? The results are shown in a probability distribution as:
X 0 1 2 3 Total
P(X) 0.20 0.30 0.20 0.30 1
Find the probability that a randomly selected graduate changed majors (a) more than once, (b)
two or less times, and (c) two or more times. Also estimate (d) E (2X + 1) and (e) V (4X - 3)
mean, and (f) variance for the random variable X.
10
Random variable
Find P(X < 1), (b) P(X > 0.5), (c) P(1< X < 2) (d) E(X) and (e) V(X) for the random variable X.
11
Random variable
12
Random variable
4.6. The joint probability density function of two random variables X and Y is given by,
f(x, y) = 4xy, 0 < x <1, 0 < y < 1.
1 1 1
Show that, X and Y are independent. Also calculate, (a) P (X > 2), (b) P (3 < Y < 2), (c) E (2X +
13
Random variable
4.7. The joint probability density function of two random variables X and Y is given by:
f(x, y) = 4x(1 – y), 0 < x < 1, 0 < y < 1.
Show that, X and Y are independent random variables.
14
Random variable
4.8. The joint probability function of two random variables X and Y is given as:
Y 0 1 2
X
0 0.10 0.20 0.00
1 0.10 0.20 0.10
2 0.00 0.10 0.10
3 0.10 0.00 0.00
Find (a) marginal distribution of X, (b) marginal distribution of Y, (c) E (5X–Y) and (d) V(Y–2X).
15
Random variable
4.9. The number of adults living in homes on a randomly selected block in Bashundhara
residential area is described by the following probability distribution:
X 1 2 3 4 Total
P(X) 0.25 0.50 0.15 0.10 1
What is the standard deviation of the probability distribution?
4.10. Find the value of c if a random variable X has the probability density function (pdf) given
𝑐(1 − 𝑥 2 ); −1 < 𝑥 < 1
by: f(x) = {
0; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Also calculate E (X) and P (X > 0).
16
Random variable
4.11. The probability that 0, 1, 2, 3, or 4 people will be placed on hold when they call a radio talk
show is given by the following probability distribution. Find the mean and variance for the data.
X 0 1 2 3 4 Total
P(X) 0.18 0.34 0.23 0.21 0.04 1
4.12. A fair coin is tossed twice. Then X is a random variable of the number of with the
following probability function.
X 0 1 2 Total
P(X) 0.25 0.50 0.25 1
Find the expected number of heads.
17
Random variable
4.13. Suppose that a certain region of a country the daily rainfall (in inches) is a continuous
random variable X with probability density function f(x) given by
3
f(x) = 4(2𝑥 − 𝑥 2 ); 0 < x < 2.
Find the probability that, a given day in this region the rainfall is (a) not more than 1 inch, (b)
more than 1.5 inches, (c) between 0.5 and 1.5 inches and (d) less than 1 inch. Also find the
expected daily rainfall in that region.
18
Random variable
Sample MCQs
1. The joint probability density function of X and Y is as follows: f(x, y) = 2y, 0 < x < 1, 0 < y < 1.
Calculate V(2X−Y).
a) 0.39 b) 0.31 c) 0.43 d) 0.16
2. Given, the probability function of X as follows:
X 0 1 2 3
P(X) 0.4 0.2 0.1 0.3
Calculate P(1<X≤3).
a) 0.30 b) 0.50 c) 0.40 d) 0.90
3. Find the value of c if a random variable X has the probability density function given by
f(x) = c (2𝑥 − 𝑥 2 ); 0 < x < 2.
1 4 6 3
a) 4 b) 3 c) 10 d) 4
𝑥
4. The probability function of a continuous random variable X is given by, f(x) = 8, 0 < x < 6.
Calculate E(X+2).
a) 3 b) 11 c) 14 d) 9
5. The joint probability density function of two random variables X and Y is given by:
f(x, y) = 𝑒 𝑥+𝑦 , 0 < x < 1, 1 < y < 2.
Are X and Y independent random variables?
a) Yes b) No c) both a and b d) None
6.Find variance of X. Let X be a continuous random variable with probability density function,
f(x) = 2𝑥 −2, 1 < x < 2.
a) 0.3641 b) 0.7820 c) 0.0782 d) 0.0923
19