I'm stuck on the following problem.
Consider three independent Bernoulli random vectors $x,y,w$ of length $n$, where each entry follows the Bernoulli distribution $B$ with $P(B=0)=P(B=1)=\frac{1}{2}$.
$\langle x,w \rangle$ denotes the standard scalar product and, in this case, just counts the number of positions i = 1,...,n, where both entries are 1.
Let $X := \langle x,w \rangle$ and $Y := \langle y,w \rangle$. Clearly, $\mathbb{E}(X) = \mathbb{E}(Y) = \frac{n}{4}$.
Now, I'm interested in the random variable $Z := (X-Y)^2$ and in particular in the value of $\mathbb{E}(Z)$ as a function of $n$.
I have trouble evaluating this, because $X$ and $Y$ are not independent. I have tried to condition on $w$ and using the normal approximation of the binomial distribution, but didn't get anywhere.
When $n=1$ the expectation is $\frac14$ as there are $8$ equally likely combinations, two of which give $1$ and the other six give $0$
For $n>1$ each index's contribution is independent of the others, as the expectation of the difference is $0$ and they are identically distributed, and there are $n$ values of the index. So this is like adding variances.
So the overall expectation is $\dfrac n4$.