completed and tested code to create special matrix that can cache its in inverse