Wrote function for caching matrix inverse