linear regression matrix formulation