PROBABILITY AND STATISTICS FOR ENGINEERING Two Functions of Two Random Variables Hossein Sameti Department of Computer Engineering Sharif University of Technology Two Functions of Two RV.s X and Y are two random variables with joint p.d.f f XY ( x, y ). h ( x, y ), and g ( x , y ) are functions define the new random variables: Z g ( X ,Y ) W h ( X , Y ). How to determine the joint p.d.f f ZW ( z, w) ? with f ZW ( z, w) in hand, the marginal p.d.fs f Z (z) and fW (w) can be easily determined. Two Functions of Two RV.s For given z and w, FZW ( z, w) P Z ( ) z ,W ( ) w P g ( X , Y ) z , h( X , Y ) w P ( X , Y ) Dz ,w ( x , y )Dz , w f XY ( x, y )dxdy, g ( x, y ) z where D z ,w is the region in the xy plane such that : h( x, y ) w y Dz ,w Dz ,w x Example X and Y are independent uniformly distributed rv.s in (0, ). Define Z min( X , Y ), W max( X , Y ). Determine f ZW ( z, w). Solution Obviously both w and z vary in the interval ( 0, ). Thus FZW ( z, w) 0, if z 0 or w 0. FZW ( z, w) PZ z,W w Pmin( X , Y ) z, max( X , Y ) w . two cases: Dz ,w Y Y ( w, w) ( z, z ) ( z, z ) yw ( w, w) X (a ) w z X ( b) w z Example - continued For w z, FZW ( z, w) FXY ( z, w) FXY ( w, z ) FXY ( z, z ) , w z, Y For w z, ( w, w) FZW ( z, w) FXY ( w, w) , With w z. yw ( z, z ) X FXY ( x, y ) FX ( x ) FY ( y ) we obtain (2 w z ) z / 2 , FZW ( z, w) w2 / 2 , x y xy 2, 0 z w , 0 w z . Thus (a ) w z Y ( z, z ) ( w, w) 2 / 2 , f ZW ( z, w) 0, 0 z w , otherwise . X ( b) w z Example - continued Also, f Z ( z ) f ZW ( z, w)dw z and fW ( w) w 0 2 z 1 , 0 z , f ZW ( z, w)dz 2w 2 , 0 w . g ( x , y ) and h( x, y ) are continuous and differentiable functions, So, it is possible to develop a formula to obtain the joint p.d.f f ZW ( z, w) directly. Let’s consider: g ( x, y ) z, h( x, y ) w. Let us say these are the solutions to the above equations: ( x1, y1 ), ( x2 , y2 ), , ( xn , yn ), g ( xi , yi ) z, h( xi , yi ) w. w y w w ( z , w) ( x1, y1 ) z z z (a) ( x2 , y2 ) w 2 1 ( xi , yi ) z n ( xn , yn ) (b) i x Consider the problem of evaluating the probability P z Z z z, w W w w P z g ( X , Y ) z z, w h( X , Y ) w w . This can be rewritten as: Pz Z z z, w W w w f ZW ( z, w)zw. To translate this probability in terms of f XY ( x, y ), we need to evaluate the equivalent region for z w in the xy plane. The point A with coordinates (z,w) gets mapped onto the point A with coordinates ( xi , yi ) As z changes to z z to point B in figure (a), - let B represent its image in the xy plane. As w changes to w w to C, - let C represent its image in the xy plane. y w C w D w A z yi B z z (a) D C A xi (b) B i x i . Finally D goes to D, ABCD represents the equivalent parallelogram in the XY plane with area i . The desired probability can be alternatively expressed as P( X ,Y ) f i i XY ( xi , yi )i . i Equating these, we obtain f ZW ( z, w) f XY ( xi , yi ) i i . zw To simplify this, we need to evaluate the area i of the parallelograms in terms of zw. let g1 and h1 denote the inverse transformations, so that xi g1 ( z, w), yi h1 ( z, w). As the point (z,w) goes to ( xi , yi ) A, - the point ( z z, w) B, - the point ( z, w w) C , - the point ( z z, w w) D. Hence x and y of B are given by: g1 g z xi 1 z, z z h h h1 ( z z, w) h1 ( z, w) 1 z yi 1 z. z z g1 ( z z, w) g1 ( z, w) Similarly, those of C are given by: xi g1 w, w yi h1 w. w The area of the parallelogram ABCD is given by i AB AC sin( ) AB cos AC sin AB sin AC cos . From the figure and these equations, g1 h z, AC sin 1 w, z w h g AB sin 1 z, AC cos 1 w. z w AB cos so that or g h g h i 1 1 1 1 zw z w w z g1 i z g h1 g1 h1 1 det zw z w w z h1 z g1 w h1 w J ( z , w) This is the Jacobian of the transformation xi g1 ( z, w), g1 z J ( z , w) det h 1 z Using these in f ZW ( z, w) f XY ( xi , yi ) i g1 w . h1 w i . , and zw f ZW ( z, w) | J ( z, w) | f XY ( xi , yi ) i yi h1 ( z, w). i | J ( z , w) | 1 we get | J ( xi , yi ) | 1 f XY ( xi , yi ), | J ( xi , yi ) | ( ) * where J ( xi , yi ) represents the Jacobian of the original transformation: g x J ( xi , yi ) det h x g y h y x x i . , y yi Example Example 9.2: Suppose X and Y are zero mean independent Gaussian r.vs with common variance 2 . where | w | / 2. Define Z X 2 Y 2 , W tan 1 (Y / X ), Obtain f ZW ( z, w). Solution Here Since f XY ( x, y ) 1 2 ( x e 2 2 y 2 ) / 2 2 . z g ( x, y ) x 2 y 2 ; w h( x, y ) tan 1 ( y / x ), | w | / 2, if ( x1, y1 ) is a solution pair so is ( x1, y1 ). Thus y tan w, or x y x tan w. Example - continued Substituting this into z, we get z x 2 y 2 x 1 tan 2 w x sec w, or x z cos w. and y x tan w z sin w. Thus there are two solution sets x1 z cos w, y1 z sin w, x2 z cos w, y2 z sin w. J ( z, w) is : so that J ( z , w) x z y z | J ( z, w) | z. x w y w cos w z sin w sin w z cos w z, Example - continued Also J ( x, y ) is x J ( x, y ) y x2 y2 x2 y2 y x2 y2 x x2 y2 1 x2 y2 1 . z Notice that here also | J ( z, w) | 1 / | J ( xi , yi ) |, Using ( ), * f ZW ( z, w) z f XY ( x1 , y1 ) f XY ( x2 , y2 ) Thus fZ ( z) /2 / 2 z z e 2 2 / 2 2 f ZW ( z, w)dw 0 z , | w | , z 2 ez 2 / 2 2 , 2 . 0 z , 2 which represents a Rayleigh r.v with parameter , Example - continued Also, 1 0 fW ( w) f ZW ( z, w)dz , | w | 2 , which represents a uniform r.v in ( / 2, / 2). Moreover, f ZW ( z, w) f Z ( z ) fW ( w) So Z and W are independent. To summarize, If X and Y are zero mean independent Gaussian random variables with common variance, then - X 2 Y 2 has a Rayleigh distribution - tan 1 (Y / X ) has a uniform distribution. - These two derived r.vs are statistically independent. Example - continued Alternatively, with X and Y as independent zero mean Gaussian r.vs with common variance, X + jY represents a complex Gaussian r.v. But X jY Ze jW , where Z and W are as in z g ( x, y ) x 2 y 2 ; w h( x, y ) tan 1 ( y / x), | w | / 2, except that for the abovementioned, to hold good on the entire complex plane we must have W , The magnitude and phase of a complex Gaussian r.v are independent with Rayleigh and uniform distributions U ~ ( , ) respectively. Example Let X and Y be independent exponential random variables with common parameter . Define U = X + Y, V = X - Y. Find the joint and marginal p.d.f of U and V. Solution It is given that f XY ( x, y ) 1 ( x y ) / e , x 0, 2 y 0. Now since u = x + y, v = x - y, always | v | u,and there is only one solution given by uv uv x 2 , y 2 . Example - continued Moreover the Jacobian of the transformation is given by 1 1 J ( x, y ) 2 1 1 and hence 1 fUV (u, v ) 2 e u / , 0 | v | u , 2 represents the joint p.d.f of U and V. This gives fU (u ) and fV ( v ) u u |v| 1 fUV (u, v )dv 2 2 fUV (u, v )du 1 2 2 u e u / dv u |v| u u / e , 0 u , 2 e u / du 1 |v|/ e , v . 2 Notice that in this case the r.vs U and V are not independent. As we will show, the general transformation formula in (*) making use of two functions can be made useful even when only one function is specified. Auxiliary Variables Suppose Z g ( X , Y ), X and Y : two random variables. To determine f Z (z ) by making use of the above formulation in ( ), we * can define an auxiliary variable W X or W Y and the p.d.f of Z can be obtained from f ZW ( z, w) by proper integration. Example Z = X + Y Let W = Y so that the transformation is one-to-one and the solution is given by y1 w, x1 z w. The Jacobian of the transformation is given by J ( x, y ) and hence or 1 0 1 1 1 f ZW ( x, y ) f XY ( x1, y1 ) f XY ( z w, w) f Z ( z ) f ZW ( z, w)dw f XY ( z w, w)dw, This reduces to the convolution of f X (z ) and fY (z ) if X and Y are independent random variables. Example Let X U (0,1) and Y Define Z 2 ln X 1/ 2 U (0,1) be independent. cos( 2Y ). Find the density function of Z. Solution Making use of the auxiliary variable W = Y, x1 e z sec( 2w ) 2 / 2 , y1 w, J ( z , w) x1 z x1 w y1 z y1 w z sec 2 ( 2w) e z sec( 2w ) z sec 2 ( 2w)e z sec( 2w ) 0 2 /2 . 2 /2 x1 w 1 Example - continued Using these in ( ), we obtain * f ZW ( z , w) z sec (2 w) e 2 z , z sec( 2 w ) 2 /2 , 0 w 1, and 1 f Z ( z ) f ZW ( z, w)dw e 0 z2 / 2 1 0 z sec (2 w) e 2 z tan(2 w ) / 2 Let u z tan(2 w) so that du 2 z sec2 (2 w)dw. Notice that as w varies from 0 to 1, u varies from to . 2 dw. Example - continued Using this in the previous formula, we get f Z ( z) 2 2 1 du e z / 2 e u / 2 2 2 2 1 e z / 2 , z , 2 1 As you can see, Z ~ N (0,1). A practical procedure to generate Gaussian random variables is from two independent uniformly distributed random sequences, based on 1/ 2 Z 2 ln X cos( 2Y ). Example Let X and Y be independent identically distributed Geometric random variables with P( X k ) P(Y K ) pq k , (a) Show that min (X , Y ) and X –Y k 0, 1, 2,. are independent random variables. (b) Show that min (X , Y ) and max (X , Y ) – min (X , Y ) are also independent Solution (a) Let Z = min (X , Y ) , and W = X – Y. Note that Z takes only nonnegative values {0, 1, 2, }, while W takes both positive, zero and negative values {0, 1, 2, }. Example - continued We have P(Z = m, W = n) = P{min (X , Y ) = m, X – Y = n}. But Y Z min( X ,Y ) X X Y W X Y is nonnegativ e X Y W X Y is negative. Thus P( Z m,W n ) P{min( X ,Y ) m, X Y n, ( X Y X Y )} P(min( X , Y ) m, X Y n, X Y ) P(min( X , Y ) m, X Y n, X Y ) Example - continued P( Z m,W n ) P(Y m, X m n, X Y ) P ( X m, Y m n , X Y ) P( X m n ) P(Y m) pq m n pq m , m 0, n 0 m mn P( X m) P(Y m n ) pq pq , m 0, n 0 p 2 q 2 m |n| , m 0, 1, 2, n 0, 1, 2, represents the joint probability mass function of the random variables Z and W. Also P ( Z m ) P ( Z m,W n ) p 2 q 2 m q |n| n n p 2 q 2 m (1 2 q 2 q 2 ) 2q p 2 q 2 m (1 1 q ) pq 2 m (1 q) p (1 q) q 2 m , m 0, 1, 2,. Example - continued Thus Z represents a Geometric random variable since 1 q 2 p(1 q), and P(W n ) P( Z m,W n ) p 2 q 2 m q|n| m 0 m 0 p 2 q|n| (1 q 2 q 4 1pq q|n| , ) p 2 q|n| n 0, 1, 2, 1 1q2 . Note that P( Z m,W n) P( Z m) P(W n), establishing the independence of the random variables Z and W. The independence of X – Y and min (X , Y ) when X and Y are independent Geometric random variables is an interesting observation. Example - continued (b) Let Z = min (X , Y ) , R = max (X , Y ) – min (X , Y ). In this case both Z and R take nonnegative integer values 0, 1, 2, . we get P{Z m, R n} P{min( X , Y ) m, max( X , Y ) min( X , Y ) n, X Y } P{min( X , Y ) m, max( X , Y ) min( X , Y ) n, X Y } P{Y m, X m n, X Y ) P( X m, Y m n, X Y } P{ X m n, Y m, X Y ) P( X m, Y m n, X Y } pq m n pq m pq m pq m n , pq m n pq m , 2 p 2 q 2 m n , 2 2m p q , m 0, 1, 2,, n 1, 2, m 0, 1, 2,, n0 m 0, 1, 2,, n 1, 2, m 0, 1, 2,, n 0. Example - continued This equation is the joint probability mass function of Z and R. Also we can obtain: P( Z m) P{Z m, R n} p q (1 2 q n ) p 2 q 2 m 1 p 2 2m n 0 and p(1 q) q 2 m , n 1 2q m 0, 1, 2, p , n0 1 q P( R n ) P{Z m, R n} 2p n m 0 1 q q , n 1, 2,. From (9-68)-(9-70), we get P( Z m, R n) P( Z m) P( R n) This proves the independence of the random variables Z and R as well.