function finds the inverse of a matrix.
If matrix was calculated earlier it will return the inverse from cache.