Hi Martin, Thanks for asking about that: I made a note to clarify this non-obvious step on revision.
It applies property of covariance http://en.wikipedia.org/wiki/Covariance
... specifically: COV(aX + bY, cW + dV) = ac*COV(X,W) + ad*COV(X,V) + bc*COV(Y,W) + bd*COV(Y,V)
... not in Gujarati per se but generalizes from Gujarati's properties
... and we are here simplistically only using two assets where both the portfolio and the market are two-asset portfolios.
a = %weight Asset A in Market Portfolio M
b = %weight Asset B in Market Portfolio M; i.e, b = 1 - a
c = %weight Asset A in Portfolio P
d = %weight Asset B in Portfolio P; i.e., d = 1 -c
Ra = Return (Asset A)
Rb = Return (Asset B)
Unrealistically, both portfolios P & M are 2-asset portfolios, same assets, but different mixes:
Return (Market Portfolio M) = a*Ra + b*Rb
Return (Portfolio P) = c*Ra + d*Rb
Cov (M, P) = Cov(a*Ra + b*Rb, c*Ra + d*Rb), and per the above covariance property
= a*c*Cov(Ra,Ra) + a*d*COV(Ra,Rb) + b*c*COV(Rb, Ra) + b*d*COV(Rb, Rb)
...since COV(Ra,Ra) = variance (Ra) and COV(Rb,Rb) = variance(Rb)!
= ac*variance(Ra) + bd*variance(Rb) + covariance(Rb,Ra)*[ad + bc]