TITLE: Why differentiate between continuous on $[a,b]$ and differentiable on $(a,b)$?
QUESTION [8 upvotes]: Before starting I want to say that my main language is not english so you may find some grammar mistakes. I will try to avoid making them as much as I can, so please forgive me.
A few months ago I decided that I wanted to learn Calculus so I got some books and started to study, during that time I faced a statement that is pretty common among math definitions related to it, and that statement is:

$f(x)$ is continuous at $[a,b]$ and differentiable at $(a,b)$

What I was thinking was that a limit needs a closed interval to compute its value, but after making some research I found that the function $f(x) = \sqrt{x}$ is continuous at $0$, so I started to make myself this question.
If we consider, for example $f(x) = x^2$. and the interval $[1,3]$. We know that the function is differentiable and continuous at its whole domain but we do we say that it has to be continuous at $[1,3]$ and differentiable at $(1,3)$, this of course, considering the function over the interval mentioned before, when in fact it is differentiable at $1$ and $3$.
Also the function $\sqrt{x}$ is considered continuous at its whole domain, even also at $x = 0$ but it is not differentiable at 0. Why?
Why do we do this difference between $[a,b]$ and $(a,b)?$
Sorry if I did not express myself the best way possible, again, English is not my main language.

REPLY [3 votes]: The short answer is: we often desire for the assumptions of a theorem to be least restrictive possible, so that the theorem is most general and widely applicable. It turns out that in many theorems you require continuity on $[a, b]$, but you do not actually need differentiability at the endpoints, only on $(a, b)$.
For example, in the proof of Rolle's theorem, we have a function $f$ defined on $[a, b]$ such that $f(a)=f(b)$ and we wish to establish the existence of a point $c \in (a, b)$ such that $f'(c) = 0$. We know that $f$ must have the maximum on $[a, b]$ and we define $d$ to be an argument for which the maximum is attained. Now there are two cases. Either $d$ is an endpoint of $[a, b]$ or an interior point. In the first case $f$ is the constant function and we are done without explicitly invoking differentiability of $f$ (even though every constant function on a suitable domain is differentiable). In the second case we invoke differentiability in order to say that $f'(d)$ exists before we observe that $f'(d)=0$.
This example shows that sometimes differentiability of a function in the interior $(a, b)$ of an interval $[a, b]$ may simply be all that is needed to establish a conclusion.
There is also the subtle point that consideration of differentiability and derivative of a function defined on a closed interval at an endpoint of the interval requires that we appropriately interpret the definition as referring to one-sided limit. The subtlety disappears if we only consider differentiability and derivatives on open sets.

Regarding the reason that the function $\sqrt{x}$ is not differentiable at $x=0$ it is because the tangent to its plot becomes vertical at this point. Equivalently, the limit $$\lim_{x\to 0_+}\frac{\sqrt{x}}{x} = \lim_{x\to 0_+}\frac{1}{\sqrt{x}} $$ does not exist.