# Why is this function differentiable?

I know that the piecewise function $f(x) = \left\{ \begin{array}{lr} 2x & , x < 1\\ x+1 & , x \geq 1 \end{array} \right.$ is differentiable because $2x$ and $x + 1$ converge at different rates based on their slope but why is $f(x) = \left\{ \begin{array}{lr} \frac{x^2-1}{x-1} & , x \neq 1\\ 2 & , x=1 \end{array} \right.$ differentiable? I know that it is continuous but their slopes are different.

Thanks!

-
Your second $f$ is the same as $x\mapsto x+1$ which is clearly differentiable everywhere. –  LostInMath Oct 12 '11 at 10:22
$\displaystyle f(x)=\left\{\begin{array}{}2x&\text{if }x<1\\x+1&\text{if }x\ge1\end{array}\right.$ is not differentiable at $x=1$. $\displaystyle\lim_{h\to0}\frac{f(1+h)-f(1)}{h}$ does not exist. –  robjohn Oct 12 '11 at 10:37

Don't be tricked by the seemingly complicated piecewise definition of the function $f:\mathbb{R}\to\mathbb{R}$, $$f(x) = \left\{ \begin{array}{lr} \frac{x^2-1}{x-1} & , x \neq 1\\ 2 & , x=1. \end{array} \right.$$ It is exactly the same function as $g:\mathbb{R}\to\mathbb{R}$, $g(x)=x+1$, since $$\left\{ \begin{array}{lr} \frac{x^2-1}{x-1}=\frac{(x+1)(x-1)}{x-1}=x+1=g(x) & , x \neq 1\\ 2 = 1+1 = x+1 = g(x)& , x=1. \end{array} \right.$$ Obviously the function $g$ is differentiable everywhere, and hence $f$ is too, since they are the one and same.