THEOREM: Let random variables $X$ and $Y$ have a continuous joint distribution. Suppose that $\{(x, y) :f(x, y) > 0\}$, (where $f(x,y)$ is a p.f. or p.d.f. or p.f./p.d.f.) is a rectangular region $R$ (possibly unbounded) with sides (if any) parallel to the coordinate axes. Then $X$ and $Y$ are independent if and only if $f(x,y)=h_1(x)\cdot h_2(y)$ holds for all $(x, y) ∈ R$, where $h_1$ and $h_2$ are nonnegative functions.
MY TRY:
Take function $f_1(x)$ as defined as marginal p.f./p.d.f of $X$ for the region $R$ and outside $0$.Similarly take function $f_2(x)$ as defined as marginal p.f./p.d.f of $Y$ for the region $R$ and outside $0$.
But I don't think my way is complete and beautiful. Please let me also know what if sides are not parallel to the coordinate axes or are curved? In such cases is it always the case that $X$ and $Y$ are dependent?