Random Variable
Definition
Random variable is a real valued function which assign a real numbers to each sample point
in the sample space.
Random variable are usually denoted by capital letters e.g. X, Y, Z … etc. and the values of
these variables are denoted by small letters x, y, z, …. etc.
For example, If three coins are tossed simultaneously then sample space is as follows.
S = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝑇𝐻𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇
Let, X be the random variable (r.v.) “No. of heads appears in the tosses”
X(S1) = 3, X(S2) = X(S3) = X(S4) = 2, X(S5) = X(S6) = X(S7) = 1, X(S8) = 0
∴ 𝑋 = 𝑥1 𝑥2 𝑥3 𝑥4 𝑥5 𝑥6 𝑥7 𝑥8
= 3 2 2 2 1 1 1 0
1
Discrete Random Variable
A random variable is called discrete if it assumes only finite number.
For example, die throw can only have 1,2,3,4,5,6 (six numbers).
Continuous Random Variable
A random variable that takes on an infinite number of values is known as a
continuous random variable. For example, all numbers between “0” to “1”
i.e., (0<x<1).
2
Probability Function/Probability Mass Function
Let, X be a discrete random variable such that P(X= x) =P(xi) then P(xi) is said
to be probability mass function (p.m.f.), if it satisfy the following condition
𝑖 P(xi) ≥ 0 ; 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑎𝑑𝑚𝑖𝑠𝑠𝑖𝑏𝑙𝑒 𝑖
𝑛
(𝑖𝑖) 𝑃 𝑥𝑖 = 1; 𝑤ℎ𝑒𝑟𝑒 𝑡ℎ𝑒 𝑟𝑎𝑛𝑑𝑜𝑚 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒 𝑎𝑠𝑠𝑢𝑚𝑒𝑠 𝑛 𝑣𝑎𝑙𝑢𝑒𝑠 𝑙𝑖𝑘𝑒 𝑥1 , … , 𝑥𝑛
𝑖<1
For example, If three coins are tossed simultaneously then sample space is as
follows.
S = 𝐻𝐻𝐻, 𝐻𝐻𝑇, 𝐻𝑇𝐻, 𝑇𝐻𝐻, 𝐻𝑇𝑇, 𝑇𝐻𝑇, 𝑇𝑇𝐻, 𝑇𝑇𝑇
Let, X be the random variable (r.v.) “No. of heads appears in the tosses”
3
Probability Function/Probability Mass Function
The probability P(𝑋𝑖 ) associated with values of discrete random variable
𝑋𝑖 is called probability function or probability mass function.
Problem1.
The random variable X has a probability function
𝑘 𝑥+2 , 𝑥 = 1,2
P 𝑋=𝑥 =
𝑘𝑥, 𝑥 = 3,4
Find k and construct a probability distribution table. 4
Solution:
P(X=x=1) + P(X=x=2) + P(X=x=3) + P(X=x=4) = 1
⇨ 3k +4k +3k + 4k = 1
⇨ 14k = 1
1
⇨ k=
14
x 1 2 3 4
P(X=x) 3 4 3 4
14 14 14 14
5
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution
Let, X be a discrete random variable then its discrete distribution function or
cumulative distribution function is defined as
FX(x) = P(X ≤ x) = 𝑃(𝑥𝑖)
1
;𝑥 ≤ 0
8
4
;𝑥 ≤ 1
8
i.e., 𝐹𝑋 𝑥 =
7
;𝑥 ≤ 2
8
1 ;𝑥 ≤ 3
6
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution
Problem1
If a random variable X has the following probability distribution
x 1 2 3 4 5
P(X=x) 0.2 0.1 0.4 0.2 0.1
Find F(3).
Solution:
F(3) = p(X≤3) = 0.2 + 0.1 + 0.4 = 0.7
7
Problem2
If F(1) = 0.2, F(2) = 0.9 and F(3) = 1 for a random variable X. Construct a
probability distribution table for the random variable X.
Solution:
P(X=3) = p(X ≤3) – p (X ≤2) = F(3) – F(2) = 1- 0.9 = 0.1
P(X=2) = p(X ≤2) – p (X ≤1) = F(2) – F(1) = 0.9 – 0.2 = 0.7
Table1. Probability Distribution Table.
x 1 2 3
P(X=x) 0.2 0.7 0.1
8
Probability Density Function (PDF)
Times in minutes (X) Frequency (f) Probability / Relative Frequency ( f/∑f ) Relative Frequency Density f(x)
1≤X≤2 20 0.2 0.2
2≤X<3 50 0.5 0.5
3≤X<4 30 0.3 0.3
∑f = 100 1
9
𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦
f(x) = 𝐶𝑙𝑎𝑠𝑠 𝑊𝑖𝑑𝑡ℎ
0.6
0.4
0.2
1 2 3 4 5
Times in minutes
10
Probability Density Function (PDF)
Times in minutes (X) Frequency (f) Probability / Relative Frequency ( f/∑f ) Relative Frequency Density f(x)
1≤X≤2 20 0.2 0.2
1 ≤ X < 1.5 5 0.05 0.1
1.5 ≤ X < 2 15 0.15 0.3
2≤X<3 50 0.5 0.5
2 ≤ X < 2.5 20 .20 .4
2.5 ≤ X < 3 30 .30 .6
3≤X<4 30 0.3 0.3
3 ≤ X < 3.5 20 .2 .4
3.5 ≤ X < 4 10 .1 .2
∑f = 100 1 11
𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦
f(x) = 𝐶𝑙𝑎𝑠𝑠 𝑊𝑖𝑑𝑡ℎ
0.6
0.4
0.2
1 2 3 4 5
Times in minutes
12
𝑅𝑒𝑙𝑎𝑡𝑖𝑣𝑒 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦
f(x) = 𝐶𝑙𝑎𝑠𝑠 𝑊𝑖𝑑𝑡ℎ
Probability Density Function (Pdf)
0.6
0.4
0.2
1 2 3 4 5
Times in minutes
13
Probability Density Function/Density Function
Definition
A function 𝑓 𝑥 is said to be probability density function (p.d.f.), if it satisfy the
following condition:
𝑖 𝑓 𝑥 ≥ 0 ; ∀ 𝑥 𝑖. 𝑒., −∞ < 𝑥 < ∞
∞
𝑖𝑖 ;∞
𝑓 𝑥 𝑑𝑥 = 1
It is also known as density function.
14
Probability Density Function/Density Function
Definition
A function 𝑓 𝑥 is said to be probability density function (p.d.f.), if it satisfy the
following condition:
𝑖 𝑓 𝑥 ≥ 0 ; ∀ 𝑥 𝑖. 𝑒., −∞ < 𝑥 < ∞
∞
𝑖𝑖 ;∞
𝑓 𝑥 𝑑𝑥 = 1
It is also known as density function.
15
Probability Density Function/Density Function
Example1. If X is a continuous random variable with the following p.d.f.
∝ 2𝑥 − 𝑥 2 ;0 < 𝑥 < 2
𝑓 𝑥 =
0 ; 0/𝑤
Find (i) ∝ 𝑎𝑛𝑑 𝑖𝑖 𝑃(𝑋 > 1)
16
Probability Density Function/Density Function
Solution. (i)
By definition, we know, p.d.f.
∞
𝑓 𝑥 𝑑𝑥 = 1
;∞
0 2 ∞
⇒ ;∞
𝑓 𝑥 𝑑𝑥 + 0
𝑓 𝑥 𝑑𝑥 + 2
𝑓 𝑥 𝑑𝑥 = 1
2
2
2 𝑥2 𝑥3
⇒ 𝑓 𝑥 𝑑𝑥 = 1 ⇒ 0
∝ (2𝑥 − 𝑥 2 )𝑑𝑥 = 1 ⇒∝ 2 − =1
2 3 0
0
8 3
⇒∝ 4 − =1 ∴ 𝛼 =
3 4
17
Probability Density Function/Density Function
Solution. (ii)
2 ∞ 23
P(x>1) = 1
𝑓 𝑥 𝑑𝑥 + 2
𝑓 𝑥 𝑑𝑥 = 1 4
(2𝑥 − 𝑥 2 ) 𝑑𝑥
2
3 𝑥2 𝑥3
= 2 −
4 2 3 1
3 8 1
= (4 − 1) − ( − )
4 3 3
1
=
2
18
Probability Density Function/Density Function
Example2. The random variable X has a p.d.f given by
1
4 − 3𝑥 2 ; −1 ≤ 𝑋 ≤ 1
7
f(x) = 1
;1 < 𝑋 ≤ 2
7
0 ; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑎𝑠𝑒
Sketch the p.d.f. and find the P(X≤ 0) 𝑎𝑛𝑑 𝑃(0.5 ≤ 𝑋 ≤ 1.5)
19
Parabola
*** Positive X squared is a parabola.
Upside down parabola
*** Negative X squared is a upside down parabola.
20
Probability Density Function/Density Function
Example2. The random variable X has a p.d.f given by
1
4 − 3𝑥 2 ; −1 ≤ 𝑋 ≤ 1
7
f(x) = 1
;1 < 𝑋 ≤ 2
7
0 ; 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑎𝑠𝑒
Sketch the p.d.f. and find the P(X≤ 0) 𝑎𝑛𝑑 𝑃(0.5 ≤ 𝑋 ≤ 1.5)
21
Probability Density Function/Density Function
f(x)
Solution of Example2.
(i) Sketching p.d.f. 4/7
P.d.f.
1/7 f(x) is always zero
f(x) is always zero
-1 0 0.5 1 1.5 2
22
Probability Density Function/Density Function
1 0
(ii) P(X≤ 0) = 4 − 3𝑥 2 𝑑𝑥
7 ;1
1 0
= 4𝑥 − 𝑥 3 ;1
7
1
= 0 − (−4 + 1)
7
3
=
7
23
Probability Density Function/Density Function
1 1 1 1 Area of Rectangle
(iii) P(0.5≤X≤ 1.5) = 1 4− 3𝑥 2 𝑑𝑥 + ( × )
7 2 7 2
1 1 1
= 4𝑥 − 𝑥3 1/2
+
7 14
1 1 1
= 3 − (2 − ) +
7 8 14
1 24;16:1 1
= +
7 8 14
9 1 13
= + =
56 14 56
24
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution (for Continuous random variable)
Definition
Let, X be a continuous random variable having p.d.f. 𝑓 𝑥 then FX(x) will be a
continuous distribution function of X if
𝑥
FX(x) = P(X ≤ x) = ;∞
𝑓 𝑥 𝑑𝑥
This is also known as cumulative distribution function.
Note: Relation between distribution function and density function is as follows:
𝑑
𝐹𝑋 (x) =𝑓 𝑥
𝑑𝑥
25
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution (for Continuous random variable)
Example1.
A continuous random variable X has a p.d.f. f(x), defined by
1
, 0≤𝑥<1
4
𝑓 𝑥 = 𝑥3
,1 ≤ 𝑥 ≤ 2
5
0 , 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Find the cumulative distribution function, F(𝑥).
26
• Shape of a positive cubic graph is given below.
27
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution (for Continuous random variable)
Solution.
If we sketch the pdf which is given below.
8/5
1/4
0 x 1 x 2
28
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution (for Continuous random variable)
Solution.
For 0 ≤ 𝑥 ≤ 1
1
𝐹 𝑥 = 𝑥
4
For 1 ≤ 𝑥 ≤ 2
𝑥 1
𝐹 𝑥 = 1
𝑓 𝑥 𝑑𝑥 +
4
𝑥 𝑥3 1
= 1 5
dx +
4
1 4 𝑥 1
= 𝑥 1+
20 4
1 4 1 1 1 1 𝑥 4 ;1:5
= 𝑥 −1 + = 𝑥4 − + =
20 4 20 20 4 20
1
∴ 𝐹(𝑥) = 𝑥4 + 4
20
29
Cumulative Distribution Function/Distribution Function/Probability Distribution
Function/Cumulative Probability Distribution (for Continuous random variable)
Solution.
0 ; 𝑥≤0
1
𝑥 ; 0≤𝑥<1
4
F 𝑥 = 1
𝑥4 +4 ;1 ≤ 𝑥 ≤ 2
20
1 ; 𝑥≥2
30