# CDF of $X+Y$,$X−Y$,$XY$ for $(X,Y)$ Chosen Uniformly Inside Triangle

Let $(X,Y)$ be chosen uniformly on the triangle $\{(x,y)\in\mathbb R^2:x+y\leq1,x\geq0,y\geq0\}$. What is the joint density function of $(X,Y)$? Find the CDFs of $X+Y$, $X-Y$, and $XY$.

What I've tried:

$\displaystyle \frac{1}{Area\hspace{1mm} of\hspace{1mm} Triangle} =\frac{1}{\frac{1}{2}\cdot 1 \cdot 1}=2$,

Therefore the joint density function of $(X,Y)$ is:

$$f_{X,Y}(x,y)= \begin{cases} 2 & \text{inside the triangle} \\ 0 & \text{elsewhere} \end{cases}$$

How do I then find the distributions? Thank you!

-
Hint: in each case, determine the range of values of the function (e.g. $X+Y$ will have values in $[0,1]$). Then, for a fixed number $z$ in that range, compute $P\{Z \leq z\}$. e.g. $P\{X+Y\leq 0.82\}$. This gives the CDF of $Z$. Differentiate to find the pdf. –  Dilip Sarwate Mar 2 '13 at 0:02
+1 on Prof. Dilip's suggestion. You would also need to first find marginal distribution for $X$ and $Y$. –  jay-sun Mar 2 '13 at 0:34
@Dilip, Did I succeed in calculating $P\{X+Y\leq z\}$? If so, what am I supposed to differentiate now? And what do I need the marginal distributions for? Thank you both very much for the suggestions. –  Chris Mar 2 '13 at 1:29
@jay-sun Why are the marginal pdfs needed? –  Dilip Sarwate Mar 2 '13 at 2:45
@Chris No, your calculation is incorrect as you can check by substituting $z = 0.1$, say. Try the following. Sketch the $x$-$y$ plane and mark on it the triangle on the interior of which the pdf has value $2$. Draw the line $x+y=z$. If $(X,Y)$ is below this line, then $X+Y\leq z$. Now can you find the probability that $X+Y$ is at most $z$? Preferably without calculating any integrals? Might the answer be $z^2$ by inspection? Finally, if $Z=X+Y$, what is the definition of $F_Z(z)$? What is the derivative of $F_Z(z)$? Can you find $F_Z(z)$ from all the work you have done thus far? –  Dilip Sarwate Mar 2 '13 at 2:55

The definition of the cumulative distribution function of a random variable $X$ is the function given by $\displaystyle F_X(x)=P(X \leq x)$.

If $Z=X+Y$,

$\displaystyle F_{Z}(z)=P\{X + Y \leq z\} = \int_{0}^{z}\int_{0}^{z-x}2\,\mathrm dy\,\mathrm dx=2\int_{0}^{z}(z-x)\mathrm dx=z^2$

(Rather than integrating, it is easy to determine the CDF $F_{Z}(z)$ by

inspection:)

The PDF is the derivative of the CDF;

$\displaystyle \Rightarrow f_{Z}(z)=\frac{d}{dz}F_{Z}(z)=2z$.

If $Z=X-Y$,

$\displaystyle F_{Z}(z)=P\{X - Y \leq z\} =\mathbb P(Y\geq X-z)$

$\displaystyle \color{red}A\color{red}R\color{red}E\color{red}A\color{black} =\frac{1}{2}\left(\frac{1-z}{\sqrt{2}}\right)^2=\frac{(1-z)^2}{4}$

$\displaystyle \color{blue} A\color{blue}R\color{blue}E\color{blue}A\color{black} = \frac{1}{2}-\color{red}A\color{red}R\color{red}E\color{red}A\color{black}=\frac{1}{2}-\frac{(1-z)^2}{4}$

Therefore $\displaystyle F_{Z}(z)=2\left[\frac{1}{2}-\frac{(1-z)^2}{4}\right]=\frac{1}{2}(-z^2+2z+1)$

And differentiating to find the PDF:

$\displaystyle f_{Z}(z)=\frac{d}{dz}\left(\frac{1}{2}(-z^2+2z+1)\right)=1-z$.

If $Z=XY$,

$\displaystyle F_{Z}(z)=P\{XY \leq z\} =\mathbb P\left(y\leq \frac{z}{x}\right)$

The points of intersection of $\displaystyle y=\frac{z}{x}$ with the line $\displaystyle y=-x+1$ are:

$\displaystyle x=\frac{1\pm \sqrt{1-4z}}{2}$

The curve intersects the triangle if $z<\frac{1}{4}$.

$\color{blue}A\color{blue}R\color{blue}E\color{blue}A \color{black}=$QUADRILATERAL$+$INTEGRAL$+$TRIANGLE

$\displaystyle=\frac{1}{4}\left(2z-\sqrt{1-4z}+1\right) + \int_{\frac{1-\sqrt{1-4z}}{2}}^{\frac{1+\sqrt{1-4z}}{2}}\frac{z}{x}dx+\frac{1}{8}\left(\sqrt{1-4z}-1\right)^2$

$\displaystyle =\frac{1}{4}\left(2z-\sqrt{1-4z}+1\right) + 2z\tan^{-1}\sqrt{1-4z} +\frac{1}{8}\left(\sqrt{1-4z}-1\right)^2$

$\displaystyle = \frac{1}{2}\left(1-\sqrt{1-4z}+4z\tan^{-1}\left(\sqrt{1-4z}\right)\right)$

Therefore, multiplying by 2, we have: $F_{Z}(z)=\left(1-\sqrt{1-4z}+4z\tan^{-1}\left(\sqrt{1-4z}\right)\right)$

And taking the derivative to find the PDF, we have:

PDF $=\frac{d}{dz}\left(1-\sqrt{1-4z}+4z\tan^{-1}\left(\sqrt{1-4z}\right)\right)$

$\displaystyle=4\tan^{-1}\left(\sqrt{1-4z}\right)$.

Further exercises related to the question:

The marginal distribution for $X$ is:

$\displaystyle f_{X}(x)=\int_{-\infty}^{\infty}f_{X,Y}(x,y')dy'=\int_{0}^{1-x}2dy=2(1-x)$

The marginal distribution for $Y$:

$\displaystyle f_{Y}(y)=\int_{-\infty}^{\infty}f_{X,Y}(x',y)dx'=\int_{0}^{1-y}2dx=2(1-y)$

The conditional PDF of $X$ given $Y$:

$\displaystyle f_{X|Y}(x|y)=\frac{f_{X,Y}(x,y)}{f_{Y}(y)}=\frac{1}{1-y}$, $0\leq x \leq y$

Since the conditional PDF is uniform on $[0,1-Y]$, the conditional

expectation is simply: $\displaystyle\mathbb E[X|Y=y]=\frac{1-y}{2}$

The total expectation theorem yields:

$\displaystyle\mathbb E[X]=\int_{0}^{1}\frac{1-y}{2}f_{Y}(y)dy=\frac{1}{2}\int_{0}^{1}f_{Y}(y)dy-\frac{1}{2}\int_{0}^{1}yf_{Y}(y)dy$

$\displaystyle \mathbb E[X]=\frac{1}{2}-\frac{1}{2}\mathbb E[Y]$ and by symmetry, $\mathbb E[X]=\mathbb E[Y]\Rightarrow$

$\displaystyle\mathbb E[X]=\frac{1}{2}-\frac{1}{2}\mathbb E[X]\Rightarrow \mathbb E[X]=\frac{1}{3}$. $\blacksquare$

-