Sie sind auf Seite 1von 38

4.

Mathematical Expectation
Example:
A certain software company uses a certain software to check for
errors on any of the programs it builds and then discrads the
software if the errors found exceed a certain number. Given that
the number of errors found is represented by a random variable X
whose density function is given by:
Find the average number of errors the company expects to find in
a given program?

< <
+
=
elsewhere
x
x
x f
,
,
) (
) (
0
4 0
5
2 2
4. Mathematical Expectation
The random variable X is given as a continuous random
variable, thus its expected value can be found as follows:
}


= dx x xf x E ) ( ) (
}
+
=
4
0 5
2 2
dx
x
x x E
) (
) (
The company should expect to find approximately 14.93
errors
( )
} + =
4
0
2
2
5
2
dx x x x E ) (
0 4
3
4
5
2
2
3

|
|
.
|

\
|
+ = ) ( x E
15
224
3
112
5
2
=
|
.
|

\
|
= ) ( x E
4. Mathematical Expectation
4. Mathematical Expectation
Functions of a random variable
In some cases, an event is represented by a function of the
random variable which we refer to as g(X). To find the
expected value of this event, we substitute the function for
the variable in the expectation formulae.
4. Mathematical Expectation
Functions of a random variable
For a discrete variable X:
For a continuous random variable X:
=
x
x f x g X g E ) ( ) ( )] ( [
}


= dx x f x g X g E ) ( ) ( )] ( [
4. Mathematical Expectation
Functions of a random variable
Example:
X is a random variable given by the following probability
distribution:
Given that g(X)=(x
2
+2), find E[g(X)]?
x -3 6 9
f(x) 1/6 1/2 1/3
4. Mathematical Expectation
Functions of a random variable
=
x
x f x g X g E ) ( ) ( )] ( [
+ =
x
x f x X g E ) ( ) ( )] ( [ 2
2
( ) ( ) ( )
3
1
2 9
2
1
2 6
6
1
2 3
2 2 2
+ + + + + = )] ( [ X g E
5 48
3
83
2
38
6
11
. )] ( [ = + + = X g E
4. Mathematical Expectation
Functions of a random variable
Example:
Given that X is a continuous random variable whose PDF is
given by:
Find E[g(X)] given that g(X)=3x
2
?

< < +
=

elsewhere
x x x
x f
,
,
) (
0
1 0 5 3
2
4. Mathematical Expectation
Functions of a random variable
For a continuous random varaiable, the expected value of an
arbitrary function of the random varaiable g(X) is given by:


= dx x f x g X g E ) ( ) ( )] ( [
( )
} + =

1
0
2 2
5 3 3 dx x x x X g E )] ( [
} + =
1
0
3
15 9 dx x X g E )] ( [
1
0
4
4
15
9
(

+ =
x
x
4
51
4
0
0 9
4
15
9 =
|
.
|

\
|
+
|
.
|

\
|
+ = ) (
4. Mathematical Expectation
Expected value of joint random variables
For a pair of random variables X and Y with a joint
probability distribution f(x,y), the expected value can be
found by use of an arbitrary function of the random variables
g(X,Y) such that:
For a discrete pair of random variables X and Y
( ) | | =
x y
y x f y x g Y X g E ) , ( ) , ( ,
4. Mathematical Expectation
Expected value of joint random variables
For a contiuous set of random variable sX and Y
( ) | |
} }


= dxdy y x f y x g Y X g E ) , ( ) , ( ,
Example:
Given a pair of discrete random variables X and Y whose joint
probability distribution function is given by the table below;
Find the expected value of the function g(X,Y) given that
g(X,Y)=2X+Y
f(x,y) X=2 X=4
Y=1 0.10 0.15
Y=2 0.20 0.30
Y=3 0.10 0.15
4. Mathematical Expectation
4. Mathematical Expectation
+ =
x y
y x f y x ) , ( ) ( Y)] E[g(X, 2
=
x y
y x f y x g ) , ( ) , ( Y)] E[g(X,
6 9 15 0 3 4 2 10 0 3 2 2 30 0 2 4 2
20 0 2 2 2 15 0 1 4 2 10 0 1 2 2
. . ) ) ( ( . ) ) ( ( . ) ) ( (
. ) ) ( ( . ) ) ( ( . ) ) ( (
= + + + + +
+ + + + + + =
4. Mathematical Expectation
Example:
Let X and Y be the random variables with joint probability
distribution given by
x Row
Totals
f(x,y) 0 1 2
y
0 3/28 9/28 3/28 15/28
1 3/14 3/14 3/7
2 1/28 1/28
ColumnTotals 5/14 15/28 3/28 1
Find the expected value of g(X,Y)=XY
4. Mathematical Expectation
4. Mathematical Expectation
=(0)(0)f(0,0)+(0)(1)f(0,1)+(0)(2)f(0,2)+
(1)(0)f(1,0)+(1)(1)f(1,1)+
(2)(0)f(2,0)
=f(1,1)=3/14


= =
=
2
0
2
0 x y
y x xyf ) , ( E(XY)
Find the expected value of g(X,Y)=Y/X for the density
function
4. Mathematical Expectation

< < < <


+
=
elsewhere
y x
y x
y x f
,
, ,
) (
) , (
0
1 0 2 0
4
3 1
2
4. Mathematical Expectation
} }
+
=
|
.
|

\
|
1
0
2
0
2
4
3 1
dxdy
y x
x
y
X
Y
E
) (
} }
+
=
|
.
|

\
|
1
0
2
0
2
4
3 1
dxdy
y y
Y
X
E
) (
} }
+
=
(

(
+
=
|
.
|

\
|
1
0
2
1
0
2
0
2
2
4
3 1
4
3 1
dy
y y
dy x
y y
Y
X
E
) ( ) (
8
5
4 2
3
4 2
3
1
0
4 2
1
0
3
=
(

(
+ =
+
= }
y y
dy
y y
Variance and Covariance
Mean or expected value of a random variable is important
because it describes where the probability distribution is
centered.
However, mean does not give adequate distribution of the
shape of the distribution
Variability of the distribution needs to be characterized
Let X be a random variable with probability distribution f(x)
and mean . The variance of X is
If X is discrete
Variance and Covariance
( ) ( ) = =
x
x f x X E ) (
2 2
2
o
If X is continuous
Standard deviation of X is equal to the square root of the
variance =
Variance and Covariance
( ) ( ) dx x f x X E ) (
2
2
2
}


= = o
Let the random variable X represent the number of cars that
are used for official business purpose on any given workday.
The probability distribution for company A is given by:
And for company B by
Variance and Covariance
x 1 2 3
f(x) 0.3 0.4 0.3
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 for company A?
Variance and Covariance
For company A:
And then
Variance and Covariance
2 3 0 3 4 0 2 3 0 1 = + + = = ) . )( ( ) . )( ( ) . )( ( ) (X E

=
=
3
1
2 2
2
x
x f x ) ( ) ( o
6 0 3 0 2 3 4 0 2 2 3 0 2 1
2 2 2 2
. ) . ( ) ( ) . ( ) ( ) . ( ) ( = + + = o
For company B:
And then
Variance and Covariance
2 1 0 4 3 0 3 3 0 2 1 0 1 2 0 0 = + + + + = = ) . )( ( ) . )( ( ) . )( ( ) . )( ( ) . )( ( ) (X E

=
=
4
0
2 2
2
x
x f x ) ( ) ( o
6 1 1 0 2 4 3 0 2 3 3 0 2 2 1 0 2 1 2 0 2 0
2 2 2 2 2 2
. ) . ( ) ( ) . ( ) ( ) . ( ) ( ) . ( ) ( ) . ( ) ( = + + + + = o
To simplify the calculations of
2
, we can use:

2
= E(X
2
)-
2
PROOF
For the discrete case we can write:
Since by definition, and for any discrete
probability distribution, it follows that :
Variance and Covariance
+ = =
x x
x f x x x f x ) ( ) ( ) ( ) (
2 2 2 2
2 o
+ =
x x x
x f x xf x f x ) ( ) ( ) (
2 2
2
=
x
x xf ) (
=
x
x f 1 ) (
Variance and Covariance
2 2 2
o = ) ( x f x
x
2 2
= ) ( X E
HW: Prove for the continuous case?
2 2 2
2 o + = ) ( ) ( x f x
x
Example:
For the following probability distribution:
Calculate
2
Variance and Covariance
x 0 1 2 3
f(x) 0.51 0.38 0.10 0.01
=(0)(0.51)+(1)(0.38)+(2)(0.10)+(3)(0.01)=0.61
Now,
E(X
2
)=(0)
2
(0.51)+(1)
2
(0.38)+(2)
2
(0.10)+(3)
2
(0.01)
=(0)(0.51)+(1)(0.38)+(4)(0.10)+(9)(0.01)=0.87
Therefore;

2
= 0.87-(0.61)
2
=0.4979
Variance and Covariance
2 2 2
o = ) ( X E
) ( ) ( x f x X E
x
=
2 2
Example:
The weekly demand for Pepsi, in thousands of liters, from a
local chain of efficiency stores, is a continuous random
variable X having the probability density
Find the mean and variance of X
Variance and Covariance

< <
elsewhere
x x
,
), (
0
2 1 1 2
Variance and Covariance
And
Therefore,

3
5
2 3
2 2 1 2
2
1
2 3
2
1
2
2
1
=
|
|
.
|

\
|
= = = = } }
x x
dx x x dx x x X E ) ( ) ( ) (
6
17
3
3
4
2 2 1 2
2
1
4
2
1
2 3
2
1
2 2
=
|
|
.
|

\
|
= = = } }
x x
dx x x dx x x X E ) ( ) ( ) (
18
1
3
5
6
17
2
2
=
|
.
|

\
|
= o
Let X be a random variable with probability distribution f(x).
The variance of the random variable g(X) is:
If X is discrete:
If X is continuous:
Variance and Covariance
| | | | = =
x
X g X g
X g
x f X g X g E ) ( ) ( ) (
) ( ) (
) (
2 2 2
o
| | | |
}


= = dx x f X g X g E
X g X g
X g
) ( ) ( ) (
) ( ) (
) (
2 2 2
o
PROOF
It is known that for a discrete random variable X,
Now for a discrete random variable X with function g(X),
Variance and Covariance
| | = =
x
x f x X E ) ( ) ( ) (
2 2 2
o
| | = =
x
x g X g
x f x g X g E ) ( ) ) ( ( ) ) ( (
) ( ) (
2 2 2
o
Example:
Calculate the variance of g(X)=2X+3, where X is a random
variable with probability distribution
Variance and Covariance
x 0 1 2 3
f(x) 1/4 1/8 1/2 1/8
Let us find the mean for the random variable 2X+3.
Variance and Covariance

=
+
+ = + =
3
0
3 2
3 2 3 2
x
X
x f x X E ) ( ) ( ) (
6
8
1
3 3 2
2
1
3 2 2
8
1
3 1 2
4
1
3 0 2 = + + + + + + + * ) ) ( ( * ) ) ( ( * ) ) ( ( * ) ) ( (
Now,
Variance and Covariance
2
3 2
3 2
2
3 2
+
+
+ =
X
X
X E o
| |
2
3 2
2
6 3 2 + =
+
X E
X
o
( ) 9 12 4
2
3 2
2
+ =
+
X X E
X
o
( )
=
+
= + =
3
0
2
3 2
2
4 9 12 4
x
X
x f X X ) ( o
Example:
Let X be a random variable with the following density
function:
Find the variance of the random variable g(X)=4X+3
Variance and Covariance

< <
=
elsewhere
x
x
x f
,
,
) (
0
2 1
3
2
Variance and Covariance
Now,

+
= +
2
1
2
3
3 4
3 4 dx
x x
X E
) (
) (
8 3 4
3
1
3 4
2
1
2 3
= + = + }

dx x x X E ) ( ) (
( ) | |
2
3 4
2
8 3 4 + =
+
X E
X
o
( )
2
3 4
2
5 4 =
+
X E
X
o
}

+
= =
2
1
2
2
3 4
2
5
51
3
5 4 dx
x
x
X
) ( o

Das könnte Ihnen auch gefallen