inverse/cache matric functions for programming assignment #2