programming assignment 2, inverse matrix solving & caching