1. Consider random vector \[\begin{equation*} \left( X,\, Y \right) \sim U\left( M \right), \, M = \left\{ (x,\,y) \in \mathbb{R}^2 : 0 < x < y < 1 \right\}, \end{equation*}\] where \(U\left( M \right)\) denotes uniform distribution over set \(M\). The density function of \(\left( X,\, Y \right)\) is \[\begin{equation*} f_{\left( X,\, Y \right)}(x,\,y) = c\cdot \mathbb{I}_M(x,\,y), \end{equation*}\] where \(\mathbb{I}\) is the indicator function and \(c \in \mathbb{R}\) is constant satisfying \[\begin{equation*} c \int_M f_{\left( X,\, Y \right)}(x,\,y) dx \, dy = c\int_0^1\int_0^y f_{\left( X,\, Y \right)}(x,\,y) dx \, dy = 1. \end{equation*}\] In our case \[\begin{equation*} \int_0^1\int_0^y f_{\left( X,\, Y \right)}(x,\,y)\, dx \, dy = \int_0^1 y \, dy = \frac{1}{2}, \end{equation*}\] hence \(c = 2\).

    The marginal densities are \[\begin{equation*} f_X(x) = 2\int_M dy = 2\int_x^1 \mathbb{I}_{(0,\,1)}(x) dy = 2(1 - x)\cdot\mathbb{I}_{(0,\,1)}(x) \end{equation*}\] and \[\begin{equation*} f_Y(y) = 2\int_M dx = 2\int_0^y \mathbb{I}_{(0,\,1)}(y) dx = 2y\cdot\mathbb{I}_{(0,\,1)}(y). \end{equation*}\] To decide whether \(X\) and \(Y\) are independent we need to prove whether \[\begin{equation*} f_{\left( X,\, Y \right)}(x,\,y) \overset{?}{=} f_X(x)f_Y(y), \end{equation*}\] which clearly does not hold, hence the random variables \(X\) and \(Y\) are not independent.

  2. The conditional density of \(X|Y\) is \[\begin{equation*} f_{X|Y}(x\,|\,y) = \frac{f_{\left( X,\, Y \right)}(x,\,y)}{f_Y(y)} = \frac{1}{y}\mathbb{I}_{(0,\,y)}(x), \end{equation*}\] hence \(\left(X\,|\,Y=y \right) \sim U\left(0,\, y\right)\).

For visualization I will use cooler looking and slightly inacurate scatterplot, sadly the smoother option wasnt working properly.

set.seed(609)
m <- 200000
Z1 <- runif(m, 0, 1)
Z1 <- sqrt(Z1)
Z2 <- runif(m,0, Z1)

n <- 50
A <- matrix(0, nrow = n, ncol = n)
for (i in 1:length(Z1)) {
  A[ceiling(Z2[i]*n),
    ceiling(Z1[i]*n)] <- A[ceiling(Z2[i]*n), ceiling(Z1[i]*n)] + 1
}
library(latticeExtra)
## Loading required package: lattice
levelplot(A, panel=panel.2dsmoother)