I'm reading a book which defines in the following manner differentiable functions:
The map $F:U\to \mathbb R^n$, defined in an open set $U\subset\mathbb R^m$ is differentiable at the point $a\in U$ when there exists a linear map $T:\mathbb R^m\to \mathbb R^n$ such that
$$f(a+v)-f(a)=T\cdot v+r(v),\text{where $\lim_{v\to 0}\frac{r(v)}{v}$}=0.$$
Let $X\subset\mathbb R^m$ be any set. We can say $f:X\to\mathbb R^n$ is differentiable if it's a restriction of a differentiable map $F:U\to \mathbb R^m$ defined in a open set $U\supset X$.
In the same book the author says:
In general the derivative of an map $f:X\to\mathbb R^n$ at a point $x\in X\subset \mathbb R^m$ isn't well-defined, because the possible extensions of $f$ to neighborhoods of $X$ can have different derivatives at the point $x$. (This is obvious, for example, in the case $X$ is only a point $x$.)
So I have the following doubts:
Why can't we define the derivative at a point contained in a general set? why is the open set so special that we can define the derivative in it?
What does the author mean with the example when $X=\{x\}$?
The idea of a derivative is that you're looking at behavior "near" a point. If your set is open, then "zooming in" far enough allows you to restrict your attention to places where $f$ is defined. But if $X$ isn't open, then at some points in $X$, it's not possible to take a small enough neighborhood to ignore the places where $f$ is undefined, which is a problem for the limit - the limit talks about "for all $v$ small enough...", not just the ones on which $f$ is defined.
When $X = \{x\}$, $T$ can be anything. For an example, take $n = 1$ and let $f(x) = 4$. $T$ is, say, $7$, because we can write $f(x + v) - f(x) = 7v + 0$ - since $x$ is the only point in existence, the only value of $v$ we have to consider is $0$. So the statement $f(x+v) - f(x) = 7v + 0$ is true for all allowable $v$, and $\lim_{v\to 0}\frac{0}{v} = 0$, so $7$ is the derivative. But we could pick any other number in place of $7$ - since there is only one point, $v$ is always zero, so the number doesn't matter. So the derivative takes on all values at this one point.