Prove that $f(X)$ and $g(Y)$ are independent if $X$ and $Y$ are independent [duplicate]

Let $X$ and $Y$ be independent random variables. Prove that $f(X)$ and $g(Y)$ are independent for any choice of measurable functions $f$ and $g$.

This sounds very obvious, but I have no idea how to approach it.

EDIT: Two random variables are independent if $\Pr\{X = x \text{ and } Y = y\} = \Pr\{X = x\} \cdot \Pr\{Y = y\}$


$X,Y$ are independent iff for all measurable $A,B$, the events $X^{-1}(A)$ and $Y^{-1}(B)$ are independent.

Suppose $C,D$ are measurable, and consider $(f \circ X)^{-1} ( C)$ and $(g \circ Y)^{-1} (D)$. Since $(f \circ X)^{-1} (C) = X^{-1} (f^{-1}(C))$ and $(g \circ Y)^{-1} (D)= Y^{-1} (g^{-1}(D))$. Since $X,Y$ are independent, we see that $X^{-1} (f^{-1}(C))$ and $Y^{-1} (g^{-1}(D))$ are independent and since $C,D$ were arbitrary, we see that $f \circ X$ and $g \circ Y$ are independent.