# RSS for Simple Linear Regression

The book Introduction to Statistical Learning by Gareth James et. al. states that a simple linear regression can be modeled as $$\hat{y}_i=\hat{\beta}_0 + \hat{\beta_1}x_i$$. The residuals are calculated $$e_i=y_i-\hat{y}_i$$.

They then go on to define the residual sum of squares as:

$$RSS=e_1^2+e_2^2\dots e_n^2$$

or equivalently as

$$RSS=(y_1 - \hat{\beta}_0 - \hat{\beta_1}x_1)^2 + (y_2 - \hat{\beta}_0 - \hat{\beta_1}x_2)^2 +\dots+(y_n - \hat{\beta}_0 - \hat{\beta_1}x_n)^2$$

My question is if $$\hat{y}_i=\hat{\beta}_0 + \hat{\beta_1}x_i$$, then why when they substitute into the RSS equation above do I see that it is equal to $$\hat{y}_i=\hat{\beta}_0 - \hat{\beta_1}x_i$$? Does it not matter because it is being squared? It just seems like for clarity you would substitute it exactly as you just previously defined it. I do not see anything in the errata. Is this a typo or does it just not matter?

$$e_i = y_i - \hat{y}_i = y_i - ( \hat{\beta}_0 + \hat{\beta_1}x_i ) = y_i - \hat{\beta}_0 - \hat{\beta_1}x_i$$