Reading a section on simple regression in "An Introduction to Statistical Learning with Applications in R" I got a question on residual sum of squares minimization. Quoting from the book:
... simple linear approach for predicting a quantitative response $Y$ on the basis of a single predictor variable $X$. It assumes that there is approximately a linear relationship between $X$ and $Y$ . Mathematically, we can write this linear relationship as $$Y \approx b_0 + b_1X$$ You might read $\approx$ as "is approximately modeled as".
Once we have used our coefficient parameter training data to produce estimates $\hat b_0$ and $\hat b_1$ for the model coefficients, we can predict future ... by computing $$\hat y = \hat b_0 + \hat b_1 x, $$ where $\hat y$ indicates a prediction of $Y$ on the basis of $X = x$. Here we use a hat symbol '^' to denote the estimated value for an unknown parameter or coefficient, or to denote the predicted value of the response.
In practice, $b_0$ and $b_1$ are unknown. So before we can ... make predictions, we must use data to estimate the coefficients. Let $(x_1, y_1), (x_2, y_2), . . . , (x_n, y_n)$ represent n observation pairs, each of which consists of a measurement of $X$ and a measurement of $Y$.
Let $\hat y_i = \hat b_0 + \hat b_1x_i$ be the prediction for $Y$ based on the ith value of $X$. Then $e_i = y_i - \hat y_i $ represents the ith residual ... this is the difference between the $ith$ observed response value and the $ith$ response value that is predicted by our linear model. We define the residual sum of squares $(RSS)$ as $$RSS = e^2_1 + e^2_2 + ... + e^2_n$$, or equivalently as $$ RSS = (y_1 - \hat b_0 - \hat b_1 x_1)^2 + (y_2 - b_0 - b_1 x_2 )^2 + ... + (y_n - b_0 - b_1 x_n )^2$$
The least squares approach chooses $b_0$ and $b_1$ to minimize the $RSS$. Using some calculus, one can show that the minimizers are:
$$ \hat b_1 = \frac {\sum_{i=1}^{n} (x_i - \bar{x}) (y_i - \bar{y}) } {\sum_{i=1}^{n} (x_i - \bar{x})^2} $$
$$ \hat b_0 = \hat y - \hat b_1 \bar{x} $$
$$ \hat y = \frac {1}{n} \sum_{i=1}^{n} y_i $$
$$ \hat x = \frac {1}{n} \sum_{i=1}^{n} x_i $$
So my question is: What book has a detailed calculus showing how we get the above minimizers?
Please also advise a good textbook on least squares and regression in general.