Added functions to calculate and cache inverse of a matrix