You are on page 1of 38

SM025 | Mathematics 2 | 2023/2024 1

TOPIC 8: RANDOM VARIABLES

TOPIC : 8.0 RANDOM VARIABLES

Introduction To Random Variables

DEFINITION 1
Variable : defined as a characteristics or attribute that can assume different values.

Various letters of alphabet, such as X,Y or Z, are used to represent variables and its
corresponding small letter, 𝑥 , 𝑦, 𝑧 is used to represent a particular value of the random
variables.

DEFINITION 2
Random Variables: variables that possible values are numerical outcomes of a random
experiment. The value depends on chance.

Example :

 If a die is rolled, a letter such as ‘ X ’ , can be used to represent the outcomes.


Then the value ‘x’ can assume as 1, 2, 3, 4, 5 or 6, corresponding to the outcomes of
rolling a single dice.

 If two coins are tossed, a letter ‘Y ’ can be used to represent the number of heads, in
this case 0, 1 or 2.

 If the temperature (T) at 8.00 am is 43o and at noon it is 53o, then the values of the
temperature (T) assumes are said to be random, since they are due to various
atmospheric conditions at the time the temperature was taken.

NOTES!!
Since the variables are associated with probability, they are called random variables.

There are two types of random variables, discrete and continuous.

a) Discrete Random Variable :


take on only a finite or countable number of distinct values such as 0,1,2,3,4,........

b) Continuous Random Variable :


values from measurements and not countable. Any value over an interval or
several intervals such as height, mass or time.
SM025 | Mathematics 2 | 2023/2024 2
TOPIC 8: RANDOM VARIABLES

Example :

State whether each of the following random variables is discrete or continuous:

(a) The number of students who drive to college each day.

(b) The length of time a student spends in the library each week.

(c) The number of 6 obtained when three dice are thrown.

(d) Salaries of workers in a factory.

(e) Amount of water consumed by a family in each month of a year.

(g) The height of students in a college.


SM025 | Mathematics 2 | 2023/2024 3
TOPIC 8: RANDOM VARIABLES

SUBTOPIC : 8.1 Discrete Random Variables

8.1.1 Probability Distribution

A set of all possible values that a random variable can take on together with the associated
probabilities is known as probability distribution.

A probability distribution with a discrete random variable is known as discrete probability


distribution.

Probability distribution function of the discrete random variable is denoted as 𝑃(𝑋 = 𝑥).

The properties of Discrete Random Variables:

i. P(X=x) = f(x)

ii. 0 ≤ P(X=x) ≤ 1

iii.  P( X  x)  1
all x

NOTE!!!

  P( X  x)  1
all x
shows that X is a random variable.

 The highest probability implies the value of x as the mode.

The probability distribution can be presented in the form of table, graph and function:

Example:

The probability distribution function, if two fair coins are tossed is presented as below:.

Let X represents the number of tail obtained.

The possible outcomes are: {HH, HT, TH, TT}


Then x = 0, 1, 2.

a) Table
x 0 1 2
P  X  x 0.25 0.5 0.25

Notes!
We can check it is a probability distribution by finding the sum of the probabilities.
It should be 1.
SM025 | Mathematics 2 | 2023/2024 4
TOPIC 8: RANDOM VARIABLES

b) Graph

c) Function

ì1
ïï , x = 1
(
P X = x = í2)
ï 1 , x = 0,2
ïî 4

Example 1:

A fair die is rolled. If X represent the number on the die, show that X is a discrete random
variable.

Solution:
1
P(X = x) = 6 , for x = 1, 2, 3,4,5,6

Simply Means:
1 1 1 1 1 1
P(X = 1) = 6 , P(X = 2) = 6 , P(X = 3) = 6 , P(X = 4) = 6 , P(X = 5) = 6 , P(X = 6) = 6 .

1 1 1 1 1 1
 P( X  x)  6  6  6  6  6  6  1
all x

Since  P( X  x)  1, X is a discrete random variable.


all x

Example 2:

For the following probability distribution function, find the value of constant a.

P(Y = y) = a y , for y = 1, 2, 3, 4

Solution:
SM025 | Mathematics 2 | 2023/2024 5
TOPIC 8: RANDOM VARIABLES

Example 3:
The probability distribution function of a discrete random variable X is given by
x 1 2 3
P  X  x 2k 4k 9k  1

If k is a constant, find the value of k.


Solution:

Example 4:
A fair die is rolled. If X represents the number on the die, show that X is a discrete random
variable.
Find P  X  3 and P(1  X  5) .
Solution:
SM025 | Mathematics 2 | 2023/2024 6
TOPIC 8: RANDOM VARIABLES

Example 5:
3 fair coins are tossed. Let X be a discrete variable that is 'the number of head obtained when
the three coins are tossed’. Show that X is a random variable.

Solution:

Example 6:
The discrete random variable W has probability distribution function as shown

w -3 -2 -1 0 1
P(W = w) 0.1 0.25 0.3 0.15 d

Find a) the value of d, b) P(3  W  0)


c) P(W  1) d) P(1  W  1)

Solution:
SM025 | Mathematics 2 | 2023/2024 7
TOPIC 8: RANDOM VARIABLES

Example 7:
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:
(a) Obtain the probability distribution of X.
(b) Find P(1  X  3) .

Solution:
SM025 | Mathematics 2 | 2023/2024 8
TOPIC 8: RANDOM VARIABLES

Example 8:
Given the following probability distribution function, f(𝑥) for 𝑋.
Show that X is a random variable.
2
, for 𝑥 = 0,1,2,3
9
𝑓(𝑥) = { 1
, for 𝑥 = 4,5
18

Hence, find P(𝑥 < 3) and P(𝑥 > 2.5).

Solution:
SM025 | Mathematics 2 | 2023/2024 9
TOPIC 8: RANDOM VARIABLES

Example 9:
The probability distribution function of a discrete random variable X is given by
P( X  x)  kx 2 for x  0,1, 2,3, 4 .

(a) Find the value of the constant k.


(b) Obtain the probability distribution of X.
(c) Find
(i) P( X  1 or X  4)
P( X  2  1)
(ii)

Solution:
SM025 | Mathematics 2 | 2023/2024 10
TOPIC 8: RANDOM VARIABLES

8.1.2 Cumulative Distribution Function

DEFINITION
The cumulative distribution function, F(t) is obtained by summing all the probabilities up to a
particular value, t .

If X is a discrete random variable with p.d.f. P( X= x) for x = x 1, x 2,... ,x n, then the


cumulative distribution function is given by F(t) where :

F(t) = P(X  t) =  P( X  x)
x  x1
t = x1, x2,....,xn

NOTES!
i. P( X  a )  F ( a )
ii. P( X  a )  1  P  X  a   1  F ( a )
iii. P( X  a )  1  P  X  a 
iv. P(a  X  b)  F (b)  F (a)
v. If m is the median, P( X  m)  0.5

Example:
For the following random variable X, where X is the score on an unbiased dice is given as

x 1 2 3 4 5 6
P( X = x) 1 1 1 1 1 1
6 6 6 6 6 6

The Cumulative Distribution Function

a) Table Form

x 1 2 3 4 5 6
F( x) 1 1 1 2 5 1
6 3 2 3 6

b) Function Form:

 0, x 1
1
 , 1 x  2
6
1
 , 2 x3
3
1
F ( x)   , 3 x  4
2
2
3 , 4 x5

5 , 5 x6
6

 1, x6
SM025 | Mathematics 2 | 2023/2024 11
TOPIC 8: RANDOM VARIABLES

c) graph:

Example 1 :
The probability distribution for random variable X is shown in the table. Construct the
cumulative distribution table and sketch the graph of cumulative distribution function.

x 0 1 2 3 4 5
P(X=x) 0.03 0.04 0.06 0.12 0.4 0.35

Solution:
SM025 | Mathematics 2 | 2023/2024 12
TOPIC 8: RANDOM VARIABLES

Example 2 :
The cumulative distribution function F(x) of a discrete random variable X is shown as below:

x 1 2 3 4 5
F  x 0.2 0.32 0.67 0.9 1

a) Find:
(i) P  X  3 (ii) P  X  2
(iii) P  2  X  4 (iv) the median.

b) Construct the probability distribution function, f (x) .


Hence, find
(i) P( X = 3) (ii) P(X ≥ 2)
Solution:
SM025 | Mathematics 2 | 2023/2024 13
TOPIC 8: RANDOM VARIABLES

Example 3 :
The cumulative distribution function of a discrete random variable X is given in the table
below:

x 1 2 3 4 5
F(x) 0.05 0.3 0.6 0.75 1

Find the probability distribution function of X. Hence, find the mode.

Solution:
SM025 | Mathematics 2 | 2023/2024 14
TOPIC 8: RANDOM VARIABLES

8.1.3 Expectation and Variance of Discrete Random Variable

The mean, E(X) is the expected value or expectation of X and denoted as μ.


The Variance of X is denoted as Var  X  ,  2 . Both values are given as follows:

μ = E (X ) = Σ x .P (X = x)

Var  X  ,  2  E  X 2    E ( X )
2

 EX  
2

where EX2   x P  X  x .
2

all x

Similarly E g  X    g x P X  x .
all x

Therefore, the standard deviation, σ= Var (X )

Example 1:
A random variable X has values x = -1,0,1,2 with the following probability distribution:

x -1 0 1 2
P(X=x) 1 1 1 1
3 3 6 6

Find the expectation and variance of X.

Solution:
SM025 | Mathematics 2 | 2023/2024 15
TOPIC 8: RANDOM VARIABLES

Example 2:
A discrete random variable X has the following probability distribution:

x 1 2 t
P(X=x) 0.1 0.2 0.7

Find the value of t if E(X) = 4.

Solution:
SM025 | Mathematics 2 | 2023/2024 16
TOPIC 8: RANDOM VARIABLES

The properties of mean and variance:

E (a)  a
E (aX  b)  aE ( X )  b
Var (a)  0
Var (aX )  a 2Var ( X )
Var (aX  b)  a 2Var ( X ) where a is any constant.

Example 3:
A random variable X has probability distribution function
x
P( X  x)  , for x = 0, 1, 2, 3,4.
10

Find:
a) E(X) and Var (X)
b) E (3X) and Var (3X)
c) E (4+5X) and Var (4+5X)
d) E (1-X) and Var (1-X)
Solution:
SM025 | Mathematics 2 | 2023/2024 17
TOPIC 8: RANDOM VARIABLES

Example 4:
A computer is programmed to produce a sequence of integers, R, in the range 0 to 5
inclusive , with probability as shown below.

x 0 1 2 3 4 5
P( X = x) k 1 2 3 4 5
30 30 30 30 30

1
i) Show that k =
2
ii) Calculate the mean and variance of R
iii) Sketch the graph of probability distribution function.

Solution:
SM025 | Mathematics 2 | 2023/2024 18
TOPIC 8: RANDOM VARIABLES

Example 5:
The distribution of the number of muffins, X, bought by a customer at a particular shop is given below

x 1 2 3 4 5 6 >6
Probability 1 2 3 a 2 1 0
12 12 12 12 12

i) Find the value of a


ii)By symmetry, or otherwise, state the expected value of X
iii)
Evaluate the variance of X
iv)Initially the shopkeeper charges 40 cents for each muffin, which cost 10 cents to produce.
Using the answer in part (ii) , or by any method, find the expected profit made per customer
buying muffins.
v) Sketch the graph of probability distribution function

Solution:
SM025 | Mathematics 2 | 2023/2024 19
TOPIC 8: RANDOM VARIABLES

SUBTOPIC : 8.2 Continuous Random Variables

8.2.1 Probability Density Functions

The probability that a continuous random variable X assumes a value within a certain interval [a,b] is
given by the area under the curve between the two limits of the interval. P(a £ X £ b) is area under
the curve from a to b.

The function f (x) that represents the probability distribution curve is called The Probability Density
Functions, f (x).

The properties of Probability Density Function:

i) f(x) ≥ 0


ii) 
f ( x)dx  1,

b
iii) P(a  X  b)   f ( x)dx
a

NOTES!!
For Continuous Random Variables,
P(a  X  b)  P(a  X  b)
 P(a  X  b)
 P(a  X  b)

Example 1:
Given
3 2
 x , 1 x  2
f ( x)   7
 0, otherwise
(a) Show that the function is the probability density function (p.d.f)
 3
(b) P  X  
 2
Solution:
SM025 | Mathematics 2 | 2023/2024 20
TOPIC 8: RANDOM VARIABLES

Example 2:
A continuous random variable X has probability density function
f ( x)  kx3 , for 0  x  4 .

Find:
(a) the value of k
(b) P(1  X  3)
(c) P( X  2)

Solution:
SM025 | Mathematics 2 | 2023/2024 21
TOPIC 8: RANDOM VARIABLES

Example 3:
A random variable X has the following probability density function:
2(1 − 𝑥) , 0 £ 𝑥 < 1
𝑓(𝑥) = {
0, other

a) Show that f (x) is a continuous random variable


b) Find P(0.2  X  0.4)
c) Find P( X  0.5)

Solution:
SM025 | Mathematics 2 | 2023/2024 22
TOPIC 8: RANDOM VARIABLES

Example 4:
For the following probability density function of random variable X :

 x
 2, 0  x 1

 x
f ( x)  1  , 3  x  6
 6
 0, others


a) Show that f (x) is a continuous random variable
b) Find P(0  X  4)

Solution:
SM025 | Mathematics 2 | 2023/2024 23
TOPIC 8: RANDOM VARIABLES

Example 5:
A random variable X has the following probability density function:

x
 , 0  x  10
f ( x)   50
 0, others

a) Find P( 2 < X < 5 )


c) If P ( m < X < 8)=0.48, find m.

Solution:
SM025 | Mathematics 2 | 2023/2024 24
TOPIC 8: RANDOM VARIABLES

Example 6:
The continuous random variable X has probability density function

k ( x  1 ) , 0  x  2

f ( x )   2k , 2 x3
 0
 , otherwise

(a) Find the value of the constant k.


(b) Sketch the probability density function.
(c) Find P (1.5< X <2.5).
(d) Find P ( X >1.8).

Solution:
SM025 | Mathematics 2 | 2023/2024 25
TOPIC 8: RANDOM VARIABLES

8.2.2 Cumulative Distribution Functions

If X is a continuous random variable with probability density function (p.d.f), f (x) defined for
a £ X £ b , then the cumulative distribution function is given by F(t) where

t
F (t )  P( X  t )   f ( x)dx


*it is the summing of intervals from the beginning

NOTES!!
i. P(X ≤ a ) = F (a)

ii. P (a ≤ X ≤ b ) = F (b) - F (a)

iii. Median, m from cumulative distribution function : F (m) = 0.5

𝑚
F (m) = P(X  m) = ∫−∞ 𝑓(𝑥)𝑑𝑥 = 0.5

*the median divides area under the curve into halves.


y
y = f (x)

a m x
b

iv. The probability distribution function, f (x) is obtained by differentiating


the cumulative distribution function, F(x):

d
f ( x)   F ( x) 
dx
SM025 | Mathematics 2 | 2023/2024 26
TOPIC 8: RANDOM VARIABLES

Example 1:
If X is a continuous random variable with probability density function
1
f (x) = x, where 0  x  4 .
8

(a) Find the cumulative distribution function F(x).


(b) Sketch the graph y = F(x).
(c) Calculate P(2 < x < 3) .

Solution:
SM025 | Mathematics 2 | 2023/2024 27
TOPIC 8: RANDOM VARIABLES

Example 2:
If X is a continuous random variable with the following probability density function, find the
cumulative distribution function F(x).

1
2 , 1 x  2

1
f ( x)   , 4  x  6
4
 0, others

a) Formulate the cumulative distribution function F(x)


b) Find P ( 1.5 < X < 5)

Solution:
SM025 | Mathematics 2 | 2023/2024 28
TOPIC 8: RANDOM VARIABLES

Example 3:
From the following cumulative distribution functions, determine the probability density function

 0, x2

F ( x)  6 x  x  8, 2  x  3
2

 x3
 1,

Find a) P ( X < 2.2 )


b) P ( X > 2.5 )
c) P ( 2.2 < X < 2.5 )

Solution:
SM025 | Mathematics 2 | 2023/2024 29
TOPIC 8: RANDOM VARIABLES

Example 4:
X is a continuous random variable with probability density function
1
f (x) = x, where 0 ≤ x ≤ 4.
8
Find the median.
Solution:

Example 5:
X is a continuous random variable with probability density function
1
f ( x)   4  x  for 1  x  3 .
4
Find:
(a) the cumulative distribution function, F(x).
(b) 𝑃(|𝑋| ≤ 2)
(c) the median m .

Solution:
SM025 | Mathematics 2 | 2023/2024 30
TOPIC 8: RANDOM VARIABLES

Example 6:
The probability density function of a continuous random variable X is defined as
 3
 ( x  2 )2 , 2 x 0
16
 3
 ( x  2 )2
f(x)  16 , 0 x2

 0 , otherwise


(a) Obtain the cumulative distribution function , F(x).
(b) Sketch the graphs f and F respectively.
(c) Find P( X > 1 ).
(d) Find the median from F(x).
Solution:
SM025 | Mathematics 2 | 2023/2024 31
TOPIC 8: RANDOM VARIABLES

Example 7:
The continuous random variable X has a cumulative distribution function given by

0 , x0
 x 3
F(x) =  , 0  x  3
 27
 1 , x3

(a) Find the probability density function, f(x).

(b) Sketch the function y = f (x).

Solution:
SM025 | Mathematics 2 | 2023/2024 32
TOPIC 8: RANDOM VARIABLES

Example 8:
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
 x
F ( x)   a  , 0 x4
 6
 b x , 4 x6
 12
 1, 6 x

(a) Find the values of the constants a and b.


(b) Find the probability density function, f(x).
(c) Calculate P(3  X  5).
Solution:
SM025 | Mathematics 2 | 2023/2024 33
TOPIC 8: RANDOM VARIABLES

8.2.3 Mean and Variance of Continuous Random Variable

The expected value, E(X) and variance, Var (X) for continuous random variables as the following:


EX    x f  x  dx


Var  X  ,  2  E  X 2    E ( X )
2

EX2 

where 
x 2 f ( x)dx .


Similarly E  g  X     g ( x) f ( x)dx


Therefore, the standard deviation,   Var ( X )

*properties of E(X) and Var (X) are same for discrete and continuous random variable.

Example 1:
For the probability density function

 1 1
   x, 2  x  6
f ( x)   4 8
 0, others

Find E (X) and Var (X)

Solution:
SM025 | Mathematics 2 | 2023/2024 34
TOPIC 8: RANDOM VARIABLES

Example 2:
The continuous random variable has probability density function

1
f ( x )  x, where 0 x4.
8
Find:
a) E(X) b) E(X 2 )
c) Var (X) d) Var (3X + 2)
e) Standard deviation of X

Solution:
SM025 | Mathematics 2 | 2023/2024 35
TOPIC 8: RANDOM VARIABLES

Example 3:

The random variables of X has probability density function:


1
𝑓(𝑥) = (𝑎 − 𝑥), 𝑓𝑜𝑟 1≤𝑥≤3
4
a) Show that a = 4
b) Find E(X)
c) Find E(5X) - E(2X)
Solution:
SM025 | Mathematics 2 | 2023/2024 36
TOPIC 8: RANDOM VARIABLES

Example 4:
A continuous random variable X has the following probability density function

2
 ( x 1) , 2  x  5
f ( x )  7
0 , otherwise
Find:
(a) E ( X + 1 )
(b) E ( 2X )
(c) E ( 10 – X )
(d) E ( 3X 2 – 5 )

Solution:
SM025 | Mathematics 2 | 2023/2024 37
TOPIC 8: RANDOM VARIABLES

Example 5:
The continuous random variable Y has probability density function:

k (3 y 2  2), 2  y  3
f ( y)  
 0, otherwise

a) Determine the value of k

b) Find 𝑃(𝑌 ≥ 2)

c) Find 𝐸(2𝑌 + 2)

d) Find Var (2𝑌 + 3)

Solution:
SM025 | Mathematics 2 | 2023/2024 38
TOPIC 8: RANDOM VARIABLES

Example 6:
X is a continuous random variable with probability density function f(x).

If ∫−∞ 𝑥 2 . 𝑓(𝑥)𝑑𝑥 = 29 and Var (3X) = 36 ,

find the mean of X.

Solution:

-End of Topic 8-

You might also like