started a function that inverts a matrix