completed exercise cachematrix.R