Looked up the required matrix derivative.