# Finding the Zero Residual Line with Centroid

I need help with finding the zero residual line of three points: A = (3, 1), B = (1,5), and C = (6, 4).

I learned that the zero residual line can pass through the centroid when you are given three points and I found the centroid to be ($\frac{10}{3}, \frac{10}{3}$) by finding the average of the x-coordinates and the y-coordinates separately. I also thought about finding the equation for line $BA$ and, in point-slope form, I got that to be $y - 5 = -2(x - 1)$. I thought about having a line that goes through the centroid and is parallel to line BA, which would be $y - \frac{10}{3} = -2(x - \frac{10}{3})$. However, when I find the residuals, I don't get their sum to be zero, so I am assuming that the equation for the zero residual line is incorrect. Therefore, I want to know where I am wrong and what can I do to fix it.

If we consider a line with equation $y=f(x)=ax+b$ we can minimize $$\left(f(3)-1\right)^2+\left(f(1)-5\right)^2+\left(f(6)-4\right)^2$$ i.e. the quadratic form $$q(a,b)=42 - 64 a + 46 a^2 - 20 b + 20 a b + 3 b^2$$ with respect to $a$ and $b$. By setting $\frac{\partial q}{\partial a}=\frac{\partial q}{\partial b}=0$ we get the system of equations $$\left\{\begin{array}{rcl}92 a + 20 b &=& 64 \\ 20 a + 6 b &=& 20 \end{array}\right.$$ with the solution $a=-\frac{2}{19}, b=\frac{70}{19}$.
In such a case $\left(f(3)-1\right)+\left(f(1)-5\right)+\left(f(6)-4\right)=0$ and the line found this way goes through the centroid of $(3,1),(1,5),(6,4)$, namely the point $G\left(\frac{10}{3},\frac{10}{3}\right)$. 