added function to test matrix inverse