implemented cached matrix for assignment 3 in R coursera course.