A point starts at the origin and can randomly go up, down, left, right (equally likely).
The question asks to write the expression of the point's position in terms of $x_1$ -units up, $x_2$ -units down, $x_3$ -units left, $x_4$ -units down, and its expected value $E(D^2)$ after $n$ moves.
After n moves I found the expression to be:
$$D^2=(x_4-x_3)^2+(x_1-x_2)^2$$
Now I need to find the expected value for $D^2$ and I am not sure how.
Note that $x_1 = \sum_{i=1}^n 1_{\text{up on move $i$}}$ and similarly for $x_2,x_3,x_4$. Expand the squares and take expected values.
You get terms like $E[x_1^2]$ and $E[x_1x_2]$.
We have $$ x_1^2 = \sum_{i\neq j }^n 1_{\text{up on $i$, up on $j$}} + \sum_{i=1}^n 1_{\text{up on $i$}} $$ so $$ E[x_1^2] = \sum_{i\neq j}^nP({\text{up on $i$, up on $j$}}) + \sum_{i=1}^n P({\text{up on $i$}}) = (n^2-n)\frac1{16} + n \frac14 $$ Use linearity of expectation. Note that going up on $i$ and up on $j$ are independent when $i\neq j$. Similarly, for $x_1x_2$ we have $$ x_1x_2 = \sum_{i\neq j} 1_{\text{up on $i$, down on $j$}} $$ so $$ E[x_1x_2] = (n^2-n)\frac1{16} $$ where there are no diagonal terms since you can't go up and down on $i$. Again going up on $i$ and down on $j$ are independent events for $i\neq j$.
You should have everything you need to solve the problem now.