Chapter 4: Mathematical Expectation
Definition 4.1
Let X be a random variable with probability distribution f(x). The
mean or expected value of X is
= E ( x) = xf ( x)
x
If X is discrete, and
= E ( x) = xf ( x)dx
−
Example 4.1
A lot containing 7 motorcycle headlights is sampled by a quality
inspector; the lot contains 4 good headlights and 3 defective
headlights. A sample of 3 is taken by the inspector. Find the expected
value of the number of good headlights in this sample.
ANS:
Let x represent the number of good headlights in the sample. The
probability distribution of x is
4 3
−
f ( x) =
x 3 x
7 , X = 0, 1, 2, 3.
3
f(0) = 1/35, f(1) = 12/35, f(2) = 18/35, f(3) = 4/35
= E ( x) = 0(1 / 35) + 1(12 / 35) + 2(18 / 35) + 3(4 / 35) = 12 / 7
Example 4.2
In a gambling game a man is paid $5 if he gets all heads or all tails
when three coins tossed, and he will pay out $3 if either one or two
heads show. What is his expected gain?
ANS:
S = {HHH, HHT, HTH, THH, HTT, THT, TTH, TTT}
Each of these possibilities is equally likely and occurs with probability
equal to 1/8.
The random variable of interest is Y, the amount the gambler can win;
and the possible values of Y are $5 if event E1 = {HHH, TTT} occurs
and -$3 if event
E2 = {HHT, HTH, THH, HTT, THT, TTH}
= E (Y ) = 5 p( E1 ) + (−3) p( E 2 ) = 5(1 / 4) + (−3)(3 / 4) = −1
Example 4.3
Let X be the random variable that denotes the life in hours of a traffic
light. The probability density function is
20000
, x 100
f ( x) = x 3
0, elsewhere
Find the expected life of this type of device
ANS:
20000 20000
= E ( X ) = x 3 dx = 2
dx =200
100
x 100
x
Therefore, we can expect this type of device to last, on average, 200
hours.
Theorem 4.1
Let X be a random variable with probability distribution f(x). The
expected value of the random variable g(X) is
g ( x ) = E ( g ( x)) = g ( x) f ( x)
x
If X is discrete, and
g ( x ) = E ( g ( x)) = g ( x) f ( x)dx
−
If X is continuous.
Example 4.4
Suppose that the number of X that pass though a car wash between
4:00 pm and 5:00 pm on any sunny Friday has the following
probability distribution:
X 4 5 6 7 8 9
P(X=x) 1/12 1/12 ¼ 1/4 1/6 1/6
Let g(x) = 2x-1 represent the amount of money in dollars, paid to the
attendant by the manager. Find the attendant’s expected earnings for
this particular time period.
ANS:
9
E ( g ( x)) = E (2 x − 1) = (2 x − 1) f ( x)
x=4
= 7(1 / 12) + 9(1 / 12) + 11(1 / 4) + 13(1 / 4) + 15(1 / 6) + 17(1 / 6) = $12.67
Example 4.5
Let X be a random variable with density function
x2
f ( x) = 3 , − 1 x 2
0, elsewhere
Find the expected value of g(x) =4x+3
ANS:
(4 x + 3) x 2
2 2
1
E (4 x + 3) = dx = (4 x 3 + 3x 2 )dx =8
−1
3 3 −1
Definition 4.2
Let X and Y be random variables with joint probability distribution
f(x,y). The mean or expected value of the random variable g(x,y) is
g ( x , y ) = E ( g ( x, y )) = g ( x, y ) f ( x, y )
x y
If X and Y are discrete, and
g ( x , y ) = E ( g ( x, y )) = g ( x, y) f ( x, y)dx
−−
Example 4.6
Let X and Y be the random variables with joint probability distribution
indicated in Table below. Find the expected value of g(x,y) =xy.
f(x,y) x Row Totals
0 1 2
0 3 9 3 15
Y 28 28 28 28
1 3 3 0 3
14 14 7
2 1 0 0 1
28 28
Column Totals 5 15 3 1
14 28 28
2 2
E ( xy) = xyf ( x, y ) = (0)(0) f (0,0) + (0)(1) f (0,1) + .. + (2)(0) f (2,0) +
x =0 y
.. + (1)(1) f (1,1) = 3 / 14
Example 4.7
Find E(y/x) for the density function
x(1 + 3 y 2 )
, 0 x 2, 0 y 1
f ( x, y ) = 4
0, elsewhere
ANS:
y (1 + 3 y 2 ) y + 3y3
1 2 1
5
E ( y / x) = dxdy = dy =
0 0
4 0
2 8
Tutorial
1. In a gambling game a woman is paid $3 if she draws a jack or
a queen and $5 if she draws a king or an ace from an ordinary deck
of 52 playing cards. If she draws any other card, she loses. How
much should she pay to play if the game is fair?
2. A private pilot wishes to insure his airplane for $200,000. The
insurance company estimates that a total loss may occur with
probability 0.002, a 50% loss with probability 0.01, and a 25% loss
with probability 0.1. Ignoring all other partial losses, what premium
should the insurance company charge each year to realize an
average profit of $500?
3. Suppose that X and Y have the following joint probability
function:
f(x,y) x
2 4
1 0.10 0.15
y 3 0.20 0.30
5 0.10 0.15
a. Find the expected value of g(x,y) =xy2
b. Find x and y
4. A bus company purchases several new buses at the end of
each year, the exact number depending on the frequency of repairs
in the previous year. Suppose that the number of buses, X, that are
purchased each year has the following probability distribution:
X 0 1 2 3
f(x) 1/10 3/10 2/5 1/5
If the cost of the desired model will remain fixed at $1200
throughout this year and a discount of 50X2 dollars is credited toward
any purchase, how much can this firm expect to spend on new buses
at the end of this year?
Variance and Covariance of Random Variables
Definition 4.3
Let X be a random variable with probability distribution f(x) and
mean, μ. The variance of X is
2 = E (x − )2 = (x − )2 f ( x) if X is discrete, and
x
(x − )
= E (x − ) =
2 2 2
f ( x)dx if X is continuous
−
The positive square root of the variance, σ, is called the standard
deviation of x.
Example 4.8
Let the random variable X represent the number of automobiles that
are used for official business purpose on any given workday. The
probability distribution for company A is
x 1 2 3
f(x) 0.3 0.4 0.3
and for company B is
x 0 1 2 3 4
f(x) 0.2 0.1 0.3 0.3 0.1
Show that the variance of the probability distribution for company B
is greater than that of company A.
ANS:
For company A:
= E ( x) = 1(0.3) + 2(0.4) + 3(0.3) = 2.0
3
= ( x − 2) 2 f ( x) = (1 − 2) 2 (0.3) + (2 − 2) 2 (0.4) + (3 − 2) 2 (0.3) = 0.6
2
A
x =1
For company b:
= E ( x) = 0(0.2) + 1(0.1) + 2(0.3) + 3(0.3) + 4(0.1) = 2.0
4
= ( x − 2) 2 f ( x) = (0 − 2) 2 (0.2) + (1 − 2) 2 (0.1) + (2 − 2) 2 (0.3) + (3 − 2) 2 (0.3)
2
B
x =0
+ (4 − 2) 2 (0.1) = 1.6
Theorem 4.2
The variance of a random variable X is
2 = E(x 2 ) − 2
Example 4.9
Let the random variable X represent the number of defective parts
for a motorcycle headlight when 3 parts are sampled from a
production line and tested. The following is the probability
distribution of X.
X 0 1 2 3
f(x) 0.51 0.38 0.10 0.01
ANS:
= E ( x) = 0(0.51) + 1(0.38) + 2(0.10 ) + 3(0.01) = 0.61
E ( x 2 ) = 0(0.51) + 1(0.38) + 4(0.10 ) + 9(0.01) = 0.87
2 = 0.87 − (0.61) 2 = 0.4979
Example 4.10
The weekly demand for petrol, in thousands lf liters, from a local
chain of efficiency stores, is a continuous random variable X having
the probability density
2( x − 1) 1 x 2
f ( x) =
0 elsewhere
Find the mean and variance of X
ANS:
2
5
= E ( x) = 2 x( x − 1)dx =
1
3
2
17
E ( x 2 ) = 2 x 2 ( x − 1)dx =
1
6
17 5 2 1
2 = −( ) =
6 3 18
Theorem 4.3
Let X be a random variable with probability distribution f(x). The
variance of the random variable g(X) is
g2( X ) = E (g ( X ) − g ( X ) )2 = (g ( X ) − g ( X ) )2 f ( x)
x
if X is discrete, and
(g ( X ) − )
= E (g ( X ) − g ( X ) ) =
2 2 2
g(X ) g(X ) f ( x)dx
−
if X is continuous
Example 4.11
Calculate the variance of g(X) = 2X +3, where X is a random variable
with probability distribution
X 0 1 2 3
f(x) 1/4 1/8 1/2 1/8
ANS:
3
2 X +3 = E (2 X + 3) = (2 x + 3) f ( x) = 6
x =0
22X +3 = E ((2 X + 3) − 2 x +3 )2 = E (2 X + 3 − 6) 2
3
= E (4 X − 12 X + 9) = (4 X 2 − 12 X + 9) f ( x) = 4
2
x =0
Example 4.12
Let X be a random variable with density function
x2
f ( x) = 3 , − 1 x 2
0, elsewhere
Find the variance of the random variable g(X)=4X+3
ANS:
(4 x + 3) x 2
2 2
1
E (4 x + 3) = dx = (4 x 3 + 3x 2 )dx =8
−1
3 3 −1
42X +3 = E ((4 X + 3) − 8)2 = E (4 X − 5) 2
2 2
x3 1 51
= (4 x − 5) 2
dx = (16 x 4 − 40 x 3 + 25 x 2 )dx =
−1
3 3 −1 5
Definition 4.4
Let X and Y be random variables with joint probability distribution
f(x,y). The covariance of X and Y is
XY = E( X − X )(Y − Y ) = ( x − x )( y − y ) f ( x, y )
x y
If X and Y are discrete, and
XY = E( X − X )(Y − Y ) = (x − x )( y − y ) f ( x, y )dxdy
−−
If X and Y are continuous.
Theorem 4.4
The covariance of two random variables X and Y with means μx and
μy, respectively, is given by
XY = E XY − x y
Example 4.13
Example 3.15 describes a situation involving the number of blue
refills X and the number of red refills Y. Two refills for a ballpoint pen
are selected as random from a certain box, the following is the joint
probability distribution.
f(x,y) X Row Totals
0 1 2
0 3 9 3 15
Y 28 28 28 28
1 3 3 0 3
14 14 7
2 1 0 0 1
28 28
Column Totals 5 15 3 1
14 28 28
Find the covariance of X and Y.
ANS:
2
5 15 3 3
x = xg ( x) = 0 + 1 + 2 =
x =0 14 28 28 4
2
5 3 1 1
y = yh( y) = 0 + 1 + 2 =
x =0 7 28 2
28
3 3 1 9
XY = EXY − x y = − = −
14 4 2 56
Example 4.14
The fraction X of male car racers and the fraction Y of female car
racers who compete in car racing competition are described by the
joint density function.
8 xy, 0 y x 1
f ( x, y ) =
0, elsewhere
Find the covariance of X and Y.
ANS:
We first compute the marginal density functions. They are
4x3 , 0 x 1
g ( x) =
0, elsewhere
4 y (1 − y 2 ), 0 y 1
h( y ) =
0, elsewhere
1 1
4 8
x = E ( X ) = 4 x dx =
4
and y = E (Y ) = 4 y 2 (1 − y 2 )dx =
0
5 0
15
1 1
4
E ( XY ) = 8 x 2 y 2 dxdy =
0 0
9
4 4 8
XY = EXY − x y = −
4
=
9 5 15 225
Tutorial:
1. The random variable X, representing the number of traffic
violations per 100 driving, has the following probability
distribution:
X 2 3 4 5 6
f(x) 0.01 0.25 0.4 0.3 0.04
Find the standard deviation of X.
2. The total number of hours, in units of 100 hours, that a family
riding a motorcar over a period of one year is a random
variable X having the density function
x 0 x 1
f ( x ) = 2 − x 1 x 2
0
elsewhere
Find the variance of X.
3. Let X denotes the number of times a traffic light will
malfunction: 1, 2, or 3 times on any given day. Let Y denotes
the number of times a technician is called on an emergency call.
Their joint probability distribution is given as
f(x,y) X
1 2 3
1 0.05 0.05 0.1
y 2 0.05 0.1 0.35
3 0 0.2 0.1
Find the covariance of the random variables X and Y.
4. A dealer’s profit, in units of $5000, on a new automobile is a
random variable X having the density function
2(1 − x), 0 x 1
f ( x) =
0, elsewhere
Find the variance of X.
Means and Variances of Linear Combinations of Random
Variables
Theorem 4.5
If a and b are constants, then
E (aX + b) = aE ( X ) + b
Corollary 4.1
Setting a =0, we see that
E (b ) = b
Corollary 4.2
Setting b =0, we see that
E (aX ) = aE ( X )
Example 4.15
Applying Theorem 4.5 to the discrete random variable f(X) = 2X-1,
rework Example 4.4.
ANS:
E(2X-1) = 2E(X) – 1
9
1 1 1 41
= E ( X ) = xf ( x) = 4 + 5 + .... + 9 =
x=4 12 12 6 6
41
2 X −1 = 2 − 1 = 12.67
6
Example 4.16
Applying Theorem 4.5 to the continuous random variable g(X) =
4X+3, rework Example 4.5.
ANS:
E (4 X + 3) = 4 E ( X ) + 3
2
x2 2 3
x 5
E ( X ) = x dx = dx =
−1
3 −1
3 4
5
E (4 X + 3) = 4 + 3 = 8
4
Theorem 4.6
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,
E g ( X ) h( X ) = E g ( X ) E h( X )
Example 4.17
Let X be a random variable with probability distribution as follows:
X 0 1 2 3
f(x) 1/3 1/2 0 1/6
Find the expected value of Y = (X-1)2
ANS:
( )
E ( X − 1) 2 = E X 2 − 2 X + 1 = E ( X 2 ) − 2 E ( X ) + E (1)
1 1 1
E ( X ) = (0) + (1) + (2)(0) + (3) = 1
3 2 6
1 1 1
E ( X 2 ) = (0) + (1) + (4)(0) + (9) = 2
3 2 6
E ( X − 1) 2 = 2 − (2)(1) + 1 = 1
Example 4.18
The weekly petrol demand, in thousands of liters, at a chain of petrol
stations is a continuous random variable g(X) =X2+X-2, where X and
y have the density function
2( x − 1), 1 x 2
f ( x, y ) =
0, elsewhere
Find the expected value for the weekly petrol demand.
ANS:
( )
E X 2 + X − 2 = E ( X 2 ) + E ( X ) − E (2)
E (2 ) = 2
2 2
E ( X ) = 2 x( x − 1)dx = 2 ( x 2 − x)dx =
5
1 1
3
( ) = 2x
2 2
17
E X 2 2
( x − 1)dx = 2 ( x 3 − x 2 )dx =
1 1
6
(
E X 2 + X −2 = ) 17 5
+ −2=
6 3
5
2
So that the average weekly petrol demand is 2500 liters.
Theorem 4.7
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,
E g ( X , Y ) h( X , Y ) = E g ( X , Y ) E h( X , Y )
Corollary 4.3
Setting g ( X , Y ) = g ( X ) and h( X , Y ) = h(Y ) , we see that
E g ( X ) h(Y ) = E g ( X ) E h(Y )
Corollary 4.4
Setting g ( X , Y ) = X and h( X , Y ) = Y , we see that
E X Y = E X E Y
Corollary 4.5
Let X and Y be two independent random variables. Then
XY = 0
Theorem 4.8
Let X and Y be two independent random variables. Then
E XY = E X E Y
Example 4.19
In producing air-bag microchips, it is known that the ratio between
gallium and sip is independent of producing a high percentage of
workable wafers, which are the main components of microchips. Let
X denotes the ratio of gallium to sip and Y denotes the percentage of
workable microwafers retrieved during a 1-hour period. X and Y are
independent random variables with the joint density being known as
x(1 + 3 y 2 )
, 0 x 2,0 y 1
f ( x, y ) = 4
0, elsewhere
Illustrate that E(XY) = E(X)E(Y).
ANS:
x 2 y (1 + 3 y 2 )
1 2 1 2
E ( XY ) = xyf ( x, y )dxdy = dxdy
0 0 0 0
4
x =2
x 3 y (1 + 3 y 2 ) 2 y (1 + 3 y 2 )
1 1
5
= dy = dy =
0
12 x =0 0
3 6
x 2 (1 + 3 y 2 )
1 2 1 2
E ( X ) = xf ( x, y )dxdy = dxdy
0 0 0 0
4
x=2
x 3 (1 + 3 y 2 ) 2(1 + 3 y 2 )
1 1
4
= dy = dy =
0
12 x =0 0
3 3
xy(1 + 3 y 2 )
1 2 1 2
E (Y ) = yf ( x, y )dxdy = dxdy
0 0 0 0
4
x =2
x 2 y (1 + 3 y 2 ) y (1 + 3 y 2 )
1 1
5
= dy = dy =
0
8 x =0 0
2 8
Hence
4 5 5
E ( X )E (Y ) = = = E ( XY )
3 8 6
Theorem 4.9
If a and b are constants, then
aX
2
+b = a X = a
2 2 2 2
Corollary 4.6
Setting a =1, we see that
X2 +b = X2 = 2
Corollary 4.7
Setting b =0, we see that
aX
2
= a 2 X2 = a 2 2
Theorem 4.10
If X and Y are random variables with joint probability distribution
f(x,y), then
aX
2
+ bY = a X + b Y + 2ab XY
2 2 2 2
Corollary 4.8
If X and Y are independent random variables, then
aX
2
+ bY = a X + b Y
2 2 2 2
Corollary 4.9
If X and Y are independent random variables, then
aX
2
−bY = a X + b Y
2 2 2 2
Example 4.20
If X and Y are random variables with variances X = 2 , Y = 4 , and
2 2
covariance XY = −2 , find the variance of the random variable
Z=3X-4Y+8.
ANS:
Z2 = 32X −4Y +8 = 32X −4Y = 9 X2 + 16 Y2 − 24 XY
= (9)(2) + (16)(4) − (24)(−2) = 130
Example 4.21
Let X and Y denote the amount of two different types of impurities in
a batch of a certain petrol product. Suppose that X and Y are
independent random variables with variances X2 = 2 and Y2 = 3 .
Find the variance of the random variable Z=3X-2Y+5.
Z2 = 32X −2Y +5 = 32X −2Y = 9 X2 + 4 Y2
= (9)(2) + (4)(3) = 30
Tutorial
1. Let X be a random variable with the following probability
distribution:
X -3 6 9
f(x) 1/6 1/2 1/3
Find E(X) and E(X ) and then, using these values, evaluate
2
E((2X+1) 2).
2. A motorcar company manufacturers a 100-watt lights bulb,
which, according to specifications written on the package, has a
mean life of 900 hours with a standard deviation of 50 hours.
At most, what percentage of the bulbs fails to last even 700
hours? Assume that the distribution is symmetric about the
mean.
3. If the joint density function of X and Y is given by
2
( x + 2 y ), 0 x 1,1 y 2
f ( x, y ) = 7
0, elsewhere
X
Find the expected value of g ( X , Y ) = 3 + X Y
2
Y
4. Suppose that a grocery store purchases 5 cartons of skim milk
at wholesale price of $1.20 per carton and retails the milk at
$1.65 per carton. After the expiration date, the unsold milk is
removed from the shelf and the grocer receives a credit from
the distributor equal to three-fourths of the wholesale price. If
the probability distribution of the random variable X, the
number of cartons that are sold from this lot, is
X 0 1 2 3 4 5
f(x) 1/15 2/15 2/15 3/15 4/15 3/15
Find the expected profit