I’m working through the following passage:
We will be interested in the variance of the portfolio returns given the variances of individual asset’s returns. If we have assets with returns $R_1,\ldots,R_n$, held in amounts $X_1,\ldots,X_n$ then we can compute the variance of the portfolio. $\newcommand{\myVar}{\operatorname{Var}}$
We proceed by direct computation. We seek the value of $$\myVar(R_P) = \myVar\left( \sum_{i=1}^n X_i R_i \right).$$ We compute $$ \begin{align*} \myVar\left( \sum_{i=1}^n X_i R_i \right) &= \myVar\left( \sum_{i=1}^n X_i (R_i - \mathbb E(R_i)) \right), \\ &= \mathbb E \left[\left( \sum_{j=1}^n X_j (R_j - E(R_j)) \right)^2\right], \\ &= \mathbb E\left( \sum_{i=1}^n X_i (R_i - \mathbb E(R_i)) \sum_{j=1}^n X_j (R_j - \mathbb E(R_j)) \right), \\ &= \sum_{i,j=1}^n X_i X_j\,\mathbb E(((R_i - \mathbb E(R_i))(R_j - \mathbb E(R_j))). \end{align*} $$ How do we even get the first step?
The first line is always true. it is a basic property of variances.
Note $X_i$ are fixed amount assets you wish to hold - i.e.constants
For any random variables $X,Y$, note $Cov(X,Y) = E(X-EX)E(Y-EY)=EX'EY'$, so where $X' = X-EX$ and $Y'=Y-EY$.
Now note $Cov(X',Y') = E(X'-EX')E(Y'-EY')=EX'EY'$, this is because $EX' = EX-E(EX) = 0$ and $EY'=0$
so we have
$Cov(X,Y) = Cov(X-EX, Y-EY)$ (1)
LHS of FIRST LINE = $\sum\limits_{i=1,j=1}^n X_iX_jCov(R_i,R_j)=\sum\limits_{i=1,j=1}^n X_iX_jCov(R_i-ER_i,R_j-ER_j)$ = RHS of FIRST LINE
where the equality in the middle used (1)