Are derivatives defined at boundaries?

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$?

Solutions Collecting From Web of "Are derivatives defined at boundaries?"

Most textbooks would define a differentiable function similar to the following:

$f$ is said to be differentiable on an open set $S$ if $f$ is differentiable at every point of $S$

One can the proceed to define one sided derivatives for the boundaries of closed intervals, but these are not used to define a differentiable function.

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.

Recall that one definition of the phrase “$f:D\to \mathbb{R}$ is differentiable at $d\in D$” is that the limit $\displaystyle\lim_{x\to d}\frac{f(x)-f(d)}{x-d}$ exists. We have to unpack this a little bit to get at your question.

The usual definition of a limit of a function $g:D\to\mathbb{R}$ is that $\displaystyle\lim_{x\to d}g(x) = L$ if for all $\varepsilon$-balls $B_R$ centered at $L$ there is a $\delta$-ball $B_D$ centered at $d$ such that $g(B_D-\{d\})\subseteq B_R$.

Finally, remember that an $\alpha$-ball centered at $a$ in $A$ is a set $\{p: d_A(p,a)<\alpha\}$. In our case, we are considering $a=d$ and $A=[-5,5]$, so a $\delta$-ball centered at $d$ is in fact the set $(5-\delta, 5]$.

So, going back through the layers, that means that the phrase “$f:D\to \mathbb{R}$ is differentiable at $5\in [-5,5]$” means that there is some $L$ such that for every set $B_R=(L-\frac12\varepsilon,L+\frac12\varepsilon)$ there exists a set $B_D=(5-\delta,5]$ such that for each $x\in B_D$, the real number $\displaystyle\frac{f(x)-f(5)}{x-5}$ is in $B_R$.

Seeing no reason why such a definition should encounter any difficulties, I would say that a derivative can be defined at the boundary of a metric space. However, we must be careful with this: if we have a function defined on $\mathbb{R}$ and we restrict it’s domain to a set $A$ with boundaries, the restriction may have a derivative at a boundary point$-$ this does not imply that the original function has a derivative there, for reasons of two-sidedness that other answerers mentioned.

Briefly, it is possible that for each $\varepsilon$ there exists a set $(5-\delta, 5]$ such that the desired condition holds, but for some $\varepsilon$ there fails to be a set $(5-\delta, 5+\delta)$ where the same condition holds. This seems like it would entail the function doing some silly things at the right of 5, but that’s usually how we think of the behavior of non-differentiabile functions anyway, so hopefully it doesn’t cause too much strain to imagine. (For a more ‘well-behaved’ example, consider $|x|$ on the domains $[-1,0]$ versus $[-1,1]$).

As for the second question, I can’t give you such a detailed explanation with any surity, but I imagine the answer is yes, and formalism works pretty similar to the proof of Fermat’s theorem for stationary points.

There are a large number of minor ambiguities that are glossed over, for the sake of exposition and efficient thought and communication. e.g. we often use the phrase “function of a real variable” to refer to things like $f(x) = 1/x$ that is very much not a function of a real variable. (among the things we could really mean by $f$ is a partial function of a real variable and a function of a nonzero real variable)

While it is often convenient to deal with technicalities and exceptions in an ad-hoc manner, this practice causes problems when one needs to be precise and pay attention to detail.

Alas, the correct answer to your question amounts to something like “read your book and try to figure out what convention its adopting” or even better “understand all conventions that might be useful here”.

Given that you speak of a function $f: [-5,5] \to \mathbb{R}$, the most natural convention, I think, would be that such a thing can be differentiable. There aren’t any numbers greater than five in $[-5,5]$, so the fact that $f$ is not defined for any number greater than $5$ is not an obstruction to it being continuous and differentiable at $5$.

The alternative convention, I think, would only apply if you were considering instead a (partial) function of a real variable that was defined only on $[-5,5]$. Then sometimes it would be useful to consider such a function as automatically being neither continuous nor differentiable at $\pm 5$.

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$,

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.