Saving function to inverse matrix