wrote inverse matrix caching and solving functions