Matrix Derivatives with an Application to an Adaptive Linear Decision Problem