In Residual Sum of Squares, why is $\sum(x_i-\hat{x})^2(y_i-\tilde{y})^2/\sum(x_i-\tilde{x})^2$ the minimizer for a in $y=ax+b$ and why is $\tilde{y}-a\tilde{x}$ the minimizer for $b$ when trying to solve for $a$ and $b$ when minimizing the residual sum of squares equation?
Residual Sum of Squares:
$\sum(y-\hat{y})^2$, where $\hat{y}$ is the prediction by a function and $y$ is the actual value.