At $x = 3$, the function given by $f\left(x\right) =\begin{cases} x^2, & x < 3 \\ 6x-9, & x\geq 3 \end{cases}$ is?

$1$. undefined
$2$. continuous but not differentiable
$3$. differentiable but not continuous $\color{red} {Not\, possible}$
$4$. neither continuous nor differentiable
$5$. both continuous and differentiable

The book says $2$. But I think it is wrong, because derivative existed for both functions and is the same at $x=3$.

$\dfrac{\mathrm{d}}{\mathrm{d}x} x^2\vert_{x=3} = 2\left(3\right) = 6$ and $\dfrac{\mathrm{d}}{\mathrm{d}x} 6x-9 = 6$

-
I think you are right. – Patrick Li Jan 19 '13 at 2:42
You are right, but its not enough the derivatives exist at both functions. They have to be the same as well. (And the function has to be continuous there, but I think you got that). – zrbecker Jan 19 '13 at 2:57

The function is differentiable at $3$. The reason you give is intuitively reasonable. In principle it is not enough. Formally, you should prove that $$\lim_{x\to 3^-}\frac{f(x)-9}{x-3}=\lim_{x\to 3^+}\frac{f(x)-9}{x-3}.$$

-
why do you disagree with @JonasMeyer – yiyi Jan 20 '13 at 6:06
@MaoYiyi: I do not disagree with Jonas Meyer. He went into greater detail by actually computing $\frac{f(x)-9}{x-9}$ for $x\lt 3$ and $x\gt 3$. (He called $x$ by the better name $3+h$, which I avoided in order to leave a little more to do.) – André Nicolas Jan 20 '13 at 6:17
I missread JonasMeyer's last line, didn't see the prime – yiyi Jan 20 '13 at 6:24

$\dfrac{f(3+h)-f(3)}{h}=\begin{cases} 6+h, & h<0 \\ 6, & h>0 \end{cases}.$

Hence $\lim\limits_{h\to 0}\dfrac{f(3+h)-f(3)}{h}=6$, so $f'(3)$ exists and equals $6$.

However, the function $f'$ (which is defined everywhere) is not differentiable at $3$.

-
JonasMeyer why do you disagree with @andreNicolas? – yiyi Jan 20 '13 at 6:06
@MaoYiyi: I do not know what you mean. I do not disagree with André Nicolas's answer. Is there something in my answer you have a question about, or that seems to conflict with André's answer? – Jonas Meyer Jan 20 '13 at 6:08
I didn't notice the $^{\prime}$ sorry. I had been reading it for the last couple of days, trying to understand what I misread as a conflict, but thanks for the jolt to help me see it clearly. thanks. – yiyi Jan 20 '13 at 6:10
@MaoYiyi: Yes, I can see how one could be thrown off by my inclusion of the last line, which is just a side remark. But as indicated in the previous line, "$f'(3)$ exists and equals $6$." – Jonas Meyer Jan 20 '13 at 6:13

Edit: The book is not correct, and you most certainly are.

The derivative at $x=3$ does exist for both functions, though only one of the functions composing your piece-wise function is defined for that point (as the domain of the other does not include the point).

While the derivative at $x=3$ exists across the whole domain of $f(x)$, it has a different value for each constituent function of the total piece-wise function across most of its domain. Thankfully, at $x=3$, the derivative, as well as the function's value, for each function matches. Generally, the derivative of $x^2$ is $2x$, and the derivative of $6x-9$ is $6$. Evaluated at $x=3$, you will obtain identical values for the derivative. This is also the case when taking a limit analysis of $f(x)$, where the right hand limit equates to the left hand limit.

The piece-wise function as a whole has a continuous value and continuous derivative at $x=3$, so the function is both continuous and differentiable.

-
pretty sure the derivative of $6x - 9$ is 6. – zrbecker Jan 19 '13 at 2:56
The derivative of $6x-9$ is $6$, not $6x$. Evaluated at $x=3$ yields $6$ – Clayton Jan 19 '13 at 2:56
Ah, good catch. My mistake – B. Elliott Jan 19 '13 at 2:57
You seem to have partially corrected your answer, but it still says, "While the derivative at $x=3$ exists across the board, it has a different value for each function." I don't know what this means. The derivative of $f$ at $x=3$ has only one value. "The piece-wise function has a ... continuous derivative at $x=3$..." Do you mean to say that its derivative exists? The function $f'$ is also continuous, but that is not needed to check that $f'(3)$ exists. – Jonas Meyer Jan 19 '13 at 6:33
Or are you saying that because $f'$ is continuous for $x<3$ and $x>3$ and the left-hand and right-hand limits of $f'$ exist and are equal at $x=3$, then $f'(3)$ exists and equals this limit? If you mean something like this, it could be made more explicit, as this seems to be invoking a theorem rather than the definition of the derivative. – Jonas Meyer Jan 19 '13 at 6:37