linear regression matrix formula derivation