Derivation Of Least Squares Formula