included my code and explanation to the cachematrix.R file