Update cachematrix.R

Edited the existing cachematrix.R program file so that it now contains the code that I have written as part of my assignment submission for  R Programming course at Coursera. The above code demonstrates lexical scoping at work.