finished the inverse matrix functions