Why is this derivative not undefined at a given point? I'm working on a problem from Keisler's Calculus (not homework, for my own amusement.) One of the problems is confusing me a bit. The first part goes like this:

Suppose $g(x)$ is differentiable at $x = c$ and $f(x)=|g(x)|$. Show that:
$$f'(c)= 
\begin{cases}
g'(c) &amp; \text{if }g(c)&gt;0  \\ 
-g'(c) &amp; \text{if }g(c)&lt;0
\end{cases} $$

Easy enough:
$$\frac{d(f(x))}{dx}=\frac{d(|g(x)|)}{dx}$$
$$f'(x)=\frac{d(\sqrt{g(x)^2})}{dx}$$
$$f'(x)=\frac{g(x)g'(x)}{|g(x)|}$$
Plugging $c \text{ and } g(c)$ into the above yields the desired result. The second part of the problem is where I get confused. It goes like so:

Prove that $f'(c)=0 \text{ if } g(c)=0 \text{ and } g'(c)=0$.

Prove that $f'(c)$ does not exist if $g(c) = 0 \text{ and } g'(c) \ne 0$.

Shouldn't the derivative not exist in either case since division by zero occurs in both? What am I misunderstanding here?
If $g(c) = g'(c) = 0$, we have $\lim_{x \to c} { g(x) \over x-c} = 0$ and
$\lim_{x \to c} { -g(x) \over x-c} = 0$, so by continuity of the $\max$ function, we have $\lim_{x \to c} { \max({|g(x)| \over x-c},-{|g(x)| \over x-c} )} = \lim_{x \to c} { |g(x)| \over x-c} = 0$.

If $g(c) =0$, and $ g'(c) \neq 0$, first show that in some neighbourhood of $c$, we have $g(x) \neq 0$ for $x \neq c$, and that $g$ has one  sign in $(c-\epsilon,c)$ and the opposite sign in $(c, c+ \epsilon)$.
Then show that $\lim_{x \uparrow c} { f(x) \over x-c} = 0$ and
$\lim_{x \downarrow c} { f(x) \over x-c}$ are different.
for the first proof:

let g(c)=0 and g'(c)=0. 

There are three cases:

case 1:
   0 is a local maximum for g(x) (g(x) lies below the x-axis)

case 2: 
   0 is a local minimum for g(x) (g(x) lies above the x-axis)

case 3:
   0 is neither a local minimum nor a local maximum for g(x), which means (which is like the graph of y=x^3 near x=0)

Analyze case 1:

0 is a local maximum for g(x)
   -->for some g on the interval [a,b], g&lt;=0
   -->f(x)=abs(g(x)) on the interval [a,b] is equal to -g(x) on that interval
   if the derivative g(x) is called g'(x) on [a,b], then the derivative of -g(x)=f(x) with respect to x is -g'(x) by chain rule. 
   -->if g'(c)=0, then f'(c)=-g'(c)=0 
QED for case 1

Case 2 is basically the same proof

Case 3:

 if 0 is neither a maximum nor a minimum on on g(x) at x=c,
 then we can conclude that there exists an interval

   [a,c] for which g&lt;=0

   [c, b] for which g&gt;=0

   (there are actually two cases. this one is just for g as an increasing function around x=c)

   on [a,c] where g&lt;=0, f(x)=-g(x). f'(x)=-g'(x). you need to prove that the lim (x--&gt;c-) f'(x)=0

   on [c,b] where g&gt;=0, you need to prove that lim(x--&gt;c+)f'(x)=0

   therefore, lim(x--&gt;c)f'(x)=0

   I think you have to prove that f(x) is continuous at x=c. then it gives you that f'(c)=0


=======

Hope this helps. Good luck! :)