Finish hw2: cachematrix