wrote and commented on functions for caching matrices