4 - Mathematical Expectations
4 - Mathematical Expectations
4 - Mathematical Expectations
Expectation
EM 7: Engineering Data Analysis
Second Semester, 2019-20
Pamantasan ng Lungsod ng Valenzuela
1
Lecture Outline
• What is mathematical expectation?
• Mean of random variables
• Variance and covariance of random variables
• Means and variances of linear combination of
random variables
• Chebyshev’s Theorem
2
Example
If two coins are tossed 16 times and X is the
number of heads that occur per toss, then the
values of X is 0, 1, 2. (Why?)
4 7 5
0 + 1 + 2 = 1.06
16 16 16 3
The numbers 4/16, 7/16 and 5/16 are the fractions of the total tosses resulting in 0,
1, and 2 heads respectively.
3
Example
Assuming that fair coins were tossed, we find the
probability distribution as followed:
Sample points Probability
𝑃(𝑋 = 0) 1/4
𝑃(𝑋 = 1) 1/2
𝑃(𝑋 = 2) 1/4
This means that a person who tosses 2 coins over and over again will, on the average,
get 1 head per toss.
4
Mean of Random Variables
DEFINITION: Let X be a random variable with probability distribution 𝑓(𝑥).
The mean or expected value of X is:
𝜇=𝐸 𝑋 = 𝑥𝑓(𝑥)
if X is discrete. If X is continuous,
𝜇=𝐸 𝑋 = 𝑥𝑓 𝑥 𝑑𝑥
5
Example
A lot containing 7 components is sampled by a
quality inspector; the lot contains 4 good
components and 3 defective components. A
sample of 3 is taken by the inspector. Find the
expected value of the number of good
components in this sample.
6
Example
In a gambling game, a man is paid Php 5.00 if
he gets all heads or all tails when 3 coins are
tossed, and he will pay out Php 3.00 if either
one of two heads show. What is his expected
gain?
In this game, the gambler will, on average, lose Php 1.00 per toss of the 3 coins.
A game is “fair” if the gambler on the average, come out even.
7
Example
Let X be the random variable that denotes the
life in hours of a certain electronic device. The
probability density function is:
20,000
𝑓 𝑥 = , 𝑥 > 100
𝑥
0, elsewhere
8
Mean of Random Variables
DEFINITION: Let X and Y be random variables with joint probability
distribution 𝑓(𝑥, 𝑦). The mean or expected value of the random variable
𝑔(𝑋, 𝑌) is:
𝜇 ( , ) = 𝐸 𝑔 𝑋, 𝑌 = 𝑔 𝑥, 𝑦 𝑓(𝑥, 𝑦)
𝜇 ( , ) = 𝐸 𝑔 𝑋, 𝑌 = 𝑔 𝑥, 𝑦 𝑓 𝑥, 𝑦 𝑑𝑥 𝑑𝑦
9
Example
Suppose that the number of cars X that pass
through a car wash between 4:00pm and
5:00pm on any sunny Friday has the following
probability distribution:
x 4 5 6 7 8 9
𝑃(𝑋 = 𝑥) 1/12 1/12 1/4 1/4 1/6 1/6
E[g(X)] = E(10X-1)
10
Example
Let X be a random variable with density
function:
𝑥
𝑓 𝑥 = 3 , −1 < 𝑥 < 2
0, elsewhere
11
11
Mean of Random Variables
DEFINITION: Let X be a random variable with probability distribution 𝑓(𝑥).
The mean or expected value of the random variable 𝑔(𝑋) is:
𝜇 ( ) = 𝐸[𝑔 𝑋 ] = 𝑔 𝑥 𝑓(𝑥)
if X is discrete. If X is continuous,
𝜇 ( ) = 𝐸[𝑔 𝑋 ] = 𝑔 𝑥 𝑓 𝑥 𝑑𝑥
12
12
Example
Two refills for a ballpoint pen are selected at
random from a box that contains 3 blue refills, 2
red refills, and 3 green refills. If X is the number
of blue refills and Y is the number of red refills
selected, find the expected value of 𝑔 𝑋, 𝑌 =
𝑋𝑌.
x
f(x,y) Row total
0 1 2
0 3/28 9/28 3/28 15/28
y 1 3/14 3/14 3/7
2 1/28 1/28
13
13
Variance of Random Variables
The mean does not give adequate description of
the shape of the distribution.
14
Variance of Random Variables
DEFINITION: Let X be a random variable with probability distribution 𝑓 𝑥
and mean 𝜇. The variance of X is:
𝜎 = 𝑉𝑎𝑟 𝑋 = 𝐸[ 𝑋 − 𝜇 ] = 𝑥 − 𝜇 𝑓(𝑥)
if X is discrete. If X is continuous,
𝜎 = 𝑉𝑎𝑟 𝑋 = 𝐸[ 𝑋 − 𝜇 ] = 𝑥 − 𝜇 𝑓 𝑥 𝑑𝑥
15
15
Example
Let the random variable X represent the number
of automobiles that are used for official business
purposes on any given workday. The probability
distribution for company A is:
x 1 2 3
𝑓(𝑥) 0.30 0.40 0.30
A:
mu = E(X) = 2.0
sigma2 = sum(1,3) (x-2)^2 f(x) = 0.60
B:
mu = E(X) = 2.0
sigma2 = sum(0,4) (x-2)^2 f(x) = 1.60
16
Variance of Random Variables
DEFINITION: The variance of a random variable X is:
𝜎 =𝐸 𝑋 −𝜇
17
Solution:
mu = 0*0.51 + 1*0.38 + 2*0.10 + 3*0.01 = 0.61
E(X2) = 0*0.51 + 1*0.38 + 4*0.10 + 9*0.01 = 0.87
Therefore
Variance = 0.87 – 0.61^2 = 0.4979
17
Example
The weekly demand for a drinking-water
product, in thousands of liters, from a local
chain of efficiency stores is a continuous
random variable X having the probability
density:
2 𝑥 − 1 ,1 < 𝑥 < 2
𝑓 𝑥 =
0, elsewhere
18
Therefore
Variance = 17/6 – (5/3)^2 = 1/18
18
Variance of Random Variables
The variance or standard deviation has meaning
only when two or more distributions that have
the same units of measurement are compared.
It would not be meaningful to compare the
variance of a distribution of different quantities.
We shall now extend the concept of variance of
a random variable X to include random
variables related to X.
19
19
Variance of Random Variables
DEFINITION: Let X be a random variable with probability distribution 𝑓 𝑥 .
The variance of random variable 𝑔(𝑋) is:
𝜎 ( ) =𝐸 𝑔 𝑋 −𝜇 = [𝑔 𝑥 − 𝜇 ( )] 𝑓(𝑥)
if X is discrete. If X is continuous,
𝜎 ( ) =𝐸 𝑔 𝑋 −𝜇 = 𝑔 𝑥 −𝜇 𝑓 𝑥 𝑑𝑥
20
Example
Let X be a random variable with density
function:
𝑥
𝑓 𝑥 = 3 , −1 < 𝑥 < 2
0, elsewhere
Note: E(4X + 3) = 8
21
Covariance of Random
Variables
DEFINITION: Let X and Y be random variables with probability distribution
𝑓 𝑥, 𝑦 . The covariance of X and Y is:
𝜎 =𝐸 𝑋−𝜇 𝑌−𝜇 = 𝑥−𝜇 𝑦 − 𝜇 𝑓(𝑥, 𝑦)
22
22
Covariance of Random
Variables
When X and Y are statistically independent, it
can be shown that the covariance is zero.
Two variables may have zero covariance and
still not be statistically independent. Covariance
only describes the linear relationship between
two random variables.
Therefore, if a covariance between X and Y is
zero, X and Y may have a nonlinear relationship,
which means that they are not necessarily
independent.
23
23
Covariance of Random
Variables
DEFINITION: The covariance of two random variables X and Y with means
𝜇 and 𝜇 , respectively, is given by,
𝜎 = 𝐸 𝑋𝑌 − 𝜇 𝜇
24
24
Example
The fraction X of male runners and the fraction Y
of female runners who compete in marathon
races are described by the joint density function
8𝑥𝑦, 0 ≤ 𝑦 ≤ 𝑥 < 1
𝑓 𝑥 =
0, elsewhere
25
And
25
Means and Variances of
Linear Combinations of
Random Variables
26
26
Properties of Means and
Variances
THEOREM: If a and b are constants, then
𝐸 𝑎𝑋 + 𝑏 = 𝑎𝐸 𝑋 + 𝑏
Corollary 1:
Setting 𝑎 = 0, we see that 𝐸 𝑏 = 𝑏.
Corollary 2:
Setting 𝑏 = 0, we see that 𝐸 𝑎𝑋 = 𝑎𝐸(𝑋).
27
27
Examples
Rework previous examples using the new
properties.
28
28
Properties of Means and
Variances
THEOREM: The expected value of the sum or difference of two or more
functions of a random variable X is the sum or difference of the expected
values of the functions. That is,
𝐸 𝑔 𝑋 ±ℎ 𝑋 =𝐸 𝑔 𝑋 ±𝐸 ℎ 𝑋
29
E(1) = 1
E[(X-1)] = 2-2(1)+1 = 1
29
Properties of Means and
Variances
Example: The weekly demand for a certain drink, in
thousands of liters, at a chain of convenience stores
is a continuous random variable 𝑔 𝑋 = 𝑋 + 𝑋 − 2,
where X has the density function. Find the expected
value of the weekly demand for the drink.
2(𝑥 − 1), 1 < 𝑥 < 2
𝑓 𝑥 =
0, elsewhere
THEOREM: The expected value of the sum or difference of two or more
functions of the random variables X and Y is the sum or difference of the
expected values of the functions. That is,
𝐸 𝑔 𝑋, 𝑌 ± ℎ 𝑋, 𝑌 = 𝐸 𝑔 𝑋, 𝑌 ± 𝐸 ℎ 𝑋, 𝑌
30
E(2) = 2
30
Properties of Means and
Variances
THEOREM: If X and Y are random variables with joint probability
distribution 𝑓(𝑥, 𝑦), and a, b, and c are constants, then,
𝜎 = 𝑎 𝜎 + 𝑏 𝜎 + 2𝑎𝑏𝜎
Example 1:
SigmaZ^2 = sigma2_3X-4Y+8 = sigma2_3X-4Y
= 9sigmaX^2 + 16sigmaY^2 – 24sigmaXY
= 9*2 + 16*4 – 24*(-2) = 130
Example 2:
SigmaZ^2 = sigma2_3X-2Y+5 = sigma2_3X-2Y
= 9sigmaX^2 + 4sigmaY^2
= 9*2 + 4*3 = 30
31
Chebyshev’s Theorem
32
32
Chebyshev’s Theorem
If a random variable has a small variance or
standard deviation, we would expect most of the
values to be grouped around the mean.
Therefore, the probability that the random
variable assumes a value within a certain
interval about the mean is greater than for a
similar random variable with a larger standard
deviation.
33
33
Chebyshev’s Theorem
If the probability is expressed as an area, we
would expect a continuous distribution with a
large value of 𝜎 to indicate a greater variability,
and thus, the area should be more spread out.
34
34
Chebyshev’s Theorem
Similar physical characteristics of a discrete
distribution appears on its probability histogram.
35
35
Chebyshev’s Theorem
In late 19th century, Russian mathematician
Pafnuty Lvovich Chebyshev (1821-1894)
discovered that the fraction of the area between
any two values symmetric about the mean is
related to the standard deviation.
Since the area under a probability distribution
curve or in a probability histogram is always 1,
the area between any two numbers is the
probability of the random variable assuming a
value between these numbers.
36
36
Chebyshev’s Theorem
CHEBYSHEV’S THEOREM: The probability that any random variable X
will assume a value within k standard deviations of the mean is at least 1 −
1/𝑘 . That is,
1
𝑃 𝜇 − 𝑘𝜎 < 𝑋 < 𝜇 + 𝑘𝜎 ≥ 1 −
𝑘
37
Example
A random variable X has a mean 𝜇 = 8, a
variance 𝜎 = 9, and an unknown type of
probability distribution. Calculate the following:
1. 𝑃(−4 < 𝑋 < 20)
2. 𝑃 𝑋 − 8 ≥ 6
38
38
Chebyshev’s Theorem
Chebyshev’s Theorem holds for any type of
distribution of observations, and for this reason
the results are usually weak.
The value given by the theorem is a lower bound
only. For example, we know that the probability
of a random variable falling within two standard
deviations of the mean can be no less than ¾,
but we never know how much more it might
actually be. Only when the probability
distribution is known we can determine exact
probabilities.
39
39
Chebyshev’s Theorem
For this reason, we call the theorem a
distribution-free result. When specific
distributions are assumed, the results will be
less conservative.
The use of Chebyshev’s Theorem is relegated to
situations where the form of the distribution is
unknown.
40
40