First, I apologize if I am violating any community laws or have improper tags I am a newbie. However, I am tasked with showing,
$$RSS(\boldsymbol{\beta}) = \sum_{i=1}^{N} (y_i - \beta_0 - \sum_{j =1}^{n}\beta_{j}x_{ij})^2$$
to be written in matrix form as $$RSS(\boldsymbol{\beta}) = (\boldsymbol{y} - \boldsymbol{X}\boldsymbol{\beta})^T (\boldsymbol{y} - \boldsymbol{X}\boldsymbol{\beta})$$
I just want to ensure my thought process is accurate or if you can point me in the right direction.
My solution:
Let $\boldsymbol{y}$ be a column vector of size $N \times 1$. Let $\boldsymbol{\beta}$ be a column vector of size $(n+1) \times 1$. Finally, let $X$ be a matrix of size $N \times (n+1)$ then,
$$X \boldsymbol{\beta}=\begin{bmatrix} 1 & x_{11} & x_{12} & \dots & x_{1n} \\ 1 & x_{21} & x_{22} & \dots & x_{2n} \\ \vdots & \vdots & \vdots & \vdots & \vdots \\ 1 & x_{N1} & x_{N2} & \dots & x_{Nn} \end{bmatrix} \cdot \begin{bmatrix} \beta_0 \\ \beta_1 \\ \vdots \\ \beta_n \end{bmatrix} = \begin{bmatrix} \beta_0 + x_{11}\beta_1+ x_{12}\beta_2+...+x_{1n}\beta_n \\ \beta_0 + x_{21}\beta_1+ x_{22}\beta_2+...+x_{2n}\beta_n \\ \vdots \\ \beta_0 + x_{N1}\beta_1 + x_{N2}\beta_2+...+x_{Nn}\beta_n \end{bmatrix}$$
Resulting in a $N \times 1$ column vector containing our predicted values. Then we can find the residuals as such,
$$ u = \boldsymbol{y} - X\boldsymbol{\beta}$$ where $u$ is an $ N \times 1$ column vector.Therefore, we can rewrite the Residual Sum of Squares in matrix form as follows,
$$RSS(\boldsymbol{\beta}) = (\boldsymbol{y}-X\boldsymbol{\beta})^T(\boldsymbol{y} - X\boldsymbol{\beta}) = u^Tu$$. Since $(\boldsymbol{y}-X\boldsymbol{\beta})$ is a column vector we need to transpose it to multiply it by itself.