Functions to create special matrix and cache its inverse