I was studying Linear Regression and while I was working on the cost function, the notes proposed two formulas for it. I have attached the image of the two formulas.
My question is that the latter is supposedly JUST the matrix notation of the Cost function. However, when I tried them out with some values, the Matrix notation only gives me the SUM OF THE LOSSES and doesn't mean them. Why is this the case? shouldn't both be equivalent to each other?
I am new to this topic myself, but I have an idea about why the book may consider the two to be identical.
When we multiply the sum in the first equation by a scalar, we are not changing the characteristics of the cost function in a meaningful way. Yes, the entire cost function is scaled by a factor of $\frac{1}{n}$, but such a scaling does not change the value of $\mathbb{\theta}$ for which the cost function is minimum. Since in cost function analysis we are primarily concerned with which solution is the least expensive, not how expensive it is, the difference between the two equations doesn't really matter.