Functions to create, invert and cache a matrix.