I'm not sure I understand your question, or, perhaps,

**why** you are asking. What you have done is correct:

The derivative of f(x), at

is, by definition,

.

Yes, for f(x)= |x|,

, we have to consider h< 0 and h> 0 separately because f(h)= h for h> 0, f(h)= -hf for h< 0.

So, for h> 0, we have

while, for h< 0,

. Those two "one-sided" limits are not the same so the "limit" itself does not exist. |x| is not differentiable at x= 0.

Now, for

,

, that becomes

Notice that the last "cancellation",

does NOT depend upon whether h is positive or negative, unlike the case with

which 1 or negative 1 depending upon whether h is positive or negative. Here, the "one sided limits", both "from above" and "from below", are 0. So the limit itself exists and is 0.