Solution for programming assignment 2 - cached matrix inverse