9.0 Random Variables
9.0 Random Variables
Possible outcome HH HT TH TT
Number of head 2 1 1 0
x 0 1 2
P X x
1 2 1
4 4 4
(b) Two dice are tossed.
Let Random Variable Y = “The sum of the scores on the two dice”
Let’s make a table of possible values:
1st Die
1 2 3 4 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
2nd 3 4 5 6 7 8 9
Die 4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12
1 of 58
Lecture Note: 1 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
Let's count how often each value occurs, and work out the probabilities:
1
2 occurs just once, then P Y 2 .
36
2 1
3 occurs twice, then P Y 3 .
36 18
3 1
4 occurs three times, then P Y 4 and so on.
36 12
y 2 3 4 5 6 7 8 9 10 11 12
P Y y
1 2 3 4 5 6 5 4 3 2 1
36 36 36 36 36 36 36 36 36 36 36
x
RANDOM
VARIABLES
Discrete Continuous
Random Variable Random Variable
2 of 58
Lecture Note: 1 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
P X x 1
k
i
i1
*The variable is said to be a discrete random variable if the sum of the probabilities is 1.
The probability distribution can be presented in the form of table, function or graph.
A table which allocates a probability value to each value of a discrete random variable X
is called a probability distribution table. For example:
x 0 1 2
P X x
1 2 1
4 4 4
A function which relates the values of a discrete random variable X to their respective
associated probabilities is called a probability distribution function. For example:
0.2, x 2,4,6,
P X x 0.1, x 1,3,5,7,
0, otherwise.
Mode is the value of x with highest probability, P X x.
3 of 58
Lecture Note: 1 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
P X x .
n
for x x1 , x2 , x3 ,, then F x P X x i
i1
Expectation Variance
Mean of X. Variance of X.
Denoted by E X or . Denoted by Var X or 2 .
Formula: Formula:
where E X 2 x P X x
n
2
i i
i1
Proof:
Var X E X
2
E X 2X 2
2
E X 2 2E X 2
E X 2 E X
2
Properties: Properties:
E a a Var a 0
*The above properties of expectation and variance are true for both discrete and continuous random
variables.
4 of 58
Lecture Note: 1 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 1
X is a random variable with probability distribution function given by
0.2, x 2,4,6,
P X x 0.1, x 1,3,5,7,
0, otherwise.
(a) Show that X is a discrete random variable.
(e) Find the cumulative distribution function for X and hence, determine the median. Sketch
the graph of F x.
5 of 58
Lecture Note: 1 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(f) Find
(i) P 1 X 5
(ii) P 1 X 5
(iii) P 1 X 5
(iv) P X 5
(v) P X 3
6 of 58
Lecture Note: 2 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 2
X is a discrete random variable with probability distribution function
c x 1 , x 1,3,5,
P X x
c x 1 , x 4,6.
2
(a) Find the value of c and construct the probability distribution table for X.
Hence, find
(i) P x 2 2 .
7 of 58
Lecture Note: 2 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(c) Calculate E X and Var X . Hence, find the Variance of Y, where Y 5X 30.
8 of 58
Lecture Note: 2 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 3
The cumulative distribution, F x of a discrete random variable X is defined as follows:
0, x 2,
1
, 2 x 3,
5
8
F x
, 3 x 4,
15
4
, 4 x 5,
5
1,
x 5.
(a) Find
(i) P X 3 (ii) P X 3
(iii) P X 3 (iv) P 2 X 5
(v) P 3 X 5 (vi) P 2 X 5
9 of 58
Lecture Note: 2 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 4
A bag contains four pieces of red towels and three yellow towels. The towels are to be drawn at
random one by one without replacement from the bag until a piece of red towel is obtained. If X is
the total number of towels drawn from the bag, construct the probability distribution table for X.
10 of 58
Lecture Note: 3 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
F x P X x P X x f x dx
x
F x is given by the area under the curve y f x from up to x as indicated by the
shaded region.
11 of 58
Lecture Note: 3 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
f x F x
To show that it is a PDF f x dx 1 F 1
At x a,
To find unknown constants
f x dx 1
F a F a
P x a or P x a f x dx F a
a
P x a or P x a f x dx 1 F a
a
Mean or Expectation, E X E X xf x dx
x2f x dx
12 of 58
Lecture Note: 3 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 5
The function f is defined as
3 2
x , 1 x 2,
f x 7
0, otherwise.
(a) Show that the function is the probability density function.
1 3
(iii) P X
3 2
13 of 58
Lecture Note: 3 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(c) Sketch the graph of the function. Hence, find the mode.
EXAMPLE 6
A continuous random variable X has probability density function as f x kx for 0 x 4.
3
Find
(a) the value of k.
(b) E X and E X 2 .
14 of 58
Lecture Note: 3 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(c) Var X .
15 of 58
Lecture Note: 4 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 7
The continuous random variable X has probability density function
a ax 1
, 0x ,
3 3 2
f x ax 1
, x 1,
3 2
0,
otherwise.
(a) Find the value of the constant a.
1 2
(b) Find P X .
3 3
16 of 58
Lecture Note: 4 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
17 of 58
Lecture Note: 4 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 8
1
X is a continuous random variable with probability density function f x x, where
8
0 x 4.
18 of 58
Lecture Note: 4 of 5 Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(c) Calculate
(i) P X 1
3
(ii) P X
2
(iii) P 2 X 3
19 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 9
The probability density function of a continuous random variable X is defined as
6x
, 0 x 1,
17
f x 6x2
, 1 x 2,
17
0,
otherwise.
20 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(b) Find
3
(i) P X
2
1
(ii) P X
2
3 4
(iii) P X
4 3
21 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
EXAMPLE 10
The cumulative distribution function, F x of a continuous random variable X is defined as
follows:
0, x 2,
1 2 x , 2 x 0,
12
F x a ,
x
0 x 4,
6
b x , 4 x 6,
12
1, x 6.
(a) Find the values of the constants a and b.
(b) Find the probability density function, f x. (c) Calculate P 3 X 5.
22 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
SUMMARY
P X x 1
n
To show that it is
a PDF i1
i
f x dx 1
Cumulative F x P X x F x P X x P X x
Distribution
P X xi
n
f x dx
x
Function, CDF
i1
P X m 0.5 P X m P X m 0.5
Median, m or or
F m 0.5 f x dx 0.5
m
Expected or Mean,
x P X x
n
E X i1
i i
xf x dx
i1
x 2f x dx
E a a
Properties: E aX aE X
E aX b aE X b
where a and b are constants
Var a 0
Properties:
Var aX b a Var X
2
Standard
Deviation, Var X
23 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(b) Find the probability that the company receives at least two requests in a day.
24 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(b) Find the probability that a resident has more than two vehicles.
(c) Find the cumulative distribution function for X and hence, determine the median.
(d) Let Y 30X 10 be the monthly fee (in RM) imposed by a security company. Find
the expected amount of monthly fee to be paid.
25 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
26 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
4. A nurse works five days in a week. The number of days in a week she works overtime is a
discrete random variable X with probability function
k
3x 1 , x 0,1,2,
3
k
f x x 2, x 3, 4,
3
k x 1 , x 5,
3
1
where k is a constant. Show that k .
5
(a) Find the probability she works overtime every day in a week.
(b) Calculate the probability that she will work overtime for at least three days in a week.
(c) Determine the most likely number of days in week she will work overtime.
(d) Find the expected number of day in week she will work overtime.
Hence, evaluate E 3X 1.
27 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
P X x a b c
28 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
29 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(c) Find the cumulative distribution function of X and sketch the graph of F x.
30 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(a) Find the probability distribution table of X and sketch the graph of the function.
(ii) P X 2
(iii) P 2 X 4
31 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
32 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
9. A committee consisting of 3 people will be chosen at random from 6 men and 3 women. If
X represents the number of men selected,
(a) tabulate the probability distribution P X x.
33 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(d) If Y represents the number of women selected, determine the mean and variance for Y,
without calculating the probability distribution P Y y .
34 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
35 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
11. Let X be the random variable representing the number obtained when dice is rolled. The
probability of the biased dice to give odd numbers is three times higher than even numbers
when it is rolled.
(a) If the dice is rolled once,
(i) construct a probability distribution table of X.
(b) If the dice is rolled 100 times, find the expected value of getting the number “6”.
36 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
12. Two dice are thrown and the numbers x and y obtained from each dice are noted. The
discrete random variable W is defined as
xy,
x y,
W
x y , x y.
5
(a) Write all the outcomes for W 4 and hence, show that P W 4 .
36
(b) Construct a table of the probability distribution of the random variable W. Hence, show
that W is a discrete random variable.
37 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
38 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
13. A fair die is thrown once. A random variable represents the score on the uppermost face of
a die. If the score is two or more, then the random variable X is the score. If the score is
one, the die is to be thrown once again and the random variable X is the sum of the scores
of two throws. Construct the probability distribution table for X.
39 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
14. A continuous random variable X has the probability density function f x given by
2k, 0 x 1,
f x 3k 3 x , 1 x 3,
0, otherwise.
(a) Find the value of k.
40 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
15. Let the probability density function of a continuous random variable X be defined by
x2
, c x c,
f x 18
0, elsewhere,
with c is a constant.
(a) Show that c 3.
41 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
42 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
16. The time for patients to experience complications in a week after a heart surgery, X is a
continuous random variable with probability density function given by
a 1 x ,
0 x 1,
f x
0, otherwise,
where a is a constant. Show that a 2.
43 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
44 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
17. A continuous random variable X has the probability density function f x given by
12
k x x , 0 x 1,
f x
0, otherwise.
45 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
3
(d) Show that the median of X, m satisfies the equation 6m 2 8m 2 1 0.
46 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
18. A commuter travels into town by train and then has to catch a bus from the station to the
office. The time x minutes, that the commuter has to wait for the bus can be modelled by
the probability density function
k,
0 x 4,
1
f x
k 6 x , 4 x 6,
2
0, otherwise.
47 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
19. The continuous random variable Y has the following probability density function.
cy 2 , y 1,
f y
0,
otherwise.
Find
(a) the value of c.
1
(b) P Y .
2
48 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
1
(d) P Y .
2
49 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
3
(b) P X .
2
50 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
1
(c) the value of m such that P X m .
2
(e) E X 2 .
51 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
21. The continuous random variable X has cumulative distribution function F x given by
0,
x 0,
x2
6 , 0 x 2,
F x
2
x
2x 2, 2 x 3,
3
x 3.
1,
Find
(a) P 1 X 2.2.
52 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
53 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
54 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
(e) Sketch the graph of f x and hence, find the mode.
55 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
Answers
0, x 0,
1
, 0 x 1,
120
61
, 1 x 2,
1. (a)
1
(b)
5
(c)
13
2. (b)
19 120
(c) F x m1 (d) 60.25
4 8 8 120
101
, 2 x 3,
120
29
, 3 x 4,
30
1, x 4.
1 5
(c) E Y 1.7, Var Y 12.51
x 0 1 2 3 4
3. (a) (b)
P X x
10 0.35
0.15 0.05 0.05 0.15 0.25
4 7 43 48
4. (a) (b) (c) 2 (d) E X , E 3 X 1 5. a 0.2, b 0.3, c 0.5
15 15 15 5
13 20
6. (b) E X , Var X
3 9
0, x 1,
1
, 1 x 2,
21
1
2 x 3,
7
,
6
6. (c) F x
6
, 3 x 4, 6. (d)
21 7
10
, 4 x 5,
21
5
, 5 x 6,
7
1,
x 6.
7. (a)
x 0 1 2 3 4 5
5 5
P X x
1 5 5 1
32 32 16 16 32 32
5 3 25
7. (b) (i) (ii) (iii)
16 16 32
56 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
1 3 3 3
8. (a) k , P 1 X 3 (b) E X , Var X , Var 2 X 3 3
8 8 2 4
1
9. (a) x 0 1 2 3 (b) E X 2, Var X
2
1 3 15 5
P X x
84 14 28 21
0, x 0,
1
, 0 x 1,
84
19
9. (c) F X
1
, 1 x 2, (d) E Y 1, Var Y
84 2
16
, 2 x 3,
21
1, x 3.
55
10(a) x 1 2 4 6 (b)
12
P X x
1 1 1 1
6 2 6 6
1 13 137
11. (a)(i) x 1 2 3 4 5 6 (ii) (iii) E X , Var X
3 4 48
1
P X x
1 1 1 1 1
4 12 4 12 4 12
25
11. (b)
3
5
12. (a) 2, 2 , 5,1 , 1, 5 , 2, 6 , 6, 2 ,
36
1
12. (b) x 1 2 3 4 5 9 16 25 36 (c) (d) 1
12
11 2 1 5 1 1 1 1 1
P X x
36 9 6 36 18 36 36 36 36
161 134
12. (e) E W , E 3 4 W
36 9
13. x 2 3 4 5 6 7
7 7 7 7 7 1
P X x
36 36 36 36 36 36
57 of 58
Tutorial 9: 8 Hours Mathematics 2 SM025
Ch. 9 Random Variables Session 2021/2022
1
14. (a) (b) (c) 0.453 (d) 0.1875
8
0, x 3,
x3 1
15. (b) F x
4
, 3 x 3 c) (i) (ii) 0
54 2 27
1, x3
0, x 0,
F x 2 x x 2 , 0 x 1, m 0.2929 (b) E X
1
, Var X
1
, Var 3 2 X =
2
16. (a)
1, x 1.
3 18 9
0, x 0,
2 19 38 3
F x 4x 2 3x2 ,
17. (b) E X , Var X , Var 2 X 3 0 x 1,
(c)
5 350 175
1, x 1.
0, x 0,
kx , 0 x 4,
18. (a) F x
1
(b) (c) 3
3kx 1 kx 2 4 k , 4 x 6, 5
4
5k , x 6.
(c) E Y 0, E Y 2 7
3 7 38 3 1
19. (a) (b) , Var Y (d)
2 16 5 5 8
1 1
x, 1 x 2,
(d) f x 6 3
1 1 3 7
20. (a) a ,b (b) (c) 1.303 (e)
6 6 8 4
0, otherwise.
x
, 0x2
3
(c) f x
31 5 7
21. (a) (b) 1.73 2x (d) (e)
50
2, 2x3 3 18
3
0, otherwise.
x1
, 1 x 3,
6
(d) f x
3
22. (b) (c) 3.5359 7 x (e) mode = 3
4
, 3 x 7,
12
0, otherwise.
58 of 58