Derivative of given $f(x)$ at $x=0$ If given this function:
$$f(x) =
\begin{cases}
e^x,  & x \le 0 \\[2ex]
-e^{-x}+2, & \text{x > 0}
\end{cases} $$
How do I calculate the derivative at $x=0$?
Shall I calculate by the normal way or should I use the limit definition?
 A: You should see if the two functions (comprising the given function) have derivatives at $x = 0$ and if so, if these two are equal. If they are equal, then the main function also has a derivative at $x = 0$.   
Think about the geometric meaning of the derivative: imagine the two functions both have derivatives (at $x=0$) but they are not equal. This would mean that the two tangent lines (at the point $x=0$) to the graphics of the two functions are different lines. So there's no one single tangent line (to the graphic of the main function) which you may call derivative of the main function.  
A: Using the limit definition right and left of 0, you easily prove that the derivative of f at 0 exists and is equal to 1.
A: Note that
$$f'(x)=\begin{cases}\mathrm{e}^{x}\quad\  \mbox{ if }\ \, x\leq0\\-\mathrm{e}^{x}\ \  \mbox{ if }\ x>0\end{cases}$$
Such that
$$\lim_{x\ \downarrow\ 0}{f(x)}=\lim_{x\ \downarrow\ 0}{\left(-\mathrm{e}^{-x}\right)}=1$$
and
$$\lim_{x\ \uparrow\ 0}{f(x)}=\lim_{x\ \uparrow\ 0}{\left(\mathrm{e}^{x}\right)}=1.$$
In other words, both the left-sided limit and right-sided limit at $x=0$ equal $1$, so
$$f'(0)=1$$
