# Consider two random variables X and Y

Consider two random variables $$X$$ and $$Y$$. If X and Y are independent random variables, then it can be shown that: $$E(XY) = E(X)E(Y).$$

Let $$X$$ be the random variable that takes each of the values $$-􀀀1\!\!\!$$, $$0$$, and $$1$$ with probability $$1/3$$. Let $$Y$$ be the random variable with value $$Y = X^2$$.

Prove that $$X$$ and $$Y$$ are not independent.

Prove that $$E(XY) = E(X)E(Y)$$.

I understand that $$E(XY) = E(X^3)$$ since $$Y = X^2$$ so that makes each side of the equation equal to zero.

But I am not sure how to go about proving that $$X$$ and $$Y$$ are not independent.

• Since Y is a function of X, they are not independent. i.e. if you know X, then you know Y as well. So, they are not independent. – user146290 Apr 5 '15 at 22:35
• @user146290 it not always necessarily true if $Y$ is a function of X then $X$ and $Y$ are independent not independent. if the function is injective this will always be the case, but what if $X$ only took values 1, -1 with probability 1/2 and $Y=X^2$ here Y and X are independent. The intuition is that the value of X has to tell us information about what may be the value of Y to be not independent which is not necessarily true for all functions – Kamster Apr 6 '15 at 1:20

$P(X=-1) = P(X=0) = P(X=1) =\frac{1}{3}$

$Y = X^2$ so $P(Y=1) = \frac{2}{3}$ and $P(Y=0) = \frac{1}{3}$ . $Y$ equals zero iff $X$ equals 0. But $Y$ equals 1 if $X$ is $1$ or $-1$.

$$E[X] = -1.\frac{1}{3} + 0.\frac{1}{3} + 1.\frac{1}{3} = 0$$ $$E[Y] = 1.\frac{2}{3} + 0.\frac{1}{3} = \frac{2}{3}$$

$$E[XY] = E[X^3] = E[X] = 0$$

The last equality holds because $X$ takes only values in $[-1.0.1]$ Thus, $$E[XY] =E[X]E[Y]=0$$

But, are $X,Y$ independent?

For $X,Y$ to be independent $P(X=x, Y=y) = P(X=x) P(Y=y)$ where $x \in [-1,0,1]$ and $y \in [0,1]$.

Let's consider $x=1 \implies y=1$ so $P(X=1, Y=1)=\frac{1}{3}$ while $P(X=1)P(Y=1) = \frac{1}{3}.\frac{2}{3} = \frac{2}{9} \neq P(X=1, Y=1)$

Hint: By the definition of independence, two discrete random variables $X$ and $Y$ are independent if the joint probability mass function $P(X = x \text{ and } Y = y )$ satisfies $$P(X = x \text{ and } Y = y ) = P(X = x) \cdot P(Y = y)$$ for all $x$ and $y$.

What are the possible values $x$ for the random variable $X$ in your example? What are the possible values $y$ for $Y$? If your $X$ and $Y$ are not independent, then you should be able to find an $x$ and $y$ pair that violates the above condition.

Let $M_X(t)$ and $M_Y(t)$ be the moment generating functions of $X$ and $Y$, respectively. Then

\begin{align*} M_X(t) &= \mathbb E[e^{tX}]\\ &= e^{-t}\mathbb P(X=-1) + \mathbb P(X=0) + e^t\mathbb P(X=1)\\ &= \frac13 e^{-t} + \frac13 + \frac 13 e^t\\ &= \frac13(e^{-t} + 1 + e^t) \end{align*} and \begin{align*} M_Y(t) &= \mathbb E[e^{tY}]\\ &= \mathbb P(Y=0) + e^t\mathbb P(Y=1)\\ &= \frac13 + \frac 23 e^t\\ &= \frac13(1 + 2e^t). \end{align*} Let $Z=X+Y$. Then \begin{align*} \mathbb P(Z=n) &= \mathbb P(X+Y= n)\\ &=\mathbb P(X+X^2 = n)\\ &=\mathbb P(X(X+1)=n)\\ &=\begin{cases} \frac23,& n=0\\ \frac13,& n=2. \end{cases} \end{align*} The moment generating function of $Z$ is \begin{align*} M_Z(t) &= \mathbb E[e^{tZ}]\\ &= \frac23 + \frac13 e^{2t}\\ &= \frac13(2 + e^{2t}) \end{align*} while \begin{align*} M_X(t)M_Y(t) &= \frac13(e^{-t}+1+e^t)\frac13(1+2e^t)\\ &= \frac19(e^{-t}+3+3e^t+2e^{2t}). \end{align*} Since $M_Z(t)\ne M_X(t)M_Y(t)$, we conclude that $X$ and $Y$ are not independent.