<s>[INST] Expectation and variance of the squared distance between $X$ and $Y$ Given that $X$ and $Y$ are two independent univariate random variables sampled uniformly from the unit interval [0,1]. I am trying to find the expected value and the variance of the random variable $Z = \mid X - Y  \mid ^2 $ (the squared distance between $X$ and $Y$.
So far, I'm assuming that $X$ and $Y$ are uniformly distributed and this is what I have: 
\begin{align}
Z &= \mid X - Y\mid ^2  \\
Z &= \mid X^2 - 2XY + Y^2 \mid \\
E[Z] &= \mid E[X^2] - 2E[XY] + E[Y^2]\mid \\
&= \mid E[X^2] - 2E[X]E[Y] + E[Y^2]\mid \\
&= \frac{1}{3}\frac{1}{b-a}(b^3-a^3)-2(\frac{a+b}{2})(\frac{a+b}{2})+\frac{1}{3}\frac{1}{b-a}(b^3-a^3)
\end{align}
But I am not sure if this is the right approach or the right direction and what is E[Z] = $\mid X - Y\mid ^2$. If so, can I do something similar to the variance?
 [/INST] Variace is $E[(X-Y)^4] -[E[(X-Y)^2]]^2$

=$ E(X^4) + E(Y^4) + 6E(X^2)E(Y^2) -4E(X^3)E(Y) - 4E(X)E(Y^3) -\frac{1}{36}$

= $\frac{2}{5} + \frac{6}{9} - 1 - \frac{1}{36}$

=$\frac{7}{180}$
</s>