implemented matrix inverse caching for Programming Assignment 2