submitting assignment 2, edited functions to calculate inverse matrices