Implemented cached solve function

Edited code stub to cache the inverse of a matrix