Let $(X,Y)$ a random variable uniformly distributed on the triangle $(0,0)$, $(0,1)$, $(1,0)$.
- Find the density of $(X,Y)$.
$\rightarrow f_{X,Y}(x,y)=2$
- Determine if $X$ and $Y$ are independent or not, and find $cov(X,Y)$.
$\rightarrow$ $X,Y$ are not independent, so $cov(X,Y)=\mathbb{E}[XY]-\mathbb{E}[X]\mathbb{E}[Y]=\frac{1}{6}-\frac{1}{3}(1-y)$.
- Let $A=({(x,y):x<\frac{1}{2},y>\frac{1}{2},y<\frac{1}{2}+x})$. Find $\mathbb{P}(A)$.
$\rightarrow \mathbb{P}(A)=\mathbb{P}[(x<\frac{1}{2}) \cap (\frac{1}{2}<y<\frac{1}{2}+x)]=\int_{0}^{\frac{1}{2}}[\int_{\frac{1}{2}}^{\frac{1}{2}+x}f_{X,Y}(x,y)dy]dx=\frac{1}{4}$
Is it correct? I fear I may have done a few mistakes in the points 2) and 3). Thanks in advance.
EDIT: Looking tommik's answer I wrote:
if $y<x \Rightarrow 0<y<x<1 \Rightarrow \left\{\begin{matrix} 0<y<1-x\\ 0<x<1\end{matrix}\right.$ so $f_X(x)=\int_{0}^{1-x}2dy=2(1-x)$
if $y>x \Rightarrow 0<x<y<1 \Rightarrow \left\{\begin{matrix} 0<x<1-y\\ 0<y<1\end{matrix}\right.$ so $f_Y(y)=\int_{0}^{1-y}2dx=2(1-y)$
Being $X,Y \sim U(0,1)$:
$\mathbb{E}(X)=\int_{0}^{1}xf_X(x)dx=\int_{0}^{1}2x(1-x)dx=\frac{1}{3}=\mathbb{E}(Y)$ and $\mathbb{E}(XY)=\int_{0}^{1}[\int_{0}^{1-x}2xydy]dx$
The variables are not independent as the joint domain is not a rectangle (necessary condition for independence)
now I check the covariance you calculated
The correct covariance calculation is the following
$$E(XY)=2\int_0^1 x dx\int_0^{1-x} y dy=\frac{1}{12}$$
$$E[X]=2\int_0^1 x dx\int_0^{1-x} dy=\int_0^1 2x(1-x)dx=\frac{1}{3}$$
$E[Y]=E[X]$ for self evident symmetry.
Thus
$$cov(X,Y)=\frac{1}{12}-\frac{1}{9}=-\frac{1}{36}$$