first clean implementation week3 assignment (matrix inverse caching)