I measured some 2D data, which when graphed follows a linear function. I want to fit this function and find the parameters $a$ and $b$ that best match the data. I am now trying to derive the formula for $a$ and $b$.
By using the sum of squares regression model I have been able to derive the following:
$a = \frac{\sum_{i = 1}^n{y_i} - nb}{\sum_{i = 1}^n{x_i}}$
$b = \frac{\sum_{i = 1}^n{y_i} - a\sum_{i = 1}^n{x_i}}{n}$
$x_i$ and $y_i$ being entries in the 2D data table, $n$ being the number of entries.
I was able to confirm that both of these do work, by inputting the real values of $a$ and $b$. But I am not able to fully derive $a$ and $b$ from these formulas as I have no idea what one should do with such cyclic definitions.