update of cachematrix for Assignment 2