Function of Two Discrete Random Variables

Theorem
Let $\left({\Omega, \Sigma, \Pr}\right)$ be a probability space.

Let $X$ and $Y$ be discrete random variables on $\left({\Omega, \Sigma, \Pr}\right)$.

Let $g: \R^2 \to \R$ be a real-valued function.

Then $Z = g \left({X, Y}\right)$, defined as:
 * $\forall \omega \in \Omega: Z \left({\omega}\right) = g \left({X \left({\omega}\right), Y \left({\omega}\right)}\right)$

is also a discrete random variable.

Corollary
Let $\left({\Omega, \Sigma, \Pr}\right)$ be a probability space.

Let $X_1, X_2, \ldots, X_n$ be discrete random variables on $\left({\Omega, \Sigma, \Pr}\right)$.

Then $Z = g \left({X_1, X_2, \ldots, X_n}\right)$, defined as:
 * $\forall \omega \in \Omega: Z \left({\omega}\right) = g \left({X_1 \left({\omega}\right), X_2 \left({\omega}\right), \ldots, X_n \left({\omega}\right)}\right)$

is also a discrete random variable.

Proof
As $\operatorname{Im} \left({X}\right)$ and $\operatorname{Im} \left({Y}\right)$ are countable, then so is $\operatorname{Im} \left({g \left({X, Y}\right)}\right)$.

Now consider $g^{-1} \left({Z}\right)$.

We have that:
 * $\forall x \in \R: X^{-1} \left({x}\right) \in \Sigma$.
 * $\forall y \in \R: Y^{-1} \left({x}\right) \in \Sigma$.

We also have that:
 * $\displaystyle \forall z \in \R: g^{-1} \left({z}\right) = \bigcup_{\left({x, y}\right): g \left({x, y}\right) = z} \left\{{\left({x, y}\right)}\right\}$

But $\Sigma$ is a sigma-algebra and therefore closed for unions.

Thus $\forall z \in \R: g^{-1} \left({z}\right) \in \Sigma^2$.

Now consider $\left({v, w}\right) \in g^{-1} \left({Z}\right)$.

As $\Sigma$ is a sigma-algebra it follows directly that:
 * $\forall x \in v: X^{-1} \left({x}\right) \in \Sigma$
 * $\forall y \in w: Y^{-1} \left({y}\right) \in \Sigma$

Hence the result.

Proof of Corollary
Follows straightforwardly by induction from the main result.