Update cachematrix for programming assignment 2.