least squares and solving system of linear eqs