Solution (source code)

= Solution

Let $B$ be the $n\times m$ matrix of <factor loadings>, so $r=a+Bf$. A zero-cost <portfolio> $v$ with $\mathbf1^Tv=0$ and $B^Tv=0$ again has constant <financial payoff> $v^Ta$. Absence of <arbitrage> implies
$$
a\in\operatorname{col}[\mathbf1\ B],\qquad
a=\lambda_0\mathbf1+B\kappa.
$$
Taking <expectations> gives
$$
\boxed{\mathbb Er_i=\lambda_0+\sum_{j=1}^m b_{ij}\lambda_j,\qquad
\lambda_j=\kappa_j+\mathbb Ef_j.}
$$
If $[\mathbf1\ B]$ has full column <rank>, a unit-cost <portfolio> with zero exposure to all factors exists and earns the certain rate $\lambda_0$. For each $j$, choose a zero-cost <portfolio> with loading one on factor $j$ and zero on the others; its <expected return> is $\lambda_j$. Hence these coefficients are the rewards per unit systematic exposure, or factor <risk premiums>, with the <financial payoff> measured per unit of the chosen factor normalization. A traded <risk-free asset> fixes $\lambda_0$ to its return. Changing the scale or basis of the factors changes the coordinates of the <risk premiums> but leaves asset prices unchanged. With deficient <rank>, only the spanned factor directions are identified and the coefficients need not be unique.