cache inverse of matrix

Added implementation for inverse of matrix and caching the result. If
already computed inverse for a particular then, cached value is
returned.