Geogebra applet with 4 datapoints, fitting line with best square distance (from point to line)

square here, as well as in variance concept – is because distance can well be negative, but we need to be able to sum it neatly somehow, therefore square is rational with MMSE and variance