Correlation between two assets

Textbook says correlation between two assets is Beta_1*beta_2*(stdev_M)^2/(stdev_1*stdev_2) Does anyone know how this is derived? Thanks.

Where is this from? cov(1,2)=rho(1,2)*sd1*sd2 cov(1,2)=b1*b2*sd_M^2 From the above two equations, the correlation rho(1,2) is derived.