wrote functions which cache the inverse of matrix