I'm looking into how linear regression is derived following these steps. I'm curious to how the sum is included in some terms but not others.
Just to note, this is a question regarding finding the derivative not linear regression
What we want to do find the minimum for the following equation.
$ε^2 = Σ (m^2x_{i}^2 + 2mbx_{i} - 2mx_{i}y_{i} + b^2 - 2by_{i} + y_{i}^2)$
So we want to find when the following two derivates in terms of m and b:
$\frac{dε^2}{dm} = 0 = 2mΣx_{i}^2 + 2bΣx_{i} - 2Σ(x_{i}y_{i})$
$\frac{dε^2}{db} = 0 = 2mΣx_{i} + 2Σb - 2Σy_{i}$
My question is when we are taking the derivative in terms of m, the term
$2mbx_{i}$ becomes $2bΣx_{i}$
but when taking the derivative in terms of b, the term
$b2$ becomes $2Σb$
What I'm failing to understand is why sum is not applied to the b term in the derivative of m but it is in the derivative of b.
Because in the first one you are taking derivative w.r.t. to $m$ thus $b$ is a constant for $m$ so derivative of $2mb\sum x_i$ becomes $2b\sum x_i$
but in the second case as you mentioned you are taking derivative w.r.t. $b$
thus $m$ is treated as constant $\sum b^2$ becomes $2\sum b $