Find the standard deviation of $|X−Y|$ 
Let $X$ and $Y$ be independent random variables with a Bernoulli Distribution $Ber(1/3)$. Find the standard deviation of $|X−Y|$.

The Standard Deviation in the square root of the variance. For a $Ber(1/3)$ the $Var(X)=Var(Y)=1/3(1-1/3)=2/9$, now how can I calculate $\sigma=\sqrt{Var(|X−Y|)}$? Because my idea was to subtract the two $Var$ but then the result will be $0$, but it should be $\frac{2\sqrt{5}}{9}$, how can I solve it?
 A: Hints: 


*

*$X$ could be $1$ and $Y$ could be $0$, or the other way round, or both $1$, or both $0$.  

*In the first two cases their difference would be $1$ while in the last two it would be $0$.  

*So $|X-Y|$ is another Bernoulli random variable, and you need to find the probability it is $1$ and then calculate the variance and take its square root 
A: \begin{equation}
|X-Y|= \begin{cases} 
1 & \text{iff} \quad  (X=1 \quad  \wedge\quad  Y=0)\quad  \vee \quad (X=0 \quad \wedge\quad  Y=1) \\
0 & \text{iff} \quad  (X=1 \quad  \wedge\quad  Y=1)\quad  \vee \quad (X=0 \quad \wedge\quad  Y=0)
\end{cases}
\end{equation}
So $|X-Y|$ is another Bernoulli random variable and 
$Pr(|X-Y|=1)=Pr(X=1)Pr(Y=0)+Pr(X=0)Pr(Y=1)=(1/3)(2/3)+(2/3)(1/3)=4/9=p$
and then 
$Var(|X-Y|)=(4/9)(5/9)=20/81 \implies SD=\sqrt{20/81}=(2\sqrt{5})/9$,
as required.
A: In general, let $X,Y\sim B(p)$. Refer to the table:
$$\begin{array}{c|c|c|c|c|c} X & P(X)&Y&P(Y)&|X-Y|&P(|X-Y|)&|X-Y|^2&P(|X-Y|^2)\\
\hline
0&q&0&q&0&q^2&0&q^2\\
0&q&1&p&1&qp&1&qp\\
1&p&0&q&1&pq&1&pq\\
1&p&1&p&0&p^2&0&p^2\\
\end{array}\\
\text{1-method}: |X-Y|\sim B(2pq); \\
Var(|X-Y|)=2pq\cdot (1-2pq).\\
\text{2-method}: Var(|X-Y|)=\mathbb E(|X-Y|^2)-[\mathbb E(|X-Y|)]^2=\\
2pq-[2pq]^2 =2pq\cdot (1-2pq).$$
A: The easiest thing is to use a table to obtain the distribution. 
The pdf of $|X-Y|$
$$\begin{array}{|c|c|c|c|} \hline X/Y & 0\left(p=\frac13\right)&1\left(p=\frac23\right)  \\ \hline 0\left(p=\frac13\right) & 0 &1 \\ \hline 1\left(p=\frac23\right) & 1 &0  \\ \hline \end{array}$$
Now you can use the well known formulas to obtain $Var(|X-Y|)$


*

*$E(|X-Y|)=\sum\limits_{x=0}^{1}\sum\limits_{y=0}^{1} |x-y|\cdot p(x,y)$

*$E(|X-Y|^2)=\sum\limits_{x=0}^{1}\sum\limits_{y=0}^{1} |x-y|^2\cdot   
   p(x,y)$

*$Var(Z)=E(Z^2)-E^2(Z)$
