Completed code for caching inverse of a matrix