Professional Documents
Culture Documents
Chapter 2 Randomvariablesandprobabilitydistributions
Chapter 2 Randomvariablesandprobabilitydistributions
1
A random variable may be either discreet or continuous.
X Possible values of X
Number of dots appear when tossing a die 0, 1, 2, 3, 4, 5, 6
Number of books in a bag 0, 1, 2, 3, 4, 5, 6, 7, 8, ....
Number of students in a class 0, 1, 2, 3, 4, 5, 6, 7, 8, ….
2
Theory 1
The probability distribution of a discrete random variable 𝑋 is described
as the function 𝑃(𝑋=𝑥) = 𝑃(𝑥) which satisfies:
• 0≤𝑃 𝑥 ≤1
• σ𝑛𝑖=1 𝑃 𝑋 = 1
• 𝑃 𝑥𝑖 = 𝑃(𝑋 = 𝑥𝑖 )
Example 2.1
3
x -1 0 1 2 3
P(X=x) 1/8 2/8 2/8 2/8 1/8
x -1 0 1 2 3
P(X=x) 1/8 2/8 2/8 2/8 1/8
4
Cumulative Distribution of Discreet Random Variables
It is a function giving the probability that the random variable X is less
than or equal to x, for every value x.
For a discrete random variable, the cumulative distribution function is
found by summing up the probabilities.
Theory 2
The cumulative distribution function of a discrete random variable X is
described as the function 𝐹 𝑥 = 𝑃 𝑋 ≤ 𝑥 = σ𝑛−∞ 𝑃(𝑋 = 𝑥) which
satisfies:
10
10
5
Theory 3
The cumulative distribution function of a discrete random variable 𝑋
can be calculated by using the following formula:
• 𝑃 𝑋≤𝑟 =𝐹 𝑟
• 𝑃 𝑋 > 𝑟 =1−𝐹 𝑟
• 𝑃 𝑋 <𝑟 =𝑃 𝑋 ≤𝑟−1 =𝐹 𝑟−1
• 𝑃 𝑋 =𝑟 =𝐹 𝑟 −𝐹 𝑟−1
• 𝑃 𝑟 < 𝑋 ≤ 𝑠 =𝐹 𝑠 −𝐹 𝑟
• 𝑃 𝑟 ≤ 𝑋 ≤ 𝑠 =𝐹 𝑠 −𝐹 𝑟 +𝑓 𝑟
• 𝑃 𝑟 ≤ 𝑋 < 𝑠 =𝐹 𝑠 −𝐹 𝑟 +𝑓 𝑟 −𝑓 𝑠
• 𝑃 𝑟 < 𝑋 < 𝑠 = 𝐹 𝑠 − 𝐹 𝑟 − 𝑓(𝑠)
11
11
Example 2.2
x -2 -1 0 1 2
P(X=x) 0.12 0.22 0.24 0.23 0.19
12
12
6
x -2 -1 0 1 2
P(X=x) 0.12 0.22 0.24 0.23 0.19
𝟎, 𝑿 < −𝟐
𝟎. 𝟏𝟐, −𝟐 ≤ 𝑿 < −𝟏
𝟎. 𝟑𝟒, −𝟏 ≤ 𝑿 < 𝟎
𝑭 𝒙 =
𝟎. 𝟓𝟖, 𝟎≤𝑿<𝟏
𝟎. 𝟖𝟏, 𝟏≤𝑿<𝟐
𝟏, 𝑿≥𝟐
13
13
Or alternatively:
x < -2 -2 -1 0 1 >2
P(X=x) 0 0.12 0.22 0.24 0.23 0.19
F(x) 0 0.12 0.34 0.58 0.81 1
𝟎, 𝑿 < −𝟐
𝟎. 𝟏𝟐, −𝟐 ≤ 𝑿 < −𝟏
𝟎. 𝟑𝟒, −𝟏 ≤ 𝑿 < 𝟎
𝑭 𝒙 =
𝟎. 𝟓𝟖, 𝟎≤𝑿<𝟏
𝟎. 𝟖𝟏, 𝟏≤𝑿<𝟐
𝟏, 𝑿≥𝟐
14
14
7
Example 2.3
0, 𝑋 < −1
0.08, −1 ≤ 𝑋 < 2
𝐹 𝑥 = 0.36, 2 ≤ 𝑋 < 5
0.67, 5 ≤ 𝑋 < 7
1, 𝑋≥7
15
15
0, 𝑋 < −1
0.08, −1 ≤ 𝑋 < 2
𝐹 𝑥 = 0.36, 2 ≤ 𝑋 < 5
0.67, 5 ≤ 𝑋 < 7
1, 𝑋≥7
x F(x) P(X=x)
-1 0.08 0.08 – 0 = 0.08
2 0.36 0.36 – 0.08 = 0.28
5 0.67 0.67 – 0.36 = 0.31
7 1 1 – 0.67 = 0.33
16
16
8
Mean of a Probability Distribution
It is the weighted average over all possible outcomes, with the weight
for each outcome being the relative frequency or probability associated
with that outcome.
Theory 4
Mean (or expected value) of a probability distribution is
17
17
Theory 5
Variance of a probability distribution is
𝜎 2 = 𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 2 − 𝐸 𝑋 2
18
18
9
Theory 6
Standard deviation of a probability distribution is
𝜎 = 𝑠𝑡𝑑 𝑋 = 𝑉𝑎𝑟(𝑋)
Note: 𝐸 𝑎𝑋 + 𝑏 = 𝑎𝐸 𝑥 + 𝑏
𝑉𝑎𝑟 𝑎𝑋 + 𝑏 = 𝑎2 𝑉𝑎𝑟 𝑥 + 𝑉𝑎𝑟 𝑏 = 𝑎2 𝑉𝑎𝑟 𝑥 + 0
19
19
Example 2.4
x -1 0 1 2 3
P(X=x) 0.34 0.23 0.12 0.15 k
20
20
10
x -1 0 1 2 3
P(X=x) 0.34 0.23 0.12 0.15 0.16
Mean, E(X)
E(X) = S x ∙ P(X) = -1(0.34) + 0(0.23) + 1(0.12) + 2(0.15) + 3(0.16)
= 0.56
E(X2) = S x2 ∙ P(X) = (-12)(0.34) + (02)(0.23) + (12)(0.12) + (22)(0.15)
+ (32)(0.16)
= 2.5
Var(X) = E(X2) – [E(X)]2 = 2.5 – (0.56)2 = 2.19
Std(X) = √Var(X) = √2.19 = 1.48
21
21
X Possible values of X
Height of Year 5 primary school students 130 cm < x < 160 cm
Time taken to complete a 20-minute quiz 1 minute < x < 20 minutes
Distance between two cities 10 km < x < 20,010 km
22
22
11
Theory 7
Properties of the Probability Density Function (pdf), i.e. f(x), of
Continuous Random Variables:
• 𝑓(𝑥) ≥ 0
∞
• −∞ 𝑓 𝑥 𝑑𝑥 = 1
23
23
Example 2.5
3 2
𝑓 𝑥 = 4 2𝑥 − 𝑥 , 0 < 𝑥 < 2
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
24
24
12
(a) P(X > 1) = P(1 < X < 2)
2 2
3 3 𝑥3 3 23 13
න 2𝑥 − 𝑥 2 𝑑𝑥 = 𝑥 2 − = 22 − − 12 −
1 4 4 3 1
4 3 3
3 8 1
= 4− − 1−
4 3 3
= 0.50
25
25
1 1
3 3 𝑥3 3 13 03
න 2𝑥 − 𝑥 2 𝑑𝑥 = 𝑥 2 − = 12 − − 02 −
0 4 4 3 0
4 3 3
3 1
= 1− − 0
4 3
= 0.50
26
26
13
(c) P(0.5 < X < 2)
2 2
3 3 𝑥3 3 23 0.51
න 2𝑥 − 𝑥 2 𝑑𝑥 = 𝑥 2 − = 22 − − 0.51 −
0.5 4 4 3 0.5
4 3 3
3 8 0.5
= 4− − 0.5 −
4 3 3
= 0.75
27
27
Example 2.6
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
28
28
14
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
29
29
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
1 1 1
1 1 𝑥 1 𝟏
න 2 𝑑𝑥 = න 𝑑𝑥 = = −0=
0 4 0 2 2 0 2 𝟐
30
30
15
2𝑐 , 0≤𝑥≤2
𝑓 𝑥 = 2𝑐 2𝑥 − 3 , 2≤𝑥≤3
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
3 3
1 3
න 2 (2𝑥 − 3) 𝑑𝑥 = න (𝑥 − ) 𝑑𝑥
2.5 4 2.5 2
3 3
3 𝑥 2 3𝑥 (3)2 3(3) 2.5 2
3 2.5
න 𝑥− 𝑑𝑥 = − = − − −
2.5 2 2 2 2.5
2 2 2 2
= 0.625
31
31
𝐹 𝑥 = 𝑃 𝑋 ≤ 𝑥 = 𝑓𝑡
𝑡≤𝑥
Again, F(x) accumulates all of the probability less than or equal to x. The
cumulative distribution function for continuous random variables is just a
straightforward extension of that of the discrete case.
All we need to do is replace the summation with an integral.
32
32
16
Theory 8
The cumulative distribution function of a continuous random variable 𝑋
is described as the function:
𝑥
𝐹 𝑥 = 𝑃 𝑋 ≤ 𝑥 = −∞ 𝑓 𝑥 𝑑𝑥 for −∞ < 𝑥 < ∞
33
33
Example 2.7
𝑥ൗ , 0<𝑥<4
𝑓 𝑥 = 8
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
34
34
17
𝑥ൗ , 0<𝑥<4
𝑓 𝑥 = 8
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝑥 𝑥
𝑥 𝑥2 𝑥2 𝑥2
න 𝑑𝑥 = = −0=
0 8 16 0
16 16
0, 𝑥<0
→ 2
𝐹 𝑥 = 𝑥 /16, 0 ≤ 𝑥 < 4
1, 𝑥≥4
35
35
0, 𝑥<0
2
𝐹 𝑥 = 𝑥 /16, 0 ≤ 𝑥 < 4
1, 𝑥≥4
22
(a) P(X < 2) = P(X < 2) = F(2) = = 𝟎. 𝟐𝟓
16
12
(b) P(X > 1) = 1 – P(X < 1) = 1 – F(1) = 1 − = 𝟎. 𝟗𝟑𝟕𝟓
16
36
36
18
Mean, Variance and Standard Deviation of Continuous
Random Variables
Theory 9
The mean (or expected value) of a continuous random variable 𝑋 is:
∞
𝜇 = 𝐸 𝑋 = න 𝑥. 𝑓 𝑥 𝑑𝑥
−∞
37
37
Theory 10
The variance of a continuous random variable 𝑋 is:
𝜎 2 = 𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 2 − 𝐸(𝑋) 2
∞
where 𝐸 𝑋 2 = න 𝑥 2 . 𝑓 𝑥 𝑑𝑥
−∞
Theory 11
The standard deviation of a continuous random variable 𝑋 is:
𝜎 = 𝑆𝑡𝑑 𝑋 = 𝑉𝑎𝑟(𝑋)
38
38
19
Example 2.8
The continuous random variable 𝑋 has the pdf given below. Determine
the mean and variance.
𝑥ൗ , 0<𝑥<4
𝑓 𝑥 = 8
0, 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Mean
4 4 2 4
𝑥 𝑥 𝑥3 43
𝐸 𝑋 =න 𝑥 𝑑𝑥 = න 𝑑𝑥 = = − 0 = 𝟐. 𝟔𝟔𝟕
0 8 0 8 24 0
24
39
39
Variance
4 4 3 4
2 2
𝑥 𝑥 𝑥4 44
𝐸 𝑋 =න 𝑥 𝑑𝑥 = න 𝑑𝑥 = = − 0 = 8.0
0 8 0 8 32 0
32
𝑉𝑎𝑟 𝑋 = 𝐸 𝑋 2 − 𝐸 𝑋 2
= 8.0 − 2.6672 = 𝟎. 𝟖𝟖𝟕
40
40
20