# How to compute the distribution of a function of multiple random variables?

$X$ and $Y \sim U(0,1)$.

Let \eqalign{ g(x,y) &= x &\text{ if } &x^2+y^2 \le 1 \\ &=2 &\text{ if } &x^2+y^2 \gt 1 }

and $Z = g(X,Y)$. How to find $F_Z(z), \mathbb{E}(Z)$, and $\mathbb{E}(Z | X^2+Y^2 \gt 1 )$?

• What have you tried so far? At least $E(z | x^2+y^2 > 1 )$ looks pretty simple to me... – S. Kolassa - Reinstate Monica Jan 4 '13 at 21:13
• I am confused with finding cdf of F(z). Then I couldn't find the pdf of z. So I couldnt go further.. – StocSim Jan 4 '13 at 21:21
• Try plotting $x$ and $y$ and the two regions in the unit square that correspond to the different branches of the definition of $z$... – S. Kolassa - Reinstate Monica Jan 4 '13 at 21:27
• Dear @StephanKolassa , Then will F(z) be zsquare/4 when x^2+y^2 ≤ 1 1 when x^2+y^2 > 1 But how can I transform it in terms of z :( – StocSim Jan 4 '13 at 21:36

As Stephen Kolassa suggests, it helps to draw a picture of the transformation $g$. Here are two: a contour plot of its values and a 3D perspective plot showing $z = g(x,y)$. Use basic definitions and principles to answer your questions. Begin with $F_Z(z)$, which is the probability that $Z \le z$. Because $(X,Y)$ is uniform, this probability equals the area of all locations at elevations of $z$ or lower. For instance, $F_Z(1)$ is obviously $\pi/4$ because the quarter circle covers all locations $(x,y)$ where $g(x,y) \le 1$.

The discontinuous nature of this transformation strongly suggests you break all calculations into two parts: one for where $x^2+y^2\le 1$ and another for the rest of the domain. This is a plot of $F_Z$.

• Dear @whuber , your help is appreciated! One last thing, for the range of the z , do i take z=x2+y2 ? – StocSim Jan 4 '13 at 22:07
• Look at the plot of $F$: notice that it is zero for $z\le 0$ and one for $z\ge 2$ and otherwise is strictly between $0$ and $1$. Thus its essential range is $[0,2]$. – whuber Jan 4 '13 at 22:09
• hopefully I see that :) but what does z equal? z=x2+y2 ? – StocSim Jan 4 '13 at 22:10
• I don't think we're communicating: your question states that $z=g(x,y)$ and it gives the formula for $g$. That is the formula I used to create all three plots. The 3D figure perhaps most clearly shows what is going on: you use one formula for $z$ inside the unit circle and another formula outside the unit circle. This is what creates the visible breaks in all these plots. – whuber Jan 4 '13 at 22:11