created funtions for cached inverse matrix