In this video, at 31:12, the following equality pops up:
$(\mathbf{y}-\mathbf{X}\mathbf{\theta})^T(\mathbf{y}-\mathbf{X}\mathbf{\theta})=\sum\limits_{i=1}^n(y_i-\mathbf{x}_i^T\mathbf{\theta})^2$
From the previous slides in the same video, it looks like $\mathbf{y}$ and $\mathbf{\theta}$ are column vectors. So in order for the equality to make sense, $\mathbf{x}_i$ should be column vectors (so that their transposes are row vectors, which can be multiplied with the column vector $\mathbf{\theta}$).
I've tried an example, but am not getting that it holds.
$\mathbf{\theta}=\begin{pmatrix} 2 \\ 1 \end{pmatrix}$
$\mathbf{y}=\begin{pmatrix} 1\\ 2\end{pmatrix}$
$\mathbf{X}=\begin{pmatrix} 1&3\\2&4\end{pmatrix}$.
$\mathbf{X\theta}=\begin{pmatrix}5 \\8\end{pmatrix}$
$\mathbf{y}-\mathbf{X\theta}=\begin{pmatrix}-4 \\-6\end{pmatrix}$
So the LHS is equal to $-4\times -4+-6\times-6=52$.
\begin{align}(y_1-\mathbf{x}_1^T\mathbf{\theta})^2&=\big(1-\begin{pmatrix}1&2\end{pmatrix}\begin{pmatrix}2\\1\end{pmatrix}\big)^2=9\\ (y_2-\mathbf{x}_2^T\mathbf{\theta})^2&=\big(2-\begin{pmatrix}3&4\end{pmatrix}\begin{pmatrix}2\\1\end{pmatrix}\big)^2=64 \end{align}
So the RHS equals $73$. Why aren't these values equal?