add solution for cached matrix inverse implementation