R code added for correctly getting, setting and inverting a matrix in cache