The Algebra Of Least Squares