it's the age old least-squares problem:
Find the value of b for which the following sum has the minimum value (assuming that x and y are one-dimensional vectors of the same length):
$$ \sum_{i=1}^n (y_i - bx_i)^2 = min $$
This must have been asked before but I can't find it, would appreciate a redirect from somebody thanks
Hint: Differentiate with respect to $b$ and equate to $0$.