Chapter 2 Random Variables
Chapter 2 Random Variables
E-mail: [email protected]
January 9, 2025
4 Conditional expectation
Count the number of calls dropped due to errors over a particular time period:
N = 1, 2, 3...., countably infinite number of outcomes.
Marital status: NO
f (0) = P(X = 0) = 18 ,
3
f (1) = 8
= f (2),
1
f (3) = 8
.
f (0) + f (1) + f (2) + f (3) = 1
f : Probability Mass Function
(PMF).
Probability Distributions
The probability distribution of a random variable X is a description of the probabilities
associated with the possible values of X .
Let X be the number of cameras that pass the test. The distribution of X is as follows
X 0 1 2 3
f (x) = P(X = x) 0.23 C31 0.22 0.8 C32 0.2 ∗ 0.82 0.83
P(X ≤ x)
F (x) =
0, if x < 0,
0.008, if 0 ≤ x < 1,
= 0.104, if 1 ≤ x < 2,
0.488, if 2 ≤ x < 3,
1, if x ≥ 3
- Cumulative Distribution
Function (CDF)
0, if x
< 0,
0.008, if 0 ≤ x < 1,
F (x) = 0.104, if 1 ≤ x < 2,
0.488, if 2 ≤ x < 3,
1, if x ≥3
Now, suppose that we have the CDF F (x), how can we define PMF f (x)?
0, if x < 0,
0.008, if 0 ≤ x < 1,
F (x) = 0.104, if 1 ≤ x < 2,
0.488, if 2 ≤ x < 3,
1, if x ≥3
From the graph, we have that F (x) is only not continuous at 4 points: 0, 1, 2, 3 : possible
value of X .
Rb
3 P(a ≤ x ≤ b) = f (x)dx = area under f (x) from a to b for any a, b.
a
Remarks
For a continuous random variable X , P(X = x) = 0 for every x.
P(a ≤ X ≤ b) = P(a < X < b).
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 12 / 34
Electric Current
Let the continuous random variable X denote the current measured in a thin copper wire
in milliamperes. Assume that the range of X is [4.9, 5.1] mA, and assume that the
probability density function of X is f (x) = 5 for 4.9 ≤ x ≤ 5.1. What is the probability
that a current measurement is less than 5 milliamperes?
Z5 Z5
P(X < 5) = f (x)dx = 5dx = 0.5.
−∞ 4.9
Z∞
P(X > 12.6) = 20e −20(x−12.5) dx = e −2 .
12.6
dF (x)
Property: = f (x) (as long as the derivative exists).
dx
Example
Define the Probability
( density function PDF , given the cumulative distribution function
0, if x < 0,
CDF : F (x) = 2
1 − e −x , if x > 0.
(
0, if x < 0,
PDF: f (x) = 2
2xe −x , if x > 0.
Messages
The number of e-mail messages received per hour has the following distribution:
x = ] of messages 10 11 12 13 14 15
f (x) = P(X = x) 0.08 0.15 0.3 0.2 0.2 0.07
P
Expected value (mean/expectation): E(X ) = xf (x)= 12.5 (message).
x
Variance: V(X ) = (x − µ) f (x) = 1.85 (message 2 )
2
P
x p √
Standard deviation: σ = V(x)= 1.85 = 1.3601 (message)
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 18 / 34
Expectation (mean/expected value)
The mean or expected value of the discrete random variable X , denoted as µ or E(X ), is
P P
E(X ) = xf (x) = xP(X = x).
x x
Let X be the number of tests needed for a group of 5 people. We have the XS
distribution table:
x 1 6
f (x) 0.955 1 − 0.955
Example
The PDF of the weight of packages delivered by a post office is f (x) = 70/(69x 2 ) for
1 < x < 70 pounds.
(a)) Determine the probability that the weight of a package exceeds 50 pounds.
(b) Determine the mean and variance of weight.
(c) If the shipping cost is $2.50 per pound, what is the average shipping cost of a
package?
R70 70
(a) P(X > 50)= 2
dx = 0.0058
50 69x
R70 70 R70 70
(b) E(X ) = x. 2
dx= 4.3101; V (x) = x 2 . dx − 4.31012 = 51.4233
1 69x 1 69x 2
(c) E(cost)= 2.5 × 4.3101 = 10.7752 ($)
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 22 / 34
Expectation of a Function of a Random Variable
Median: Md(X)
is the point such that satisfies:
If X lis discrete, then
P(M ≤ Md) ≥ 0.5 and P(X ≥ Md) ≥ 0.5
If X is continuous then
P(X ≤ Md) = P(X ≥ Md) = 0.5
Mod(X ) = 1, 2. For Md(X ) we can take a value that is between 1 and 2. Regularly:
Md = 1+2
2
= 1.5.
Electric current
Let X be the current measured in a thin copper wire in miliamperes: f (x) = 5 for
4.9 ≤ x ≤ 5.1. Find E(X ), Mod(X ), Md(X ).
We have E(X ) = Md(X ) = 5. For Mod(X ) we can take an arbitrary value in [4.9, 5.1].
Hole Diameter
X denotes the diameter of a hole drilled in a sheet metal component with PDF
f (x) = 20e −20(x−12.5) , where x ≥ 12.5. Find E(X ), Mod(X ), Md(X ).
R∞
E(X ) = 20 xe −20(x−12.5) dx = 12.55. Mod(X ) = 12.5
12.5
R∞
P(X ≤ Md) = 20 Md e −20(x−12.5) dx = 0.5 ⇔ e 250−20Md = 0.5 ⇔ Md ≈ 12.5347.
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 25 / 34
Example
The scores in Calculus 1 of 20 students are given in the following table
6, 5, 7, 8, 6, 9, 8, 3, 7, 6, 4, 7, 4, 7, 6, 7, 6, 5, 4, 3.
a. Find the probability distribution of the score of a student in this course.
b. Evaluate E(X ), Mod(X ), Md(X ).
c. Evaluate V(X + 1), E(X 2 + 1).
a. Prob. distribution:
X 3 4 5 6 7 8 9
P(X = x) 0.1 0.15 0.1 0.25 0.25 0.1 0.05
P(X ≤ x) 0.1 0.25 0.35 0.6 0.85 0.95 1
P
b. E(X ) = xi f (xi ) = 5.9. Mod(X ): there are two values 6 và 7.
Md(X ) = 6 because P(X ≤ 6) = 0.6, P(X ≥ 6) = 0.65.
P 2
c. V(X + 1) = V(X ) = xi f (xi ) − (E(X ))2 = 2.69.
E(X 2 + 1) = (xi2 + 1)f (xi )= 38.5.
P
The response time is the speed of page downloads and it is critical for a mobile Web site.
Let X denote the number of bars of service, and let Y denote the response time (to the
nearest second) for a particular user and site. Consider 1000 page downloads, the number
of downloads in each category is given as below
x = ] of Bars of Signal Strength
y = Response time 1 2 3
4 150 100 50
3 20 100 50
2 20 30 200
1 10 20 250
- joint events.
(X , Y ) is a discrete random vector. Divide all data by 1000, we obtain
x = Number of Bars of Signal Strength
y = Response time 1 2 3
4 0.15 0.1 0.05
3 0.02 0.1 0.05
2 0.02 0.03 0.2
1 0.01 0.02 0.25
- joint probability distribution,(2 random variables: bivariate distribution).
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 27 / 34
Discrete random vectors (2 random variables)
Let Ω be a sample space. A pair of discrete random variables (X , Y ) defined on Ω is
called a discrete random vector.
Marginal Distribution
The individual probability distribution of a random variable is called its marginal
probability distribution.. Notation: fX , fY .
(Phan Thi Khanh Van) Chapter 2: Random variables January 9, 2025 28 / 34
Conditional probability distributions
Given that X = 1
x = Number of Bars of Signal Strength
y = Response time 1 2 3 fY
4 0.15 0.1 0.05 0.3
3 0.02 0.1 0.05 0.17
2 0.02 0.03 0.2 0.25
1 0.01 0.02 0.25 0.28
fX 0.2 0.25 0.55
0.15 0.02
P(Y = 4|X = 1) = = 0.75. P(Y = 2|X = 1) = = 0.1.
0.2 0.2
0.02 0.01
P(Y = 3|X = 1) = = 0.1. P(Y = 1|X = 1) = = 0.05.
0.2 0.2
P(X = x, Y = y ) fXY (x, y )
fY |x (y ) = = - Conditional PMF.
P(X = x) fX (x)
An orthopedic physician’s practice considers the number of errors in a bill and the
number of X-rays listed on the bill. Let the random variables X and Y denote the
number of errors and the number of X-rays on a bill, respectively.
x = Number of errors
y = Number of X-rays 0 1 2 fY
3 0.1275 0.034 0.0085 0.17
2 0.1875 0.05 0.0125 0.25
1 0.21 0.056 0.014 0.28
0 0.225 0.060 0.015 0.3
fX 0.75 0.2 0.05
The conditional probability mass function fY |x of Y given X = x:
x = Number of errors
y = Number of X-rays 0 1 2 fY
3 0.17 0.17 0.17 0.17
2 0.25 0.25 0.25 0.25
1 0.28 0.28 0.28 0.28
0 0.3 0.3 0.3 0.3
fX 0.75 0.2 0.05
From the table, we have that fY |x (y ) = fY (y ) for any y : X and Y are independent
random(Phan
variables.
Thi Khanh Van) Chapter 2: Random variables January 9, 2025 31 / 34
Independence
Two random variables X and Y are called independent , if one of the following
equivalent properties is true
1 fXY (x, y ) = fX (x)fY (y ), ∀x, y
2 fY |x (y ) = fY (y ), ∀x, y : fX (x) > 0
3 fX |y (x) = fX (x), ∀x, y : fY (y ) > 0
4 P(X ∈ A, Y ∈ B) = P(X ∈ A)P(Y ∈ B),
for any sets A, B in the range of X , Y , resp.
Properties
If X and Y are two independent random variables, we have:
E(XY ) = E(X )E(Y ), V(aX ± bY ) = a2 V(X ) + b 2 V(Y ).