54  Additional problems

We extend the concepts of joint, marginal and conditional distribution to continuous random variables.

Example 54.1 Suppose \(X\) and \(Y\) are uniformly distributed on a disk \(\{(x,y):x^{2}+y^{2}\leq1\}\). Find the joint PDF, marginal distributions and conditional distributions. Are \(X\) and \(Y\) independent?

Solution. The area of the disk is \(\pi\), therefore

\[f(x,y)=\begin{cases} \frac{1}{\pi} & x^{2}+y^{2}\leq1\\ 0 & \textrm{otherwise} \end{cases}\]

The marginal distributions are

\[\begin{aligned} f_{X}(x) & =\int_{-\sqrt{1-x^{2}}}^{\sqrt{1+x^{2}}}\frac{1}{\pi}dy=\frac{2}{\pi}\sqrt{1-x^{2}},\qquad-1\leq x\leq1\\ f_{Y}(y) & =\int_{-\sqrt{1-y^{2}}}^{\sqrt{1+y^{2}}}\frac{1}{\pi}dx=\frac{2}{\pi}\sqrt{1-y^{2}},\qquad-1\leq y\leq1\end{aligned}\]

The conditional distributions are

\[f_{Y|X}(y|x)=\frac{f(x,y)}{f_{X}(x)}=\frac{\frac{1}{\pi}}{\frac{2}{\pi}\sqrt{1-x^{2}}}=\frac{1}{2\sqrt{1-x^{2}}}\]

Therefore, \(Y|X\sim\textrm{Unif}(-\sqrt{1-x^{2}},\sqrt{1-x^{2}})\).

Since \(f(x,y)\neq f_{X}(x)f_{Y}(y)\), \(X\) and \(Y\) are not independent. This is because knowing the value of \(X\) constrains the value of \(Y\).

Example 54.2 Suppose \(X,Y\overset{iid}{\sim}U(0,1)\). Find the density function of \(X+Y\).

Solution. Let \(S=X+Y\), \(0\leq S\leq 1\). Apply convolution: \[f_S(s) = \int f_X(x)f_Y(s-x)dx\] For \(X,Y\) only take values between 0 and 1. So we require \(0\leq x \leq 1\) and \(0\leq s-x \leq 1\) (\(s-1 \leq x \leq s\)). If \(0\leq s \leq 1\), the valid range for \(x\) is \([0,s]\):
\[f_S(s)=\int_0^s 1\ dx=s.\]If \(1\leq s\leq 2\), the valid range for \(x\) is \([s-1,1]\):

\[f_S(s)=\int_{s-1}^1 1\ dx = 2-s.\]Thus,

\[f_S(s) = \begin{cases} s,&\textrm{if } 0\leq s\leq 1\\ 2-s,&\textrm{if } 1< s\leq 2.\\ \end{cases}\]The problem can also be approached geometrically. \(P(X+Y\leq s)\) can be computed by the area surrounded by \(y=s-x\) and \(0\leq x,y \leq 1\). Draw a diagram to see it.

Example 54.3 Suppose \(X,Y\overset{iid}{\sim}U(0,1)\). Find the density function of \(XY\).

Solution. We cannot use convolution in this case, since it is not the sum of random variables. Let \(T=XY\), \(0\leq T\leq 1\). We first compute the CDF:

\[ P(XY\leq t) = \int_0^1 P(XY\leq t|X=x)f_X(x)dx = \int_0^1 P(Y\leq t/x)dx \]The probability depends on the values of \(t\) and \(x\). If \(x>t\), it is proportional to the value \(t/x\). If \(x\leq t\), it is always 1. Thus,

\[P(XY\leq t)=\int_0^t 1\ dx + \int_t^1 \frac{t}{x} dx = t (1-\ln t).\]Differentiate to get the density function:

\[f_T(t)=\begin{cases} -\ln t, &\textrm{if } 0\leq t \leq 1\\ 0, &\textrm{otherwise}.\\ \end{cases}\] Draw a diagram to get the same conclusion. The probability can be found by the area surrounded by \(y=\frac{t}{x}\) and \(0\leq x,y \leq 1\).

Example 54.4 For \(X,Y\overset{iid}{\sim}U(0,1)\), find \(E(|X-Y|)\).

Solution. Apply 2D LOTUS: \[\begin{aligned}E(|X-Y|)= & \int_{0}^{1}\int_{0}^{1}|x-y|dxdy\\ = & \int_{0}^{1}\int_{y}^{1}(x-y)dxdy+\int_{0}^{1}\int_{0}^{y}(y-x)dxdy\\ = & 2\int_{0}^{1}\int_{y}^{1}(x-y)dxdy\\ = & \frac{1}{3}. \end{aligned}\]