added matrix inversion lemma