Adding solution code to cachematrix.R

Committing solution code for Programming assignment 2