matrix inverse and cache functions implemented