added code to cache matrix and inverse