Normal equations for a straight line
Show that the values b_0 and b_1 minimising L(b_0,b_1)=\sum_{i=1}^n(y_i-b_0-b_1x_i)^2 are
b_1=\frac{\sum_{i=1}^n(x_i-\overline x)(y_i-\overline y)}{\sum_{i=1}^n(x_i-\overline x)^2}, \qquad b_0=\overline y-b_1\overline x,
and check that the critical point is a minimum.
\frac{\partial L}{\partial b_0}=-2\sum_{i=1}^n(y_i-b_0-b_1 x_i), \qquad \frac{\partial L}{\partial b_1}=-2\sum_{i=1}^n x_i(y_i-b_0-b_1 x_i).
Setting both to zero is the same as \sum(y_i-b_0-b_1 x_i)=0 and \sum x_i(y_i-b_0-b_1 x_i)=0. The first equation is n\overline y-nb_0-b_1 n\overline x=0, so b_0=\overline y-b_1\overline x. Substitute b_0 into the second equation. The residuals y_i-\overline y-b_1(x_i-\overline x) are orthogonal to the x_i, and therefore also to x_i-\overline x, which rearranges to
b_1\sum_{i=1}^n(x_i-\overline x)^2=\sum_{i=1}^n(x_i-\overline x)(y_i-\overline y).
The second-derivative matrix of L is positive definite when the x_i are not all equal, so the critical point is a minimum.