Can someone please explain what I am missing here? Let $\mathbb{E}[X_iX_j] = \sigma_w^2 + \sigma_y^2$. $$\mathbb{E}[\sum_{i=1}^n X_i^2] = \mathbb{E}[(X_1+X_2+\cdots+X_n)(X_1+X_2+\cdots+X_n)] $$ $$\mathbb{E}[\sum_{i=1}^nX_i^2 + \sum_{i \neq j}X_i X_j]$$ I can't see where the RHS comes from in the next line:
$$n(\sigma^2_w + \sigma_y^2) + \color{red}{n(n-1)}(\sigma_w^2 + \sigma_y^2) $$
Should it not just be $(n-1)(\sigma_w^2 + \sigma_y^2)$ ? Why the extra $n$
In that second sum, you are summing over all $i\ne j$. When you sum over all $i\ne j$, you are looking at all ordered pairs $(i,j)$ where $i$ and $j$ come from $\{1,2,\ldots, n\}$ and $i\ne j$. The number of such pairs is $n(n-1)$, since there are $n$ choices for $i$, and then for each choice of $i$, there are $n-1$ choices for $j$ (since $j$ cannot equal $i$).