Edited cachematrix Function

Edited cache matrix function according to assignment.