Completed matrix functions for assignment

This commit is for the completed functions for the inverse caching
matrix assignment for coursera.