derivative of |x^2-1| using chain rule