The Capital Asset Pricing Model

Given a portfolio comprised of portfolios $p$ and $q$ with variance
\begin{align}
\sigma_p^2 &=\mathbf{w}_p^T V \mathbf{w}_p\\
\sigma_q^2 &=\mathbf{w}_q^T V \mathbf{w}_q\\
\end{align}respectively, and covariance $\sigma_{pq}$ between portfolios $p$ and $q$
$$\sigma_{pq} =\mathbf{w}_q^T V \mathbf{w}_p =\mathbf{w}_p^T V \mathbf{w}_q$$
we can choose a market portfolio $m$ and any other feasible portfolio $q$ and define
$$\beta_q = \dfrac{\sigma_{qm}}{\sigma_m^2} = \dfrac{\mathbf{w}_q^T V \mathbf{w}_m}{\mathbf{w}_m^T V \mathbf{w}_m}$$
where $\sigma_{qm}$ is the covariance of portfolio $q$ with the market portfolio $m$. The market portfolio weight vector
\begin{align}
\mathbf{w}_m \; &= \dfrac{V^{-1}(\mathbf{e} \; – \; r_o \mathbf{1})}{\mathbf{1}^T V^{-1}(\mathbf{e} \; – \; r_o \mathbf{1})}\equiv \dfrac{1}{\gamma} V^{-1}(\mathbf{e} \; – \; r_o \mathbf{1}) \end{align}
where $$\gamma = \mathbf{1}^T V^{-1}(\mathbf{e} \; – \; r_o \mathbf{1})$$
We can express $\beta_q$ as
$$\beta_q = \dfrac{\sigma_{qm}}{\sigma_m^2} = \dfrac{\mathbf{w}_q^T V V^{-1}(\mathbf{e} \; – \; r_o \mathbf{1}) }{\mathbf{w}_m^T V V^{-1} (\mathbf{e} \; – \; r_o \mathbf{1}) }= \dfrac{\mathbf{w}_q^T (\mathbf{e} \; – \; r_o \mathbf{1}) }{\mathbf{w}_m^T (\mathbf{e} \; – \; r_o \mathbf{1}) }$$
as $VV^{-1} = I$ and $\gamma$ cancels out. We have already established that
$$\mu_q = \mathbf{w}_q^T\mathbf{e} \qquad\text{mean return on }q$$
and
$$\mathbf{w}_q^T \mathbf{1}= 1\qquad q\text{ is feasible}$$By the same token
$$\mu_m = \mathbf{w}_m^T\mathbf{e} \qquad\text{mean return on }m$$
$$\mathbf{w}_m^T \mathbf{1}= 1\qquad m\text{ is feasible}$$
It follows that
$$\beta_q = \dfrac{\mu_q \; – \; r_o}{\mu_m \; – \; r_o}$$
that is,
$$\mu_q = r_o \; + \;\beta_q (\mu_m \; – \; r_o)$$
This is the ubiquitous Capital Asset Pricing Model. Now, a single asset $i$ can be viewed as a trivial feasible portfolio. Hence,
$$\mu_i = r_o \; + \;\beta_i (\mu_m \; – \; r_o)$$
with
$$\beta_i = \dfrac{\sigma_{im}}{\sigma_m^2}$$
This is obviously for the mean returns (expected returns) of asset $i$. We can express this for real returns by adding in a random error term $\varepsilon_i$
$$r_i = r_o \; + \;\beta_i (r_m \; – \; r_o)+\varepsilon_i$$