add code to implement matrix inverse