Added two functions for matrix inverse