Gradient function of a quadratic function