You are on page 1of 20

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 cdf FY ( y ), and pdf fY ( y ) ?


Clearly if Y is a r.v, then for every Borel set B, the set of
for which Y ( ) B must belong to F. Given that X is a r.v,
this is assured if g 1 ( B ) is also a Borel set, i.e., if g(x) is a
Borel 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 ) = P (g ( X ( )) y ) = P (X ( ) 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
sin X X2

1/X Y = g( X ) |X |

X
log X
eX | X | U ( x)
2
Example 5.1: Y = aX + b (5-4)
Solution: Suppose a > 0 .
y b y b
FY ( y) = P(Y ( ) y ) = P(aX ( ) + b y ) = P X ( ) = FX . (5-5)
a a
and
1 y b
fY ( y) = f X . (5-6)
a a

On the other hand if a < 0 , then


y b
FY ( y ) = P(Y ( ) y ) = P(aX ( ) + b y ) = P X ( ) >
a
y b
= 1 FX , (5-7)
a
and hence
1 y b
fY ( y) = fX .
a a (5-8)
3
From (5-6) and (5-8), we obtain (for all a)
1 y b
fY ( y) = fX . (5-9)
|a| a
Example 5.2: Y = X 2 . (5-10)

FY ( y ) = P (Y ( ) y ) = P (X 2 ( ) y ). (5-11)

If y < 0 , then the event { X 2 ( ) y}= , and hence


FY ( y ) = 0, y < 0. (5-12)

For y > 0 , from Fig. 5.1, the event {Y ( ) y } = { X 2 ( ) y }


is equivalent to { x1 < X ( ) x 2 }.
Y = X2
y

X
x1 x2
Fig. 5.1
4
Hence
FY ( y ) = P ( x1 < X ( ) x 2 ) = F X ( x 2 ) F X ( x1 )
= FX ( y ) FX ( y ), y > 0. (5-13)

By direct differentiation, we get


1

fY ( y ) = 2 y
(
f X ( y ) + f X ( y) , ) y > 0,
(5-14)
0, otherwise .

If f X (x) represents an even function, then (5-14) reduces to


fY ( y ) =
1
y
fX ( y ) U ( y ). (5-15)

In particular if X N ( 0 ,1), so that


1 x2 /2
fX (x) = e , (5-16)
2
5
and substituting this into (5-14) or (5-15), we obtain the
p.d.f of Y = X 2 to be
1 (5-17)
fY ( y ) = e y / 2U ( y ).
2 y

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, X > c,

Y = g ( X ) = 0, c < X c,
X + c, X c.

6
In this case
P (Y = 0) = P ( c < X ( ) c ) = FX ( c ) FX ( c ). (5-18)
For y > 0 , we have x > c , and Y ( ) = X ( ) c so that
FY ( y ) = P (Y ( ) y ) = P ( X ( ) c y )
= P ( X ( ) y + c ) = FX ( y + c ), y > 0 . (5-19)
Similarly y < 0 , if x < c , and Y ( ) = X ( ) + c so that
FY ( y ) = P (Y ( ) y ) = P ( X ( ) + c y )
= P ( X ( ) y c ) = FX ( y c ), y < 0. (5-20)
Thus
f X ( y + c ), y > 0,

f Y ( y ) = [ FX ( c ) FX ( c )] ( y ), (5-21)
f ( y c ), y < 0.
X
g( X ) FX (x ) FY ( y )
c
c X
x y
(a) (b) (c)
Fig. 5.2 7
Example 5.4: Half-wave rectifier
x, x > 0,
Y = g ( X ); g ( x) = (5-22)
0, x 0. Y

In this case
X
P (Y = 0) = P ( X ( ) 0) = FX ( 0). (5-23)
Fig. 5.3
and for y > 0 , since Y = X ,
FY ( y ) = P (Y ( ) y ) = P( X ( ) y ) = FX ( y ). (5-24)

Thus
f X ( y ), y > 0,

f Y ( y ) = FX (0) ( y ) y = 0, = f X ( y )U ( y ) + FX (0) ( y ). (5-25)
y < 0,
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 P(Y ( ) = yi ) at these discontinuities. In the
continuous region of y, use the basic approach
FY ( y ) = P (g ( 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
dFY ( y )
fY ( 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

x
x 1 x1 + x1 x 3 x3 + x3
x2 + x2 x 2
Fig. 5.4

fY (y) for Y = g(X ), where g () is of continuous type.


10
Using (3-28) we can write
y + y
P {y < Y ( ) y + y } = f Y ( u ) du f Y ( y ) y . (5-26)
y

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.,
P {y < Y ( ) y + y } = P { x1 < X ( ) x1 + x1 }
+ P { x 2 + x 2 < X ( ) x 2 } + P { x 3 < X ( ) x 3 + x 3 } .(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
| xi | 1
fY ( y ) = f X ( xi ) = f X ( xi ) (5-29)
i y i y / xi

and as y 0, (5-29) can be expressed as


1 1
fY ( y ) = f X ( xi ) = f X ( xi ). (5-30)
i dy / dx x i g ( xi )
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 ,"
all in terms of y.
12
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)
is only a function of y. Referring back to the example Y = X 2

(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 ).
Moreover Y=X 2

dy dy y
= 2 x so that =2 y
dx dx x = xi
X
and using (5-30) we get x1 x2
Fig. 5.5
1
(
fY ( y ) = 2 y
)
f X ( y ) + f X ( y ) , y > 0,
(5-31)
0, otherwise ,

which agrees with (5-14).


13
1 (5-32)
Example 5.5: Y = . Find fY ( y).
X
Solution: Here for every y, x1 = 1 / y is the only solution, and
dy 1 dy 1
= 2 so that = 2
= y 2
,
dx x dx x = x1 1/ y
and substituting this into (5-30), we obtain
1 1
X .
fY ( y ) = f (5-33)
2
y y
In particular, suppose X is a Cauchy r.v as in (3-39) with
parameter so that
/
f X ( x) = , < x < +. (5-34)
+x
2 2

In that case from (5-33), Y = 1 / X has the p.d.f


1 / (1 / ) /
fY ( y ) = = , < y < + . (5-35)
y + (1 / y )
2 2 2
(1 / ) + y
2 2

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
= 1 y2 .
dx x = xi 15
fX (x)

x3
x
(a)
y = sin x

x
x 1 x1 x2 x3

(b)
Fig. 5.6

Using this in (5-30), we obtain for 0 < y < 1,


+
1
fY ( y ) = f X ( x i ).
(5-36)
i = 1 y 2
i 0
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 ( x 2 ) the rest are all zeros).
16
Thus (Fig. 5.7)
fY ( y )
1 1 2 x1 2 x 2
fY ( y ) = ( f X ( x1 ) + f X ( x2 ) ) = 2 + 2
1 y 2
1 y
2
2 2
2 ( x1 + x1 ) , 0 < y < 1,
= = 1 y 2
y
2 1 y2
(5-37)
0, otherwise. 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 = tan1 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)
1 1/
fY ( y ) = f X ( x1 ) = , < y < + , (5-38)
| dy / dx |x = x1 1+ y 2

which represents a Cauchy density function with parameter


equal to unity (Fig. 5.9).
f X (x )

x 1
/2 /2 fY ( y ) =
1 + y2
(a)
y = tan x
y
y
/2 Fig. 5.9
x1 / 2 x

(b)
Fig. 5.8
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


k
P ( X = k ) = e , k = 0,1,2," (5-41)
k!
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, 2, 5, " , 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)!
, j = 1, 2,5,", k 2 + 1,". (5-42)

20

You might also like