9. Two Functions of Two Random Variables In the spirit of the previous lecture, let us look at an immediate generalization: Suppose X and Y are two random variables with joint p.d.f f XY ( x, y). Given two functions g ( x, y ) and h( x, y ), define the new random variables Z g ( X ,Y ) W h ( X , Y ). (9-1) (9-2) How does one determine their joint p.d.f f ZW ( z, w) ? Obviously with f ZW ( z, w) in hand, the marginal p.d.fs f Z (z) and fW (w) can be easily determined. 1 PILLAI The procedure is the same as that in (8-3). In fact 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, (9-3) where Dz ,w is the region in the xy plane such that the inequalities g ( x, y ) z and h( x, y ) w are simultaneously satisfied. We illustrate this technique in the next example. y Dz ,w Dz ,w x 2 Fig. 9.1 PILLAI Example 9.1: Suppose X and Y are independent uniformly distributed random variables in the interval (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, ). (9-4) 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 . (9-5) We must consider two cases: w z and w z, since they give rise to different regions for Dz ,w (see Figs. 9.2 (a)-(b)). Y Y ( w, w) ( z, z ) ( z, z ) ( w, w) yw X X ( b) w z (a ) w z Fig. 9.2 3 PILLAI For w z, from Fig. 9.2 (a), the region by the doubly shaded area. Thus Dz ,w is represented FZW ( z, w) FXY ( z, w) FXY ( w, z ) FXY ( z, z ) , w z, (9-6) and for w z, from Fig. 9.2 (b), we obtain FZW ( z, w) FXY ( w, w) , With w z. x y xy FXY ( x, y ) FX ( x ) FY ( y ) 2 , (9-7) (9-8) we obtain Thus (2 w z ) z / 2 , FZW ( z, w) 2 2 w / , 2 / 2 , f ZW ( z, w) 0, 0 z w , 0 w z . 0 z w , otherwise . (9-9) (9-10) 4 PILLAI From (9-10), we also obtain f Z ( z) z 2 z f ZW ( z, w)dw 1 , 0 z , (9-11) 2w (9-12) and fW ( w) w 0 f ZW ( z, w)dz 2 , 0 w . If g ( x, y ) and h( x, y ) are continuous and differentiable functions, then as in the case of one random variable (see (530)) it is possible to develop a formula to obtain the joint p.d.f f ZW ( z, w) directly. Towards this, consider the equations g ( x, y ) z, h( x, y ) w. (9-13) For a given point (z,w), equation (9-13) can have many solutions. Let us say ( x1, y1 ), ( x2 , y2 ), , ( xn , yn ), 5 PILLAI represent these multiple solutions such that (see Fig. 9.3) g ( xi , yi ) z, h( xi , yi ) w. y w w w ( x2 , y2 ) ( x1, y1 ) i ( xi , yi ) z z z 2 1 w ( z , w) (9-14) z n x ( xn , yn ) (b) (a) Fig. 9.3 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 . (9-15) 6 PILLAI Using (7-9) we can rewrite (9-15) as Pz Z z z, w W w w f ZW ( z, w)zw. (9-16) But 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. Towards this referring to Fig. 9.4, we observe that the point A with coordinates (z,w) gets mapped onto the point A with coordinates ( xi , yi ) (as well as to other points as in Fig. 9.3(b)). As z changes to z z to point B in Fig. 9.4 (a), let B represent its image in the xy plane. Similarly as w changes to w w to C, let C represent its image in the xy plane. y w C w C D w A z yi B z z (a) D A xi Fig. 9.4 (b) B i x 7 PILLAI Finally D goes to D, and ABCD represents the equivalent parallelogram in the XY plane with area i . Referring back to Fig. 9.3, the probability in (9-16) can be alternatively expressed as P( X ,Y ) f i i XY ( xi , yi )i . (9-17) i Equating (9-16) and (9-17) we obtain f ZW ( z, w) f XY ( xi , yi ) i i . zw (9-18) To simplify (9-18), we need to evaluate the area i of the parallelograms in Fig. 9.3 (b) in terms of zw. Towards this, h1 g1 denote let and the inverse transformation in (9-14), so that xi g1 ( z, w), yi h1 ( z, w). (9-19) 8 PILLAI As the point (z,w) goes to ( xi , yi ) A, the point ( z z, w) B, the point ( z, w w) C , and the point ( z z, w w) D. Hence the respective x and y coordinates of B are given by g1 g z xi 1 z, z z (9-20) h1 h1 h1 ( z z, w) h1 ( z, w) z yi z. z z (9-21) g1 ( z z, w) g1 ( z, w) and Similarly those of C are given by xi g1 w, w yi h1 w. w (9-22) The area of the parallelogram ABCD in Fig. 9.4 (b) is given by i AB AC sin( ) (9-23) AB cos AC sin AB sin AC cos . 9 PILLAI But from Fig. 9.4 (b), and (9-20) - (9-22) 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 g1 h1 g1 h1 i zw z w w z (9-24) (9-25) (9-26) and g1 i z g1 h1 g1 h1 det zw z w w z h1 z g1 w h1 w The right side of (9-27) represents the Jacobian the transformation in (9-19). Thus (9-27) J ( z , w) of 10 PILLAI g1 z J ( z , w) det h 1 z g1 w . h1 w (9-28) Substituting (9-27) - (9-28) into (9-18), we get 1 f ZW ( z, w) | J ( z, w) | f XY ( xi , yi ) f XY ( xi , yi ), i i | J ( xi , yi ) | (9-29) since 1 | J ( z , w) | | J ( xi , yi ) | (9-30) where J ( xi , yi ) represents the Jacobian of the original transformation in (9-13) given by g x J ( xi , yi ) det h x g y h y x x i . (9-31) 11 , y yi PILLAI Next we shall illustrate the usefulness of the formula in (9-29) through various examples: Example 9.2: Suppose X and Y are zero mean independent Gaussian r.vs with common variance 2 . Define Z X 2 Y 2 , W tan 1 (Y / X ), where | w | / 2. Obtain f ZW ( z, w). Solution: Here f XY ( x, y ) Since 1 2 2 e ( x 2 y 2 ) / 2 2 . (9-32) z g ( x, y ) x 2 y 2 ; w h( x, y ) tan 1 ( y / x ), | w | / 2, (9-33) if ( x1, y1 ) is a solution pair so is ( x1, y1 ). From (9-33) y tan w, or x y x tan w. (9-34) 12 PILLAI Substituting this into z, we get z x 2 y 2 x 1 tan 2 w x sec w, or x z cos w. (9-35) and (9-36) 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. (9-37) We can use (9-35) - (9-37) to obtain J ( z, w). From (9-28) J ( z , w) so that x z y z x w y w cos w z sin w sin w z cos w | J ( z, w) | z. z, (9-38) (9-39) 13 PILLAI We can also compute J ( x, y ) using (9-31). From (9-33), x J ( x, y ) y x2 y2 y x2 y2 x2 y2 x x2 y2 1 x2 y2 1 . z (9-40) Notice that | J ( z, w) | 1 / | J ( xi , yi ) |, agreeing with (9-30). Substituting (9-37) and (9-39) or (9-40) into (9-29), we get f ZW ( z, w) z f XY ( x1 , y1 ) f XY ( x2 , y2 ) z e 2 z 2 / 2 2 0 z , | w | , 2 (9-41) . Thus fZ ( z) /2 / 2 f ZW ( z, w)dw z 2 e z 2 / 2 2 0 z , , which represents a Rayleigh r.v with parameter 1 0 fW ( w) f ZW ( z, w)dz , | w | 2 , 2, (9-42) and (9-43) 14 PILLAI which represents a uniform r.v in the interval ( / 2, / 2). Moreover by direct computation f ZW ( z, w) f Z ( z ) fW ( w) (9-44) implying that Z and W are independent. We summarize these results in the following statement: If X and Y are zero mean independent Gaussian random variables with common variance, then X 2 Y 2 has a Rayleigh distribution and tan 1(Y / X ) has a uniform distribution. Moreover these two derived r.vs are statistically independent. Alternatively, with X and Y as independent zero mean r.vs as in (9-32), X + jY represents a complex Gaussian r.v. But X jY Ze jW , (9-45) where Z and W are as in (9-33), except that for (9-45) to hold good on the entire complex plane we must have W 15 , and hence it follows that the magnitude and phase of PILLAI a complex Gaussian r.v are independent with Rayleigh and uniform distributions U ~ ( , ) respectively. The statistical independence of these derived r.vs is an interesting observation. Example 9.3: 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. (9-46) Now since u = x + y, v = x - y, always | v | u, and there is only one solution given by x uv , 2 y uv . 2 (9-47) Moreover the Jacobian of the transformation is given by 16 PILLAI 1 1 J ( x, y ) 2 1 1 and hence 1 u / fUV (u, v ) 2 e , 2 0 | v | u , (9-48) represents the joint p.d.f of U and V. This gives fU (u ) u u 1 fUV (u, v )dv 2 2 u e u / dv u u u / e , 0 u , 2 (9-49) and fV ( v ) |v| fUV (u, v )du 1 2 2 |v| e u / du 1 |v|/ e , v . (9-50) 2 Notice that in this case the r.vs U and V are not independent. As we show below, the general transformation formula in (9-29) making use of two functions can be made useful even 17 when only one function is specified. PILLAI Auxiliary Variables: Suppose Z g ( X , Y ), (9-51) where X and Y are two random variables. To determine f Z (z) by making use of the above formulation in (9-29), we can define an auxiliary variable W X or W Y (9-52) and the p.d.f of Z can be obtained from f ZW ( z, w) by proper integration. Example 9.4: Suppose Z = X + Y and let W = Y so that the transformation is one-to-one and the solution is given 18 by y1 w, x1 z w. PILLAI The Jacobian of the transformation is given by 1 J ( x, y ) 0 1 1 1 and hence f ZW ( x, y ) f XY ( x1, y1 ) f XY ( z w, w) or f Z ( z ) f ZW ( z, w)dw f XY ( z w, w)dw, (9-53) which agrees with (8.7). Note that (9-53) reduces to the convolution of f X (z ) and fY (z) if X and Y are independent random variables. Next, we consider a less trivial example. Example 9.5: Let X U (0,1) and Define Z 2 ln X 1 / 2 cos( 2Y ). Y U (0,1) be independent. (9-54) 19 PILLAI Find the density function of Z. Solution: We can make use of the auxiliary variable W = Y in this case. This gives the only solution to be x1 e z sec( 2w ) 2 / 2 (9-55) , y1 w, (9-56) and using (9-28) J ( z , w) x1 z x1 w y1 z y1 w z sec ( 2w) e 2 z sec ( 2w)e 2 x1 w z sec( 2w ) 2 / 2 0 z sec( 2w ) 2 / 2 (9-57) 1 . Substituting (9-55) - (9-57) into (9-29), we obtain f ZW ( z , w) z sec (2 w) e 2 z , z sec( 2 w ) 2 /2 0 w 1, , (9-58) 20 PILLAI and 1 f Z ( z ) f ZW ( z, w)dw e z2 / 2 0 1 0 z sec (2 w) e 2 z tan(2 w ) / 2 2 dw. (9-59) 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 . Using this in (9-59), we get f Z ( z) 1 z2 / 2 u 2 / 2 du e e 2 2 1 z2 / 2 e , z , 2 (9-60) 1 which represents a zero mean Gaussian r.v with unit variance. Thus Z N (0,1). Equation (9-54) can be used as a practical procedure to generate Gaussian random variables from two independent uniformly distributed random sequences. 21 PILLAI Example 9.6 : Let X and Y be independent identically distributed Geometric random variables with P( X k ) P(Y K ) pq k , k 0, 1, 2,. (a) Show that min (X , Y ) and X – Y are independent random variables. (b) Show that min (X , Y ) and max (X , Y ) – min (X , Y ) are also independent random variables. Solution: (a) Let (9-61) 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, }. We have P(Z = m, W = n) = P{min (X , Y ) = m, X – Y = n}. But X Y W X Y is nonnegativ e Y Z min( X ,Y ) X 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 ) 22 P(min( X , Y ) m, X Y n, X Y ) (9-62) PILLAI 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, (9-63) 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,. Thus Z represents a Geometric random variable since 1 q 2 p(1 q), and (9-64) 23 PILLAI P(W n ) P ( Z m, W n ) m 0 p 2 q|n| (1 q 2 q 4 1pq q|n| , 2 2 m |n| p q q m 0 ) p 2 q|n| n 0, 1, 2, 1 1q2 . (9-65) Note that P( Z m,W n) P( Z m) P(W n), (9-66) 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. (b) Let Z = min (X , Y ) , R = max (X , Y ) – min (X , Y ). (9-67) In this case both Z and R take nonnegative integer values 0, 1, 2, . Proceeding as in (9-62)-(9-63) we get 24 PILLAI 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 , mn m pq pq , 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. (9-68) Eq. (9-68) represents the joint probability mass function of Z and R in (9-67). From (9-68), n 0 n 1 P( Z m) P{Z m, R n} p 2 q 2 m (1 2 q n ) p 2 q 2 m 1 p p(1 q) q 2 m , m 0, 1, 2, (9-69) 2q 25 PILLAI and p , n0 1 q P( R n ) P{Z m, R n} 2p n m 0 1 q q , n 1, 2,. (9-70) From (9-68)-(9-70), we get P( Z m, R n) P( Z m) P( R n) (9-71) which proves the independence of the random variables Z and R defined in (9-67) as well. 26 PILLAI