Created functions to get and cache inverse of matrix.