TITLE: Are derivatives defined at boundaries?
QUESTION [16 upvotes]: Given a differentiable function $f : [-5,5] \rightarrow \mathbb{R},$ I was under the impression that the derivative $f'$ has domain $(-5,5).$ However, according to Wikipedia

...a differentiable function is a function whose derivative exists at each point in its domain.

But hang on! If $f'$ only has domain $(-5,5),$ then under Wikipedia's definition of 'differentiable function,' we have that $f$ is not differentiable.
Question 1. What's going on?

Question 2. Assuming for the moment that $f'$ has domain $[-5,5],$ is it true that if $f'(5)>0,$ then $5$ corresponds to a local maximum of $f$? If so, is there a generalization to arbitrary differentiable functions $f : X \rightarrow \mathbb{R},$ where $X \subseteq \mathbb{R}^n$?

REPLY [6 votes]: 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.