added function to inverse matrix