first edit of function

function to calculate inverse of matrix or retrieve it from cache if it
already exists.