Transcript Lecture 05
5. Functions of a Random Variable
Let X be a r.v defined on the model (, F , P ), and suppose
g(x) is a function of the variable x. Define
Y g ( X ).
(5-1)
Is Y necessarily a r.v? If so what is its PDF FY ( y ), pdf fY ( y ) ?
Clearly if Y is a r.v, then for every Borel set B, the set of for
Y ( ) must
B
which
belong to F. Given that X is a r.v, this is
gis1 (also
B) a Borel set, i.e., if g(x) is a Borel
assured if
function. In that case if X is a r.v, so is Y, and for every Borel
set B
P(Y B) P( X g 1 ( B)).
(5-2)
1
In particular
FY ( y ) P(Y ( ) y ) Pg ( X ( )) y PX ( ) g 1 ( , y ]. (5-3)
Thus the distribution function as well of the density
function of Y can be determined in terms of that of X. To
obtain the distribution function of Y, we must determine the
Borel set on the x-axis such that X ( ) g 1 ( y ) for every
given y, and the probability of that set. At this point, we
shall consider some of the following functions to illustrate
the technical details.
aX b
X nis
1
X
log X
X2
Y g( X )
|X |
X
eX
| X | U ( x)
2
Example 5.1: Y aX b
Solution: Suppose a 0.
(5-4)
y b
y b
FY ( y ) P Y ( ) y PaX ( ) b y P X ( )
F
. (5-5)
X
a
a
and
1 y b
fY ( y ) f X
.
a a
(5-6)
On the other hand if a 0, then
FY ( y ) P Y ( ) y P aX ( ) b y P X ( )
y b
1 FX
,
a
and hence
fY ( y )
y b
a
(5-7)
1 y b
fX
.
a a
(5-8)
3
From (5-6) and (5-8), we obtain (for all a)
fY ( y )
1
y b
fX
.
|a | a
(5-9)
Example 5.2: Y X 2 .
(5-10)
FY ( y ) PY ( ) y PX 2 ( ) y .
(5-11)
If y 0, then the event X 2 ( ) y , and hence
FY ( y ) 0, y 0.
For y 0, from Fig. 5.1, the event
is equivalent to {x1 X ( ) x2}.
(5-12)
{Y ( ) y} { X 2 ( ) y}
Y X2
y
x1
Fig. 5.1
x2
X
4
Hence
FY ( y ) Px1 X ( ) x2 FX ( x2 ) FX ( x1 )
FX ( y ) FX ( y ),
y 0.
(5-13)
By direct differentiation, we get
1
f ( y ) f X ( y ) ,
fY ( y ) 2 y X
0,
If
f X (x)
y 0,
otherwise .
(5-14)
represents an even function, then (5-14) reduces to
fY ( y )
1
fX
y
y U ( y ).
(5-15)
In particular if X N (0,1), so that
f X ( x)
1
x2 / 2
e
,
2
(5-16)
5
and substituting this into (5-14) or (5-15), we obtain the
p.d.f of Y X 2 to be
fY ( y )
1
e y / 2U ( y ).
2y
(5-17)
On comparing this with (3-36), we notice that (5-17)
represents a Chi-square r.v with n = 1, since (1 / 2) .
Thus, if X is a Gaussian r.v with 0, then Y X 2
represents a Chi-square r.v with one degree of freedom
(n = 1).
Example 5.3: Let
X c,
Y g ( X ) 0,
X c,
X c,
c X c,
X c.
6
In this case
P(Y 0) P(c X ( ) c) FX (c) FX (c).
For y 0, we have x c, and
Y ( ) X ( ) c
FY ( y ) P Y ( ) y P( X ( ) c y )
Similarly
(5-18)
so that
P X ( ) y c FX ( y c), y 0.
y 0, if x c, and Y ( ) X ( ) c so
(5-19)
that
FY ( y ) P Y ( ) y P( X ( ) c y )
P X ( ) y c FX ( y c),
Thus
f X ( y c),
fY ( y )
f X ( y c),
g( X )
y 0,
c
y 0.
FY (x)
X
x
(a)
(5-20)
(5-21)
FX (x)
c
y 0.
(b)
Fig. 5.2
(c)
y
7
Example 5.4: Half-wave rectifier
Y g ( X );
x,
g ( x)
0,
x 0,
x 0.
(5-22)
Y
In this case
P(Y 0) P( X ( ) 0) FX (0).
X
(5-23)
Fig. 5.3
and for y 0, since Y X ,
FY ( y) PY ( ) y P X ( ) y FX ( y).
(5-24)
y 0,
f X ( y )U ( y ).
y 0,
(5-25)
Thus
f X ( y ),
fY ( y )
0,
8
Note: As a general approach, given Y g ( X ), first sketch
the graph y g ( x ), and determine the range space of y.
Suppose a y b is the range space of y g ( x ).
Then clearly for y a, FY ( y) 0, and for y b, FY ( y) 1, so
that FY ( y) can be nonzero only in a y b. Next, determine
whether there are discontinuities in the range space of y. If
so evaluate PY ( ) yi at these discontinuities. In the
continuous region of y, use the basic approach
FY ( y) Pg ( X ( )) y
and determine appropriate events in terms of the r.v X for
every y. Finally, we must have FY ( y ) for y , and
obtain
fY ( y )
dFY ( y )
in a y b.
dy
9
However, if Y g ( X ) is a continuous function, it is easy to
establish a direct procedure to obtain fY ( y). A continuos
function g(x) with g (x ) nonzero at all but a finite number
of points, has only a finite number of maxima and minima,
and it eventually becomes monotonic as | x | . Consider a
specific y on the y-axis, and a positive increment y as
shown in Fig. 5.4
g ( x)
y y
y
x1 x1 x1
x2 x2 x2
x3 x3 x3
x
Fig. 5.4
fY ( y ) for Y g ( X ), where g () is of continuous type.
10
Using (3-28) we can write
Py Y ( ) y y
y y
y
fY (u )du fY ( y ) y.
(5-26)
But the event y Y ( ) y y can be expressed in terms
of X ( ) as well. To see this, referring back to Fig. 5.4, we
notice that the equation y g (x) has three solutions x1, x2 , x3
(for the specific y chosen there). As a result
when y Y ( ) y y, the r.v X could be in any one of the
three mutually exclusive intervals
{x1 X ( ) x1 x1}, {x2 x2 X ( ) x2} or {x3 X ( ) x3 x3} .
Hence the probability of the event in (5-26) is the sum of
the probability of the above three events, i.e.,
Py Y ( ) y y P{x1 X ( ) x1 x1}
P{x2 x2 X ( ) x2 } P{x3 X ( ) x3 x3} .(5-27) 11
For small y, xi , making use of the approximation in (5-26),
we get
fY ( y )y f X ( x1 )x1 f X ( x2 )( x2 ) f X ( x3 )x3.
(5-28)
In this case, x1 0, x2 0 and x3 0, so that (5-28) can be
rewritten as
fY ( y ) f X ( xi )
i
| xi |
1
f X ( xi )
y
i y / xi
(5-29)
and as y 0, (5-29) can be expressed as
fY ( y )
i
1
1
f X ( xi )
f X ( xi ).
dy / dx x
i g ( xi )
(5-30)
i
The summation index i in (5-30) depends on y, and for every
y the equation y g ( xi ) must be solved to obtain the total
number of solutions at every y, and the actual solutions x1, x2 ,
12
all in terms of y.
For example, if Y X 2 , then for all y 0, x1 y and x2 y
represent the two solutions for each y. Notice that the
solutions xi are all in terms of y so that the right side of (5-30)
2
Y
X
is only a function of y. Referring back to the example
(Example 5.2) here for each y 0, there are two solutions
given by x1 y and x2 y . ( fY ( y ) 0 for y 0 ).
YX
Moreover
2
dy
2 x so that
dx
dy
dx
y
2 y
x xi
and using (5-30) we get
x1
Fig. 5.5
1
f X ( y ) f X ( y ) ,
y 0,
fY ( y ) 2 y
0,
otherwise ,
which agrees with (5-14).
X
x2
(5-31)
13
Example 5.5:
1
Y .
X
(5-32)
Find fY ( y).
Solution: Here for every y,
dy
1
2 so that
dx
x
x1 1 / y
dy
dx
is the only solution, and
x x1
1
2
y
,
2
1/ y
and substituting this into (5-30), we obtain
fY ( y )
1
1
f
.
X
2
y
y
(5-33)
In particular, suppose X is a Cauchy r.v as in (3-38) with
parameter so that
f X ( x)
/
, x .
2
2
x
(5-34)
In that case from (5-33), Y 1/ X has the p.d.f
fY ( y )
1
/
(1 / ) /
,
2
2
2
2
2
y (1 / y )
(1 / ) y
y .
(5-35)
14
But (5-35) represents the p.d.f of a Cauchy r.v with
parameter 1/ . Thus if X C ( ), then 1 / X C (1 / ).
Example 5.6: Suppose f X ( x) 2 x / 2 , 0 x , and Y sin X .
Determine fY ( y).
Solution: Since X has zero probability of falling outside the
interval (0, ), y sin x has zero probability of falling outside
the interval (0,1). Clearly fY ( y ) 0 outside this interval. For
any 0 y 1, from Fig.5.6(b), the equation y sin x has an
infinite number of solutions , x1, x2 , x3 ,, where x1 sin 1 y
is the principal solution. Moreover, using the symmetry we
also get x2 x1 etc. Further,
dy
cos x 1 sin 2 x 1 y 2
dx
so that
dy
dx
1 y2 .
x xi
15
f X ( x)
x3
(a)
x
y sin x
y
x1
x1
x2
x3
x
(b)
Fig. 5.6
Using this in (5-30), we obtain for 0 y 1,
fY ( y )
i
1
1 y
2
f X ( xi ).
(5-36)
But from Fig. 5.6(a), in this case f X ( x1 ) f X ( x3 ) f X ( x4 ) 0
(Except for f X ( x1 ) and f X ( x2 ) the rest are all zeros).
16
Thus (Fig. 5.7)
fY ( y )
1
1 y2
f X ( x1 )
2( x1 x1 )
2
1 y
2
f X ( x2 )
2
,
1 y 2
0,
fY ( y )
2 x1 2 x2
2 2
2
1 y
1
2
0 y 1,
otherwise.
(5-37)
y
1
Fig. 5.7
Example 5.7: Let Y tan X where X U / 2, / 2 .
Determine fY ( y).
Solution: As x moves from / 2, / 2 , y moves from , .
From Fig.5.8(b), the function Y tan X is one-to-one
for / 2 x / 2 . For any y, x1 tan 1 y is the principal
solution. Further
dy d tan x
sec 2 x 1 tan 2 x 1 y 2
dx dx
17
so that using (5-30)
fY ( y )
1
1/
f X ( x1 )
,
2
| dy / dx |x x1
1 y
y ,
(5-38)
which represents a Cauchy density function with parameter
equal to unity (Fig. 5.9).
f X (x )
/ 2
/2
x
fY ( y )
1
1 y2
(a)
y tan x
/ 2
y
y
x1 / 2
(b)
Fig. 5.8
x
Fig. 5.9
18
Functions of a discrete-type r.v
Suppose X is a discrete-type r.v with
P( X xi ) pi , x x1, x2 ,, xi ,
(5-39)
and Y g ( X ). Clearly Y is also of discrete-type, and
when x xi , yi g ( xi ), and for those yi
P(Y yi ) P( X xi ) pi , y y1, y2 ,, yi ,
(5-40)
Example 5.8: Suppose X P( ), so that
P( X k ) e
k
k!
, k 0,1,2,
(5-41)
Define Y X 2 1. Find the p.m.f of Y.
Solution: X takes the values 0,1,2,, k , so that Y only
takes the value 1,3,, k 2 1, and
19
P(Y k 2 1) P( X k )
so that for j k 2 1
j 1
P(Y j ) P X j 1 e
, j 1,3,, k 2 1,. (5-42)
( j 1)!
20