\begin{equation*}
\sum_{i = 1}^{n} e_i^2 = \sum_{i = 1}^{n} (y_i – \mathbf{x’_i b_0})^2
\end{equation*}
In matrix terms,
\begin{equation*}
\mathbf{e’e} = \mathbf{(y – Xb_0)’ (y – Xb_0)}
\end{equation*}
Expanding gives
\begin{equation*}
\mathbf{e’e} = \mathbf{y’y – b’_0X’y – y’Xb_0 + b’_0X’Xb_0}
\end{equation*}
keep in mind that the transpose of a scalar is a scalar! hence
\begin{equation*}
\mathbf{y’Xb = (y’Xb)’ = b’X’y}
\end{equation*}
therefore,
\begin{equation*}
\mathbf{e’e} = \mathbf{y’y – 2b’_0X’y + b’_0X’Xb_0}
\end{equation*}