Does this piecewise function contradict the fact that all differentiable functions are continuous?

I learned that all differentiable functions are continuous. Why does the following equation not violate this rule:

$$f(x)=\begin{cases}x^2+3 \quad &\text{when } x>1 \\ x^2 \quad &\text{when }x\le 1\end{cases}$$

• The derivative at $x = 1$ does not exist as $\lim_{x\to 1} \frac{f(x) - f(1)}{x-1} = \lim_{x\to 1} \frac{f(x) - 1}{x-1}$ does not exist. In particular, the limit from above. – Simon S Dec 7 '14 at 4:12
• That function is neither continuous nor differentiable at $x = 1$. – Daniel Hast Dec 7 '14 at 4:12
• I am confused the derivative of x^2+3 = 2x and the derivative of x^2 = 2x where is the error – Matthew Baranoff Dec 7 '14 at 4:18
• – user147263 Dec 7 '14 at 4:19
• but the two side both equal 2x do they not – Matthew Baranoff Dec 7 '14 at 4:34

$f(x)$ is not differentiable at $x = 1$. The limit $$\lim_{x\rightarrow 1+}\frac{f(x)-f(1)}{x-1}=\lim_{x\rightarrow 1+}\frac{x^2+2}{x-1}$$ does not exist.
• Great use of algebra to demonstrate the fact that the limit of the difference quotient does not exist. What might add to one's conceptual understanding is a geometric explanation: the slope of the line between $\bigl(1, f(1)\bigr)$ and $\bigl(1+h, f(1+h)\bigr)$ increases without bound (the line gets steeper) as $h\to 0$. See this graph for a demo. – chharvey Dec 7 '14 at 21:42
This function is not differentiable at $x=1$, nor is it continuous there. That's why.