Professional Documents
Culture Documents
Random Variables
Random Variables
Random variables
If the sample points are whole numbers or can be assigned to whole numbers, i.e. X
takes integers, then the sample space is a discrete sample space. X in this case is a
discrete random variable.
• Drawing 1 card from a complete deck of playing cards.
If the sample space contains an infinite number of possibilities, i.e. X takes any
number within a certain region, then the sample space is a continuous sample space.
X in this case is a continuous random variable.
• The instantaneous speed of a taxi on its way from Changi Airport to NTU.
T H TH 0.25 1
0 0.25
T TT 0.25 0
If you find it confusing, you can use the two cases interchangeably.
Probability
T HT 0.25 1
1 0.50 0.75 0.4
0.2
T H TH 0.25 1
0 0.25 0.25 0
0 1 2
T TT 0.25 0 x
CH2010 Engineering Statistics AY2023 v6 PL 11
Example 3.1
Toss a fair coin 4 times, each head is 1 point, each tail is 0 point. X is the total
number of points.
Size of sample space = 24 = 16
æ 4ö 1 1
çç ÷÷ = 1 f (0) = F (0) =
Possible ways of getting 0 points (0H4T)= è0ø 16 16
æ 4ö 4 5
Possible ways of getting 1 point (1H3T) = çç ÷÷ = 4
è1ø
f (1) =
16
F (1) =
16
æ 4ö 6 11
Possible ways of getting 2 points (2H2T) = çç ÷÷ = 6
è 2ø
f (2) =
16
F (2) =
16
æ 4ö 4 15
Possible ways of getting 3 points (3H1T) = çç ÷÷ = 4 f (3) = F (3) =
16
è 3ø 16
æ 4ö 1 16
Possible ways of getting 4 points (4H0T) = çç ÷÷ = 1 f (4) = F (4) =
è 4ø 16 16
𝑥!
𝑓 𝑥 = $ 3 , −1 < 𝑥 < 2
0, elsewhere
(a) Verify that f(x) is indeed a probability density function.
(b) Find P(0 < x ≤ 1),
f ( x, y, ) = P( X = x, Y = y, )
X\Y 1 2 3 4 5 6
1 (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
2 (2,1) (2,2) (2,3) (2,4) (2,5) (2,6)
3 (3,1) (3,2) (3,3) (3,4) (3,5) (3,6)
4 (4,1) (4,2) (4,3) (4,4) (4,5) (4,6)
5 (5,1) (5,2) (5,3) (5,4) (5,5) (5,6)
6 (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)
æ 3 öæ 2 öæ 3 ö
çç ÷÷çç ÷÷çç ÷÷
è x øè y øè 2 - x - y ø
f ( x, y ) =
æ8ö
çç ÷÷
è 2ø
f (x, y)
2
x
0 1 2
Source: Math StackExchange
Thus, it is foreseeable that for 2 continuous random variables, the joint probability
distribution, i.e. joint density function, will look like a curved surface lying above
the x-y plane, where the height is the joint probability density.
CH2010 Engineering Statistics AY2023 v6 PL 30
Definition 3.6
¥ ¥ 1 1 2
=ò
ò ò 0 ò0 5
f ( x, y )dxdy (2 x + 3 y )dxdy
-¥ -¥
x =1
1 é 2x 6 xy ù
2
=ò ê + ú dy
0
ë 5 5 û x =0
1
æ 2 6y ö
1 é 2 y 3y ù 2
=ò ç + ÷dy = ê + ú
0 5 5 ø
è ë 5 5 û0
2 3
= + =1
5 5
CH2010 Engineering Statistics AY2023 v6 PL 33
Example 3.6 continued
Answer:
(b) To calculate the probability, we use
é 1 1 1ù 1/ 2 1/ 2 2
P ê0 < x < , < y < ú = ò ò (2 x + 3 y )dxdy
ë 2 4 2û 1 / 4 0 5 "
" $% "
! 2𝑥 ! 6𝑥𝑦 ! ! 1 3𝑦
2 + 𝑑𝑦 = 2 + 𝑑𝑦
" 5 5 $%& " 10 5
# #
1/ 2
é y 3y2 ù
=ê + ú
ë10 10 û1 / 4
1 éæ 1 3 ö æ 1 3 öù 13
= êç - ÷ - ç + ÷ú =
10 ëè 2 4 ø è 4 16 øû 160
CH2010 Engineering Statistics AY2023 v6 PL 34
3.5 Marginal distribution
Integrating a joint probability distribution function or
joint probability density function f(x,y) with respect to Y
h(y) g(x) or X gives us g(x) or h(y), respectively.
g(x) and h(y) are the marginal distributions of X and Y,
respectively.
f(x, y)
Marginal distributions can be thought of similar to (but
not exactly) 2-D projections of the 3-D joint PDF on the
x-z plane or the y-z plane, where the z-direction
represents the value of f(x, y).
h(0)
h(1)
h(2)
Definition 3.8 can be extended to describe probability that the value of X falls
between a and b given Y = y for discrete and continuous random variables.
P(a < X < b | Y = y ) = å f ( x | y)
a < x <b
Now f ( x,1) æ 7 ö
f ( x | 1) = = ç ÷ f ( x,1), x = 0,1,2.
h(1) è3ø
Therefore,
æ7ö æ 7 öæ 3 ö 1 æ7ö æ 7 öæ 3 ö 1
f (0 | 1) = ç ÷ f (0,1) = ç ÷ç ÷ = f (1 | 1) = ç ÷ f (1,1) = ç ÷ç ÷ =
è3ø è 3 øè 14 ø 2 è3ø è 3 øè 14 ø 2
æ7ö æ7ö
f (2 | 1) = ç ÷ f (2,1) = ç ÷(0 ) = 0
è3ø è3ø
CH2010 Engineering Statistics AY2023 v6 PL 41
Example 3.9 (continued)
Therefore, the conditional distribution of X, given Y = 1 is
x 0 1 2
f(x|1) ½ ½ 0
Finally,
1
P( X = 0 | Y = 1) = f (0 | 1) =
2
Recall from Example 3.5 that X = no. of blue pens, Y = no. of red pens.
X = 0 → no blue pen, Y = 1 → one red pen.
Therefore, we know that if 1 and only 1 of the 2 pens selected is red, there is a 0.5
probability that the other one is green. There is also 0.5 probability that the other
one is blue.
CH2010 Engineering Statistics AY2023 v6 PL 42
Statistical independence
Re-writing the second point in Definition 3.8 in the form of product rule, we have:
f ( x, y ) = f ( x | y ) h ( y )
Substituting this into Definition 3.7 (marginal distribution), we have:
¥ ¥
g ( x) = ò f ( x, y )dy = ò f ( x | y )h( y )dy
-¥ -¥
If f(x|y) does not depend on y,
¥
g ( x) = f ( x | y ) ò h( y )dy
-¥
By definition of marginal distribution:
¥
ò
-¥
h( y )dy = 1