Let $f(x) = 2x$ for $x<0$ and $f(x)=2x+1$ for $x>0$. Why is this function not differentiable? I understand that if a function is differentiable, then it has to be continuous which this function is not. That being said, I am trying to understand it in a different way such as by using the Epsilon-Delta definition.
For example, $\lim_{h\to 0+}\frac{2(x+h)+1-(2x+1)}{h}=2$ and $\lim_{h\to 0-}\frac{2(x+h)-2x}{h}=2$. So, wouldn't both the one-sided limits imply the limit as $h$ goes to zero for the function going to $2$ imply it is differentiable? I feel like I am doing something wrong here. Maybe negating the Epsilon-Delta Definition would be better.
$\lim_{h\to 0}\frac{2(x+h)+1-(2x+1)}{h}=2$ only proves that for $x>0$, $f'(x)=2$. Likewise, $\lim_{h\to 0}\frac{2(x+h)-2x}{h}=2$ only proves that for $x<0$, $f'(x)=2$. They prove nothing about $f'(0)$.
For $f$ (or rather, an extension of $f$ by some choice for $f(0)$) to be differentiable at $0$, both limits $$a:=\lim_{h\to0^+}\frac{2h+1-f(0)}h=2+\lim_{h\to0^+}\frac{1-f(0)}h$$and$$b:=\lim_{h\to0^-}\frac{2h-f(0)}h=2-\lim_{h\to0^-}\frac{f(0)}h$$ should first exist (and moreover, be equal). But $b$ exists iff $f(0)=0$ and $a$ exists iff $1-f(0)=0$.