Let’s see how this works in more detail, by constructing a portfolio that contains two stocks and then calculating its mean and variance. Let’s put a fraction xA of our portfolio in stock A and the rest xB in stock B. We call xA and xB the weights on assets A and B in our portfolio and we know these weights xA and xB sum to one. To calculate the mean and variance of our portfolio, we will again need to think of future log returns as random variables, that is as quantities that can take a variety of values with different probabilities. You can think of returns, at a future time as being indexed by i, where i is a possible scenario or alternate timeline of the future. R the log return, takes different values for different scenarios and different scenarios have different probabilities of occurring. The expected value of R, which we referred to before as the mean or expected log return, is given by this formula. The total return of the portfolio in each scenario is just the weighted sum of the returns of each individual asset. The expected value of the portfolio return, equals the weighted sum of the individual stock’s expected returns. To see this, we take the expected value of the portfolio returns. The summation symbol distributes across the sum, then we can pull out the weights because they are independent of scenario. Finally, we see that each term is the expected value of the individual asset.