You are on page 1of 35

Fakultt Informatik Institut fr Systemarchitektur Professur Rechnernetze

Functions of One Random Variable

Waltenegus Dargie
Chair for Computer Networks
Slides are based on the book book: A. A Papo Papoulis lis and S S.U. U Pillai Pillai, "Probability, random variables and stochastic processes", McGraw Hill (4th edition), 2002.

Introduction
Let X be a random variable defined on the ) and model d l (, F , P ), d suppose g(x) is i a function of the variable x. Define Y = g ( X ). Is Y necessarily a random variable? If so what is its PDF FY ( y ) ? If Y is a random variable, then for every B Borel l set t B, the th set t of f f for which hi h Y ( ) B must belong to F.
P (Y B ) = P ( X g 1 ( B )).
2

Introduction
Particularly,
FY ( y ) = P (Y ( ) y ) = P (g ( X ( )) y ) = P (X ( ) g 1 ( , y ]).

Th Thus the th distribution di t ib ti function f ti as well ll as the density function of Y can be d t determined i d in i terms t of f that th t of f X. To obtain the distribution function of Y, we must determine the Borel set on the x-axis 1 X ( ) g ( y ) for every given y, and such that the probability of that set.
3

Examples
A. Y = aX + b If a > 0 , y b y b FY ( y) = P(Y ( ) y ) = P(aX ( ) + b y ) = P X ( ) = F . X
fY ( y) =

If

C Combining bi i the th two t density d it functions f ti yields: 1 y b

fY ( y) = fX . |a| a

y b ( ) ( ) F ( y ) = P Y ( ) y = P aX ( ) + b y = P X ( ) > a < 0, Y a 1 y b y b = 1 FX , f y = fX ( ) . Y a a a

1 y b fX . a a

Examples
B. Y = X 2
FY ( y ) = P (Y ( ) y ) = P (X 2 ( ) y ).
x1
x2

Y = X2 y

For y > 0 , Hence:

{Y ( ) y } = { X 2 ( ) y } {x1 < X ( ) x 2 }

FY ( y ) = P ( x1 < X ( ) x 2 ) = F X ( x 2 ) F X ( x1 ) = FX ( y ) FX ( y ), y > 0.

By B di direct t differentiation, diff ti ti we get: t

1 f ( y ) + f X ( fY ( y ) = 2 y X 0,

y) ,

y > 0, otherwise .
5

Examples
If f X ( x) represents an even function, then th expression the i above b reduces d to t
fY ( y ) = 1 fX y

( y ) U ( y ). )

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

fX (x) =
fY ( y ) =

1 x2 /2 e , 2
1 e y / 2U ( y ). ) 2 y

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

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 ) = P ( X ( ) y + c ) = FX ( y + c ), y > 0.

Similarly y < 0 , if x < c , and Y ( )

= P ( X ( ) y c ) = FX ( y c ),

= X ( ) + c

FY ( y ) = P (Y ( ) y ) = P ( X ( ) + c y ) y < 0.
7

Examples
Subsequently,
f X ( y + c ), y > 0, f Y ( y ) = [ FX ( c ) FX ( c )] ( y ), ) y=0 f ( y c ), y < 0. X

FX ( x )

FY ( y )

Examples
D. Y = g ( X );
x, g ( x) = 0, x > 0, x 0.
Y

P (Y = 0) = P ( X ( ) 0) = FX ( 0). )

For y > 0 , Y = X ,
FY ( y ) = P(Y ( ) y ) = P( X ( ) y ) = FX ( y ).

Thus
y > 0, f X ( y ), f Y ( y ) = FX (0) ( y ) y = 0, 0, y < 0, = f X ( y )U ( y ) + FX (0) ( y ).

Continuous Random Variables

Generally, given
Y = g ( X ),

(1) Sketch the graph y = g ( x ), and determine the range space of y. For example, if a < y < b is the range space ) Then of f y = g ( x ). Th for f y < a, FY ( y) = 0, and d for f y > b, FY ( y) = 1, so that FY ( y) can be nonzero only l in i a < y < b. (2) Determine whether there are discontinuities in the range space of y. If so, evaluate e a uate P(Y ( ) = yi ) at t these ese discontinuities.

10

Continuous Random Variables

In the continuous region of y, use the b i approach basic h FY ( y ) = P (g ( X ( )) y ) and d determine appropriate events in terms of th random the d variable i bl X for f every y. (3) Compute FY ( y ) for < y < +, and obtain
fY ( y ) = dFY ( y ) dy in a < y < b .

11

Continuous Random Variables

However, if Y = g( X ) is a continuous f function, ti it i is easy t to establish t bli h a di direct t procedure to obtain fY ( y). A continues 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 | .

12

Continuous Random Variables

Consider a specific y on the y-axis and a positive iti increment i t y as shown h below. b l
g ( x)
y + y
y

x
x 1 x1 + x1
x2 + x2 x 2

x 3 x3 + x3

P {y < Y ( ) y + y } =

y + y y

f Y ( u ) du f Y ( y ) y .

13

Continuous Random Variables

But the Event {y < Y ( ) y + y } can also be expressed d in i terms t of f X ( ) . As can be seen in the figure, 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 random variable X could be in any y one of the three mutually exclusive intervals:
{x1 < X ( ) x1 + x1}, {x2 + x2 < X ( ) x2} or {x3 < X ( ) x3 + x3}.

Hence: P {y < Y ( )

y + y } = P { x 1 < X ( ) x 1 + x 1 }
14

+ P { x 2 + x 2 < X ( ) x 2 } + P { x 3 < X ( ) x 3 + x 3 } .

Continuous Random Variables

For small
y, xi ,

we get and
x3 > 0,

fY ( y ) y = f X ( x1 ) x1 + f X ( x2 ) (x2 ) + f X ( x3 ) x3 .

In this case, x1 > 0, that: As

x2 < 0

so

| xi | 1 fY ( y ) = f X ( xi ) = f X ( xi ) y i i y / xi

y 0,

fY ( y ) =
i

1 1 f X ( xi ) = f X ( xi ). dy / dx x i g ( xi )
i

15

Continuous Random Variables

If Y = X , y > 0, for Moreover, Moreover
2

x1 = y , x2 = + y

dy y dy y = 2 x so that th t =2 y dx dx x = xi

Y = X2 y

Hence:

x1

x2

1 f X ( y ) + f X ( y ) , y > 0, fY ( y ) = 2 y 0, otherwise
16

Continuous Random Variables

If
Y = 1 . X x1 = 1 / y

Here for every y, sol tion and solution,

dy 1 = 2 so that d dx x

is the only
= 1 2 = y , 2 1/ y

dy d dx

Hence:

fY ( y ) =

1 1 f . X 2 y y

x = x1

If X is a Cauchy random variable

f X ( x) =
1 / (1 / ) / fY ( y ) = 2 2 = , 2 2 2 (1 / ) + y y + (1 / y )

/ , < x < +. 2 2 +x

< y < + .
17

Continuous Random Variables

Suppose f X ( x ) = 2 x / 2 , 0 < x < , and Y = sin X . fY ( y ). D t Determine i Since X has zero probability of falling outside the interval (0, ), y = sin x has zero probability of falling outside the interval ( 0 ,1). For 0 < y < 1, the equation x1 = sin 1 y has an L, x1 , x2 , x3 ,L, i fi it number infinite b of f solutions l ti where y = sin x is the principal solution (ref. t th to the next t slide). lid ) Note ote also a so because o of the t e sy symmetry: et y x2 = x1
dy = cos x = 1 sin 2 x = 1 y 2 dx

dy dx

= 1 y2 .
x = xi

18

Continuous Random Variables

Hence, for 0 < y < 1,
fX (x)

fY ( y ) =

i = i 0

1 1 y
2

f X ( x i ).

(a)
y =s sin x

x3

x 1

x1

x2

x3

(b)

But from the figure (b), f X ( x1 ) = f X ( x3 ) = f X ( x4 ) = L = 0 (Except for f X ( x1 ) and f X ( x 2 ) the rest are all zeros).
19

Continuous Random Variables

As a result:
fY ( y ) = 1 1 y2

( f X ( x1 ) +

f X ( x2 ) ) =

2 ( x1 + x1 )

2 1 y2

2 , 2 = 1 y 0,

fY ( y )

1
20

Continuous Random Variables

Let Y = tan X Determine where
fY ( y ).
X

U ( / 2, / 2 ) .

As x moves mo es from ( / 2, / 2) , y moves mo es from ( , + ) . The function Y for /2< x < /2.
= tan X

is one-to-one

For any y, x1 = tan1 y is the principal solution. Hence,

dy d tan d t x = = sec 2 x = 1 + tan 2 x = 1 + y 2 . dx dx
21

Continuous Random Variables

Therefore:
fY ( y ) = 1 1/ f X ( x1 ) = , | dy / dx |x = x1 1 + y2 < y < + ,

f X ( x)

y = tanx
/2

fY ( y ) =

1 1 + y2

/2

/2

x1 / 2
(b)

x
(c)
22

(a)

Discrete Random Variables

Suppose X is a discrete-type random variable with P( X = x ) = p , x = x , x ,L, x ,L
i i 1 2 i

) And Y = g ( X ).

Clearly Y is also of discrete-type discrete-type, and when x = xi , yi = g ( xi ), and for all yi

P(Y = yi ) = P( X = xi ) = pi , y = y1 , y2 ,L, yi ,L

23

Suppose For
X P ( ),

so that
, k = 0,1,2,L

P( X = k ) = e

k
k!

Y = X 2 + 1,

find the PMF of Y.

As X takes the values0 ,1, 2 , L , k , L, Y 2 1, 2, 5, L , k + 1, L and takes the value P(Y = k 2 + 1) = P( X = k ) . For j = k 2 + 1
P(Y = j ) = P X =

j 1 = e

j 1

( j 1)!

, j = 1, 2,5,L, k 2 + 1,L.
24

Mean
For a random variable X, its p.d.f f X ( x) provides id complete l t information i f ti about b t it, it and for any Borel set B on the x-axis
P ( X ( ) B ) =

f X ( x ) dx .

Si Since f X ( x) represents t detailed d t il d information, i f ti it is desirable to characterize the random variable i bl i in terms t of f its it average behavior. b h i The mean and variance are often used to represent the overall properties of the random a do variable a ab e and a d its ts p.d.f. pd
25

Mean
The Mean or the Expected Value of a R d Random variable i bl X is i defined d fi d as:
X = X = E( X ) =

For a discrete X:
i

x f X ( x ) dx .

X = X = E ( X ) = x pi ( x xi ) dx = xi pi ( x xi ) dx
i

14 4244 3
1

x p =x
i i i i

P ( X = xi ) .

Mean represents the average value of the random variable in a very large number of trials.
26

Mean
(a) Mean of X ~ U (a, b)
E(X ) = x 1 x dx = ba ba 2
2 b

b2 a2 a +b = = 2(b a ) 2

E(X ) =

x /

dx = ye y dy = ,
0

(c) Mean of Poisson with parameter

E(X ) =

kP ( X = k ) =

k =0

ke

k
k!

= e

k =0

k
k!

k =1

= e

k
( k 1 )!

= e

k =1

i
i!

= e e = .
27

i=0

Mean
Mean of a binomial distribution
n n k nk n! k nk = p q k p q E ( X ) = kP ( X = k ) = k k ( n k )! k ! k =0 k =0 k =1 n n 1 ( n 1)! n! k nk p i q n i 1 = np ( p + q ) n 1 = np . = p q = np k =1 ( n k )! ( k 1)! i = 0 ( n i 1)! i! n n

Mean of a normal distribution

E(X ) = = 1 2 1 2
2

+ +

xe

( x ) 2 / 2

dx =

1 2 1
2

+ +

( y + )e
2 2

y 2 / 2

dy

y / 2 y / 2 ye dy e dy = . + 2 14 42 4 4 3 12 4 4 42 4 4 43 0
2 2

28

Mean of g(X)
Given X f X ( x ), supposeY = g ( X ) defines a new random variable with ). p.d.f fY ( y ) p Then, Y is given by:
Y = E (Y ) =

y f Y ( y ) dy .

If E (Y ) is the only quantity of interest, we dont need to first compute fY(y), since P ( y < Y y + y ) = P (xi < X xi + xi ) , since, i where xi represent the multiple solutions of y = g(xi) and y > 0 .

29

Mean of g(X)
The expression above can also be rewritten itt as,
fY ( y ) y =

where the (xi , xi + xi ) terms form nonoverlapping pp g intervals. Hence, ,

i

f X ( x i ) x i ,

y fY ( y ) y =

As y 0,

y
i

f X ( x i ) x i =

g(x ) f
i i

( x i ) x i ,

E (Y ) = E (g ( X ) ) =
E (Y ) =

y f Y ( y ) dy =

g ( x ) f X ( x ) dx .

In the discrete case,

g ( x )P ( X
i i

= x i ).
30

Mean of g(X)
Suppose Y = X2, and X is a Poisson random variable. find E(Y).
E (X
2

)= k
k =0

P(X = k) =

k
k =0

k
k!

= e

k
k =1

k
k!

= e

k ( k 1)!
k =1

= e

( i + 1)
i=0

i +1
i!

= e

i i i! + i=0

i=0

= e i!

i i i! + e i =1

i m +1 = e + e = e + e ( i 1 )! ) i =1 m =0 m! = e ( e + e ) = 2 + .

31

Variance
Mean alone will not be able to truly represent t the th p.d.f d f of f a random d variable i bl Consider two Gaussian random variables: X 1 ~ N (0,1) and X 2 N (0,10). Though g both of them have the same mean, , their p.d.fs are quite different.
f X 1 ( x1 ) f X 2 ( x2 )

x1
(a) ( ) 2 =1 (b) ( ) 2 = 10
32

x2

Variance
For a random variable X with mean , X represents t th the deviation d i ti of f the th random d variable from its mean. Since this deviation can be either positive or negative, the quantity ( X ) 2 , and its average value E [ ( X ) 2 ] represents the average mean square deviation of X around its mean. 2 2 ( ) = E [ X ] > 0 with g ( X ) = ( X ) 2 If we define
X

= ( x ) 2 f X ( x )dx > 0.
2
X

33

Variance
Expanding the expression in the previous slide results,
Var ( X ) = =
2 X +

=
2

(x
+

2 x + 2 ) f X ( x ) dx
+

x f X ( x ) dx 2
2

x f X ( x ) dx + 2
2

For example example, the variance of a Poisson random variable is given by:

2
X

= E (X

= E (X

) [E ( X ) ]

= X X .
2

___ 2

= X X

___ 2

= ( 2 + ) 2 = .
34

Variance
The variance of the normal random variable, i bl N ( , 2 ),
Var ( X ) = E [( X ) 2 ] =
2 ( ) x +

1 2
2

( x )2 / 2

dx .

+ +

f X ( x ) dx =

( x )2 / 2

2 dx = 2 .
2

( x )2 / 2

dx = 1

+
+

( x )2

( x )2 / 2

dx =
2

2
2

2 ( ) x

1 2
2

e ( x )

/ 2

d = dx

(6-22)

35