Completed homework assignment for caching of inverse matrix.