# Calculate $E(Y)$ where $Y = |X_1 - X_2|$ and $X_1$ and $X_2$ are two independent observations of $X.$

A discrete random variable $X$ takes the values $-2,0$ and $2$ only, with probabilities $p,q$ and $2p$ respectively. Let $X_1$ and $X_2$ be two independent observations of $X$ and $Y = |X_1 - X_2|.$

Question: Calculate $E(Y).$

My attempt:

I obtain the probability distribution of $Y.$ \begin{array}{c|c|c|c} y & 0 & 2 & 4\\\hline P(Y=y) & 3p^2+q^2 & 5pq & 4pq \end{array}

So $E(Y) = 26pq.$ However, answer given is $1.6.$ The only equation I have is $3p + q = 1.$ But this does not help in finding values of $p$ and $q.$

Any help is appreciated.

## 2 Answers

Your calculations are a bit awry.

${P(Y=0)~{= P(X_1=X_2) \\= p^2+q^2+4p^2 \\ = 5p^2+q^2}\\[2ex] P(Y=2)~{=P(X_1=-2, X_2=0)+P(X_1=0, X_2\in\{-2,2\})+P(X_1=2,X_2=0)\\=pq+q(p+2p)+2pq\\=6pq} \\[2ex] P(Y=4)~{= P(X_1=-2,X_2=2)+P(X_1=2,X_2=-2) \\= 4p^2} }$

Thus $\mathsf E(Y) ~{= (12q+16p)p\\= (12(1-3p)+32p)p\\ = 12p-4p^2 }$

Which admittedly doesn't help get a strictly numerical answer unless you have some other way to evaluate $p$.

However, it does mean that to obtain $1.6$ would require $p\approx 0.139853$ and I don't see how that would be determined from what you've told us about the problem.

tl;dr $1.6$ does not look like an appropriate answer to the problem.

Note that $p$ can be anywhere in $[0,1/3]$.

$Y=4$ if the signs of $X_1$ and $X_2$ are opposite, is $2$ if exactly one is equal to $0$, and is zero otherwise.

Therefore ($q=1-3p$):

$$E[Y] = 4\times 2\times 2p^2 + 2\times 2\times (1-3p)3p=4p(3-5p).$$

Let's look at possible values of $E[Y]$. Clearly it's always nonnegative.

-When $p=0$, $E[Y]=0$ (because $X=0$ a.s.). -The maximum of $4p(3-5p)$ over all $p\in [0,1]$ is attained halfway between the two roots $0$ and $3/5$, that is at $p=3/10$. Since this choice of $p$ is in the allowed range for $p$, $[0,1/3]$, the maximal value for $E[Y]$ is $\frac{12}{10}(3-\frac{15}{10})=1.8$.

Bottom line, $E[Y]$ can attain any value in $[0,1.8]$ and only values in this interval.