homework 2 - matrix operations