%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\problem {\bf (15 points)} Let random variables $X$ and $Y$ be the
outcomes of two dice rolls.  Assume that the dice are fair, 6-sided,
and independent.  Each problem part below lists two random variables
derived from $X$ and $Y$.  State whether or not these two random
variables are independent and briefly sketch a justification for your
answer.

\begin{problemparts}
\problempart $X$ and $Y ^ 2$

\solution{
These random variables are independent.  For all $x$, $y$,

\begin{eqnarray*}
\Pr(X = x \cap Y^2 = y)
	& = &	\Pr(X = x \cap Y = \sqrt{y}) \\
	& = &	\Pr(X = x) \cdot \Pr(Y = \sqrt{y}) \\
	& = &	\Pr(X = x) \cdot \Pr(Y^2 = y)
\end{eqnarray*}

The second equation uses the independence of $X$ and $Y$.
}

\problempart $X + Y$ and $X - Y$

\solution{
These random variables are not independent.  For example:

\begin{eqnarray*}
\Pr(X + Y = 2)	& = &	\frac{1}{36} \\
\Pr(X - Y = 0)	& = &	\frac{1}{6} \\
\Pr(X + Y = 2 \cap X - Y = 0)
		& = &	\frac{1}{36} \\
		& \neq &	\frac{1}{36} \cdot \frac{1}{6}
\end{eqnarray*}
}

\problempart $\lfloor\frac{X-1}{2}\rfloor +
\lfloor\frac{Y-1}{2}\rfloor$ and $(X \bmod 2) + (Y \bmod 2)$

\solution{These random variables are independent.  The quantities
$\lfloor\frac{X-1}{2}\rfloor$ and $(X \bmod 2)$ are independent, and
so are the analogous expressions involving $Y$.

\begin{eqnarray*}
\Pr\left(\left\lfloor\frac{X-1}{2}\right\rfloor = a\right)
	& = &	\frac{1}{3} \quad \quad a \in \{0, 1, 2\} \\
\Pr\left(X \bmod 2 = b\right)	& = &	\frac{1}{2}
	\quad \quad b \in \{0, 1 \} \\
\Pr\left(\left\lfloor\frac{X-1}{2}\right\rfloor = a
		\ \cap \ X \bmod 2 = b\right)
	& = &	\frac{1}{6} \quad \quad a \in \{0, 1, 2\}, b \in \{0, 1 \} \\
	& = &	\frac{1}{3} \cdot \frac{1}{2}
\end{eqnarray*}


Thus, the above expressions involve four mutually independent random
variables; two are summed in the first expression and two are summed
in the second.  Consequently, the two expressions are independent.
}

\end{problemparts}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\problem {\bf (15 points)} Let $S$ and $T$ be independent random
variables with a countable range $R$.  Let $g$ be a function with
domain and range $R$.  Prove that $S$ and $g(T)$ are independent.

\solution{
We must prove that for all $x, y \in R$,

\begin{eqnarray*}
\Pr(S = x \cap g(T) = y)
	& = &	\Pr(S = x) \cdot \Pr(g(T) = y).
\end{eqnarray*}

Let $g^{-1}(y)$ be the set of all values that the function $g$ maps to
$y$.  Then the event that $g(T) = y$ is identical to the event that $T
\in g^{-1}(y)$.

\begin{eqnarray*}
\Pr\left(S = x \ \cap \ g(T) = y\right)
	& = &	\Pr\left(S = x \ \cap \ T \in g^{-1}(y)\right) \\
	& = &	\Pr\left(S = x \ \cap \ 
			\left(\bigcup_{z \in g^{-1}(y)} T = z \right)\right) \\
	& = &	\Pr\left(\bigcup_{z \in g^{-1}(y)} \left(
			S = x \ \cap \ T = z \right) \right) \\
	& = &	\sum_{z \in g^{-1}(y)} \Pr\left(S = x \ \cap \ T = z \right) \\
	& = &	\sum_{z \in g^{-1}(y)} \Pr(S = x) \cdot \Pr(T = z) \\
	& = &	\Pr(S = x) \cdot \sum_{z \in g^{-1}(y)} \Pr(T = z) \\
	& = &	\Pr(S = x) \cdot \Pr(T \in g^{-1}(y)) \\
	& = &	\Pr(S = x) \cdot \Pr(g(T) = y)
\end{eqnarray*}

The third step uses the fact that set intersection distributes over
set union.  The independence of $S$ and $T$ is used in the fifth
step.}

