AMS 3 Joe Mitchell Eamples: Joint Densities and Joint Mass Functions Eample : X and Y are jointl continuous with joint pdf f(,) { c 2 + 3 if, 2, otherwise. (a). Find c. (b). Find P(X + Y ). (c). Find marginal pdf s of X and of Y. (d). Are X and Y independent (justif!). (e). Find E(e X cosy ). (f). Find cov(x,y ). We start (as alwas!) b drawing the. (See below, left.) 2 2 with > (a). We find c b setting so c. f(,)dd 2 (c 2 + 2c )dd 3 3 + 3, (b). Draw a picture of the (a -b-2 rectangle), and intersect it with the set {(,) : + }, which is the region above the line. See figure above, right. To compute the probabilit, we double integrate the joint densit over this subset of the : 2 P(X + Y ) ( 2 + 65 )dd 3 72 (c). We compute the marginal pdfs: f X () f Y () { 2 f(,)d (2 + )d 3 22 + 2 if 3 otherwise { f(,)d (2 + )d + if 2 3 3 6 otherwise
(d). NO, X and Y are NOT independent. The is a rectangle, so we need to check if it is true that f(,) f X ()f Y (), for all (,). We easil find countereamples: f(.2,.3) f X (.2)f Y (.3). (e). (f). 2 E(e X cos Y ) ( 2 + [ 3 )dd 2 (e cos )( 2 + 3 )dd cov(x,y ) E(XY ) E(X)E(Y ) 2 ( 2 + ] [ 3 )dd Eample 2: X and Y are jointl continuous with joint pdf { c if,, + f(,), otherwise. 2 ( 2 + 3 )dd ] (a). Find c. (b). Find P(Y > X). (c). Find marginal pdf s of X and of Y. (d). Are X and Y independent (justif!). We start (as alwas!) b drawing the. (See below, left.) with > (a). We find c b setting so c 24. f(,)dd.5 cdd c 24, (b). Draw a picture of the (a triangle), and intersect it with the set {(,) : }, which is the region above the line ; this ields a triangle whose leftmost -value is and whose rightmost -value is /2 (which is onl seen b drawing the figure!). See figure above, right. To compute the probabilit, we double integrate the joint densit over this subset of the : P(Y X) /2 2 24dd
(c). We compute the marginal pdfs: f X () f Y () f(,)d f(,)d { 24d 2( ) 2 if otherwise { 24d 2( ) 2 if otherwise (d). NO, X and Y are NOT independent. The is not a rectangle or generalized rectangle, so we know we can find points (,) where it fails to be true that f(,) f X ()f Y (). In particular, f(.7,.7) f X (.7)f Y (.7) >. Eample 3: X and Y are jointl continuous with joint pdf { c if, f(,), otherwise. (a). Find c. (b). Find P( Y 2X.). (c). Find marginal pdf s of X and of Y. (d). Are X and Y independent (justif!). We start (as alwas!) b drawing the, which is just a unit square in this case. (See below, left.) 2+. 2. with.< 2<....5.55.45 (a). We find c b setting so c 4. f(,)dd cdd c 4, (b). Draw a picture of the (unit square), and intersect it with the set {(,) : 2.} {(,) :. 2.} {(,) : 2. 2+.}, which is the region above the line 2. and below the line 2 +.. See figure above, left. (You will not be able to figure out the limits of integration without it!) To compute the probabilit, we double integrate the joint densit over this subset of the support set: P( Y 2X.). (+.)/2 3 4dd +. (+.)/2 (.)/2 4dd
(c). We compute the marginal pdfs: f X () f Y () (d). YES, X and Y are independent, since { f(,)d 4d 2 if otherwise { f(,)d 4d 2 if otherwise { 2 2 4 if and f X ()f Y () otherwise is eactl the same as f(,), the joint densit, for all and. Eample 4: X and Y are independent continuous random variables, each with pdf g(w) { 2w if w, otherwise. (a). Find P(X + Y ). (b). Find the cdf and pdf of Z X + Y. Since X and Y are independent, we know that { 2 2 if and f(,) f X ()f Y () otherwise We start (as alwas!) b drawing the, which is a unit square in this case. (See below, left.) 4
with +< z z.4 z with +<.4 z.6 with +<.6 z.4 z.6 Case: <z<2 Case: <z< (a). Draw a picture of the (unit square), and intersect it with the set {(,) : + }, which is the region below the line. See figure above, right. To compute the probabilit, we double integrate the joint densit over this subset of the : P(X + Y ) 4dd 6 (b). Refer to the figure (lower left and lower right). To compute the cdf of Z X + Y, we use the definition of cdf, evaluating each case b double integrating the joint densit over the subset of the corresponding to {(,) : + z}, for different cases depending on the value of z: F Z (z) P(Z z) P(X + Y z) P(Y X + z) if z z z 4dd if z z 4dd + z z 4dd if z 2 if z 2 5
Eample 5: X and Y are jointl continuous with joint pdf { e (+) if, f(,), otherwise. Let Z X/Y. Find the pdf of Z. The first thing we do is draw a picture of the (which in this case is the first quadrant); see below, left. (/z) with (/)<z, for z> To find the densit, f Z (z), we start, as alwas, b finding the cdf, F Z (z) P(Z z), and then differentiating: f Z (z) F Z(z). Thus, using the definition, and a picture of the, we start b handling the cases, F Z (z) P(Z z) P(X/Y z) { if z < P(Y (/z)x) if z >, where we have used the fact that X and Y are both nonnegative (with probabilit ), so multipling both sides of the inequalit b Y does not flip the inequalit; note, however, that when we divide both sides b z, to obtain Y (/z)x, we were making the assumption that z > (otherwise the inequalit would flip). Now, we consider the picture of the, together with the halfplane specified b (/z); see the figure above, right. We double integrate the joint densit over the portion of the where (/z), obtaining F Z (z) P(Z z) P(X/Y z) { if z < P(Y (/z)x) if z >, { if z < (/z) e (+) dd z if z >. z+ Then, to get the pdf, we take the derivative: { if z < f Z (z) (z+) z if z > (z+) 2 (z+) 2 6
Eample 6: X and Y are independent, each with an eponential(λ) distribution. Find the densit of Z X + Y and of W Y X 2. Since X and Y are independent, we know that f(,) f X ()f Y (), giving us f(,) { λe λ λe λ if, otherwise. The first thing we do is draw a picture of the : the first quadrant. (a). To find the densit, f Z (z), we start, as alwas, b finding the cdf, F Z (z) P(Z z), and then differentiating: f Z (z) F Z(z). Thus, using the definition, and a picture of the together with the halfplane + z, we get F Z (z) P(Z z) P(X + Y z) P(Y X + z) { if z < z z λe λ λe λ dd e λz λze λz if z This gives the pdf, { if z < f Z (z) λ 2 ze λz if z, which is the pdf of a Gamma(2,λ). Thus, Z is Gamma(2,λ) random variable. (b). To find the densit, f W (w), we start, as alwas, b finding the cdf, F W (w) P(W w), and then differentiating: f W (w) F W(w). Thus, using the definition, and a picture of the together with the region specified b 2 + w, we get F W (w) P(W w) P(Y X 2 w) P(Y X 2 + w) { 2 +w λe λ λe λ dd if w > w 2 +w λe λ λe λ dd if w < Then, we differentiate to get f W (w) F W(w). (Go ahead and evaluate the integral, then take the derivative.) Eample 7: X and Y are jointl continuous with (X,Y ) uniforml distributed over the union of the two squares {(,) :, } and {(,) :, 3 4}. (a). Find E(Y ). (b). Find the marginal densities of X and Y. (c). Are X and Y independent? (d). Find the pdf of Z X + Y. Solution to be provided. (possibl in class) Eample 8: X and Y have joint densit f(,) { + if,, otherwise. Find the joint cdf, F X,Y (,), for all and. Compute the covariance and correlation of X and Y. Solution to be provided. (possibl in class) 7
Eample 9: Suppose that X and Y have joint mass function as shown in the table below. (Here, X takes on possible values in the set { 2, 2}, Y takes on values in the set { 2,, 2, 3.}.) -2 2 3. -2.4.8.2.6 2.6.2.8.24 (a). (6 points) Compute P( X + Y 2 < ). (b). (6 points) Find the marginal mass function of Y and plot it. (be ver eplicit!) (c). (6 points) Compute var(x 2 Y ) and cov(x,y ). (d). (2 points) Are X and Y independent? (Wh or wh not?) Solution to be provided. (possibl in class) Eample : Two fair dice are rolled. Let X be the larger of the two values shown on the dice, and let Y be the absolute value of the difference of the two values shown. Give the joint pmf of X and Y. Compute cov(x,y ), E(X), E(Y X ), P(X > 2Y ). The sample space is the set S {(, ), (, 2),...,(6, 6)}; there are 36 equall likel outcomes. Note that X {, 2,...,6} and Y {,,...,5}. p(, ) P(X,Y ) P({(, )}) /36, where (,) is the outcome in which the first die is a and the second die is also a (so that the larger die is and the difference of the two values is ). Similarl, p(i, ) P(X i,y ) P({(i,i)}) /36, for i, 2,...,6. in which the first die is a i and the second die is also a i Now, p(, ) p(, 2) p(, 6), since, if the larger of the two dice shows, the difference cannot be or more. Now, p(2, ) P(X 2,Y ) P({(2, ), (, 2)}) 2/36. Similarl, p(3, ) p(3, 2) p(4, ) p(4, 2) p(4, 3) p(5, ) p(5, 4) p(6, ) p(6, 5) 2/36, since each corresponding event is a subset of two outcomes from S. All other values of p(i,j) are. Check that the sum of all values p(i,j) is, as it must be! Thus, in summar, if j i, and i {, 2,...,6},j {,,...,5} p(i,j) if (i,j) {(, ), (2, ),...,(6, )} 36 2 otherwise 36 (It is convenient to arrange all these numbers in a table.) We can also compute 6 5 E(X) i p(i,j) 6 i j 36, 6 5 6 5 6 5 cov(x,y ) E(XY ) [E(X)][E(Y )] ij p(i, j) i p(i,j) j p(i,j) i j i j i j 8
Eample : Alice and Bob plan to meet at a cafe to do AMS3 homework together. Alice arrives at the cafe at a random time (uniform) between noon and :pm toda; Bob independentl arrives at a random time (uniform) between noon and 2:pm toda. (a). What is the epected amount of time that somebod waits for the other? (b). What is the probabilit that Bob has to wait for Alice? Let X be the number of hours past noon that Alice arrives at the cafe. Let Y be the number of hours past noon that Bob arrives at the cafe. Then, we know that X is Uniform(,), and Y is Uniform(,2). Since, b the stated assumption, X and Y are independent, we know that the joint densit is given b { f(,) /2 if, 2 otherwise We begin (as alwas) b plotting the : it is simpl a rectangle of width and height 2. (a). Let W ma{x,y } min{x,y }; then, W is the amount of time (in hours) that somebod has to wait. We want to compute E(W). Now, W is a function of X and Y. So we just use the law of the unconscious statistician: E(W) E(ma{X,Y } min{x,y }) 2 [ma{, } min{, }](/2)dd [ma{,} min{,}]f(,)dd Now, in order to write the function [ma{, } min{, }] eplicitl, we break into two cases: If <, then ma{,} min{,} ; if >, then ma{,} min{,}. Thus, we integrate to get E(W) E(ma{X,Y } min{x,y }) ( )(/2)dd+ 2 ( )(/2)dd 2 +3 4 5 6. Thus, the epected time waiting is 5/6 hours (or 5 minutes). (Note that it is wrong to reason like this: Alice epects to arrive at 2:3; Bob epects to arrive at :; thus, we epect that Bob will wait 3 minutes for Alice.) (b). We want to compute the probabilit that Bob has to wait for Alice, which is P(Y < X), which we do b integrating the joint densit, f(,), over the region where <. Draw a picture! (Show the (a rectangle), and the line.) P(Y < X) (/2)dd 4 Eample 2: Suppose X and Y are independent and that X is eponential with mean.5 and Y has densit { f Y () 3e 3 if > otherwise Find the densit of the random variable W min{x,y } and the random variable Z X + Y. 9