General question about proving that a function is differentiable This is a general question about a concept so let's assume $f(x)$ is some function.
Let $f(x)=\left\{ 
  \begin{array}{l l}
    some-function & \quad \text{if $x \neq 0$}\\
    some-other-function & \quad \text{if $x=0$}
  \end{array} \right.$
I know that if I prove that $f'(x)$ exists on all of the domain of the function, then it's differentiable.
But I also know that if the function is not continuous, it can't be differentiable.
What I don't understand is, how the fact that I show that the derivative exists for every $x\in domain$, makes sure that the function is continuous?
For a more concrete example,
Let $g(x)=\left\{ 
  \begin{array}{l l}
    \frac{sinx}{x} & \quad \text{if $x \neq 0$}\\
    1 & \quad \text{if $x=0$}
  \end{array} \right.$
It's obvious that the function is differentiable at $\frac{sinx}{x}$ and at $1$, but why does it imply that the function is necessarily continuous?
Is it enough to say that since it's differentiable when $x\neq 0$ and when $x=0$ then it's differentiable?
 A: A function $f$ is continuous at $x_0$ if and only if
$$\lim_{x\to x_0}f(x)=f(x_0).$$
Which is really the same as
$$\lim_{x\to x_0}(f(x)-f(x_0))=0.$$
Now you probably recognize the expression on the left side. It appears in the difference quotient:
$$\frac{f(x)-f(x_0)}{x-x_0}.$$
A function is differentiable at $x_0$ if the limit of this quotient as $x\to x_0$ exists. The denominator is guaranteed to converge to $0$. But for the limit of the quotient to exist, the numerator then also has to go to $0$, otherwise the whole thing diverges. And we just noticed before that the numerator going to $0$ is exactly what's needed for continuity.
Note that none of this has anything to do with how the function has been written down, wether it's piecewise or not, doesn't matter ($\sqrt{x^2}$ and $\vert x\vert$ have the exact same properties, since they are equal, but $\vert x\vert$ is defined piecewise, and $\sqrt{x^2}$ isn't). How we represent a function can at most influence how convenient our calculations end up being. But the fact that differentiability implies continuity isn't based on such a representation.
A: The fact that a function is defined “by cases” has no relevance, except perhaps on how you decide whether it is continuous or differentiable.
The theorem “a function that's differentiable at a point $c$ is continuous at $c$” holds whatever is the definition of the function.
In your case, the derivative at $0$ is, if it exists,
$$
\lim_{x\to0}\frac{f(x)-f(0)}{x}=\lim_{x\to0}\frac{f(x)-1}{x}\mathrel{\color{red}{=}}\lim_{x\to0}\frac{\dfrac{\sin x}{x}-1}{x}=\lim_{x\to0}\frac{\sin x-x}{x^2}=0
$$
where the “how you decide” mentioned above comes into place: since we're computing the limit for $x\to0$, the value of $f(x)$ when we perform the step denoted with the red equal sign can be taken as $f(x)=\frac{\sin x}{x}$.
Thus the function $f$ is differentiable at $0$ and, by general theorem, continuous at $0$.
Of course, the continuity at zero can be checked separately, but it's not necessary as we proved differentiability directly.
