Can the chain rule be relaxed to allow one of the functions to not be defined on an open set?
Solution 1:
You can extend the definition of differentiability as follows
Definition. Let $D$ be any subset of $\mathbb R^n$, let $x_0\in D$. Let $g\colon D\to \mathbb R^m$. Let $L\colon \mathbb R^n\to \mathbb R^m$ be a linear map. We say that $g$ has differential $L$ at $x_0$ if
$$
\lim_{x\to x_0,\ x\in D} \frac{f(x)-f(x_0) - L(x-x_0)}{|x-x_0|} = 0.
$$
We say that $g$ is differentiable at $x_0$ if there exists at least one linear $L$ such that $g$ has differential $L$ at $x_0$.
Notice that if $x_0$ is not an internal point, the differential might not be unique.
Then I would guess that the following is true:
Theorem. Let $\Omega\subset \mathbb R^n$ open, $x_0\in \Omega$, $f\colon \Omega\to \mathbb R^m$ differentiable at $x_0$, $g\colon f(\Omega)\to \mathbb R^k$ differentiable at $f(x_0)$. Then $g\circ f\colon \Omega \to \mathbb R^k$ is differentiable at $x_0$.
Notice that the hypothesis on $g$ is weaker than the usual chain rule theorem, but the thesis is the same.