Finding the PDF Consider a region $A = \{(x, y) \in \mathbb{R}^2|y - 2 \leq x \leq y + 1, 0\leq y \leq 1\}$. If $(X, Y)$ is jointly uniform on this region, find the joint pdf and marginal pdfs of $X$ and $Y$. Determine if $X$ and $Y$ are independent.
My attempt:
Jointly PDF: In the region $A$, we know that $f(x, y)$ must be of the form:
$$f(x, y)= \left\{
  \begin{array}{lr} 
      (\operatorname{Area}(A))^{-1} & \mbox{if } (x, y) \in A \\
      0 & \mbox{otherwise}, 
      \end{array}
\right.$$
where
$$\operatorname{Area}(A)=\int_{0}^{1}\int_{y-2}^{y+1} \,dx \,dy = 3.$$
We have
$$f(x, y)= \left\{
  \begin{array}{lr} 
      \frac{1}{3} & \mbox{if } (x, y) \in A \\
      0 & \mbox{otherwise.} 
      \end{array}
\right.$$
Marginal pdfs: Within the region we have
$$f_x(x)= \left\{
  \begin{array}{lr} 
      \int_{x+2}^{-1} \frac{1}{3} \,dy = \frac{-1}{3} - \frac{1}{3}(x+2)  & \mbox{if } x \in [-2, 1] \\
      \int_{-1}^{1} \frac{1}{3} \,dy = \frac{2}{3}  & \mbox{if } x \in [-1, 1] \\
      \int_{1}^{x-1} \frac{1}{3} \,dy = \frac{1}{3} (x-2) & \mbox{if } x \in [1, 2], \\
      \end{array}
\right.$$
so
$$f_y(y) = \int_{0}^{1} \frac{1}{3} \,dx = \frac{1}{3}.$$
Is this correct or is it $f_y(y) = \int_{y-2}^{y+1} \frac{1}{3} \,dx = 1$? Are they independent? Clearly, $f(x, y)$ is not equal to $f_x(x) \cdot f_y(y)$. They are not independent.
Is this correct? Did I make a mistake? I'm fairly new to joint distributions and so any assistance is appreciated.
 A: Almost.
The domain is the trapezium: $$\def\<{\langle}\def\>{\rangle}\begin{align}A &= \{\< x, y\> \in \mathbb{R}^2: 0\leq y \leq 1\land y {-} 2 \leq x \leq y {+} 1\}\\[1ex] &= \{\< x,y\>\in\Bbb R^2: -2\leq x\leq 2 \land \max(0,x{-}1)\leq y\leq\min(1,x{+}2)\}\\[1ex] &=\{\<x,y\>\in\Bbb R^2:{{(-2\le x\lt {-1}\land 0\le y\le x{+}2)}\lor\\{(-1\le x\lt 1\land 0\le y\le 1)}\lor\\{(1\le x\le 2\land x{-}1\le y\le 1)}}\lower{6.5ex}\}\end{align}$$
Notice where we will partition $x$ and what is the corresponding domain for $y$ at each part.

Thus as the joint pdf is $f(x,y)=\tfrac 13\mathbf 1_{\< x,y\>\in A}$ (as you calculated), we therefore have::
$$\begin{align}f_{\small X}(x)&=\begin{cases}\int_0^{x+2}\tfrac 13\mathrm d y&:& x\in[-2..{-1})\\\int_{0}^{1}\tfrac 13\mathrm d y&:& x\in[-1..1)\\\int_{x-1}^{1}\tfrac 13\mathrm d y&:& x\in[1..2]\\0&:&\text{elsewhere}\end{cases}\\[2ex]&=\begin{cases}(x+2)/3&:& x\in[-2..{-}1)\\1/3&:&x\in[-1..1)\\(2-x)/3&:& x\in[1..2]\\0&:&\text{elsewhere}\end{cases}\end{align}$$

Likewise, by integrating over $x\in[y{-}2..y{+}1]$ in the support $y\in[0..1]$ we evaluate: $$\begin{align}f_{\small Y}(y)&=\int_{y-2}^{y+1}\tfrac 13\mathbf 1_{y\in[0..1]}\mathrm d x \\[1ex]&= \mathbf 1_{y\in[0..1]}\\[2ex]&=\begin{cases}1&:& 0\leq y\leq 1\\0&:&\text{elsewhere}\end{cases}\end{align}$$
