adding cachematrix code for assignment