Implemented functions for finding matrix inverse