Wrote the code to invert a matrix and cache it.