Added code for cache matrix

Created the function for caching the matrix