On Differentiating a Matrix