Added my solution for inverting matrix and keeping it in cache