cachematrix.R filled to comply with week3 programming assignment