Are derivatives defined at boundaries?

This issue is handled carefully in Rudin. Here is definition 5.1 in Rudin:

Let $f$ be defined (and real-valued) on $[a,b]$. For any $x \in [a,b]$ form the quotient \begin{equation} \phi(t) = \frac{f(t) - f(x)}{t-x} \quad (a < t < b, t \neq x), \end{equation} and define \begin{equation} f'(x) = \lim_{t\to x} \phi(t), \end{equation} provided this limit exists in accordance with Definition 4.1.

If $f'$ is defined at a point $x$, we say that $f$ is differentiable at $x$. If $f'$ is defined at every point of a set $E\subset [a,b]$, we say that $f$ is differentiable on $E$.

By this definition, $f$ is allowed to be differentiable at $a$ or at $b$.

For reference, here's definition 4.1.

Let $X$ and $Y$ be metric spaces; suppose $E \subset X$, $f$ maps $E$ into $Y$, and $p$ is a limit point of $E$. We write $f(x) \to q$ as $x \to p$, or \begin{equation} \lim_{x \to p} f(x) = q \end{equation} if there is a point $q \in Y$ with the following property: For every $\epsilon > 0$ there exists a $\delta > 0$ such that \begin{equation} d_Y(f(x),q) < \epsilon \end{equation} for all points $x \in E$ for which \begin{equation} 0 < d_X(x,p) < \delta. \end{equation} The symbols $d_X$ and $d_Y$ refer to the distances in $X$ and $Y$, respectively.

They key point of this definition, for this discussion, is that $p$ is only required to be a limit point of $E$.

By the way, if a function $f$ is defined on a subset of $\mathbb R^n$ where $n > 1$, then I think it becomes important to insist that $f$ cannot be differentiable at $x$ unless $x$ belongs to the interior of the domain of $f$. Otherwise, a matrix $f'(x)$ might exist but not be uniquely determined. Definition 9.11 in Rudin assumes that $f$ is defined on an open set.


We can extend the definition of a derivative to a derivative from the left and respectively right by $$f'_{-}(x) = \lim_{h \to 0^-} \frac{f(x+h)-f(x)}{h}$$ and $$f'_{+}(x) = \lim_{h \to 0^+} \frac{f(x+h)-f(x)}{h}.$$

If these limits are defined, on the endpoints of an interval, then the function $f$ is differentiable on a closed interval.