compute the derivative of x