If function is differentiable at a point, is it continuous in a neighborhood? I was reading a proof for the multi-variable chain rule and in the proof the mean-value theorem was used. The use of the theorem requires that a function is continuous between two points.
Hence the motivation for the question, if a function is differentiable at a point, is it continuous in some neighborhood? If not, then the multi-variable chain rule proof is fake?
 A: To answer the question in the title: a function that is differentiable at a point need not be continuous in a neighbourhood. For example, consider the function
$$
f(x) = \begin{cases} x^2, & x\in\mathbb Q \\ 0, & x\notin\mathbb Q\end{cases}
$$
then $\frac{\mathrm{d}f}{\mathrm{d}x}(0)=0$, but $\lim_{x\to a}f(x)$ cannot exist for $a\neq0$ because $\lim_{\substack{x\to a\\x\in\mathbb Q}}f(x)=\lim_{x\to a}x^2=a^2$ whereas $\lim_{\substack{x\to a \\ x\notin\mathbb Q}}f(x)=0$.
This doesn't mean the multivariable chain rule is fake, however, though perhaps the proof you were reading made stronger assumptions than just being differentiable at the point of interest?
A: It usually isn't.
Consider the function $f : [0,1[ \rightarrow \mathbb R$ defined by
$$
f(x) = \frac{1}{n} \quad \text{if} \quad x \in \left[\frac{1}{n+1},\frac{1}{n} \right[,n \in \mathbb N^*
$$
$$
f(0) = 0
$$
It is surely continuous at $x = 0$ and you can easily check that it is differentiable at $0$ with derivative $1$. And yet there is a discontinuity in any neighborhood of $0$.
A: No, differentiability in a point only implies continuity in that specific point. A counterexample can already be found in one dimension:
$$f:\mathbb R\to\mathbb R,\quad f(x)=\begin{cases}x^2&x\in\mathbb Q\\0&\textrm{otherwise}\end{cases}$$
This function is differentiable in $0$, but not continuous anywhere other than $0$.
There is also a proof of the multi-variable chain rule which does not depend on the mean value theorem. A function $f:U\to\mathbb R^m$ with $U\subseteq \mathbb R^n$ open is differentiable in $x_0\in U$ iff there exists a linear map $\mathrm Df(x_0):\mathbb R^n\to\mathbb R^m$ and a function $R_f:U\to\mathbb R^m$ with $\lim_{x\to x_0}\frac{R_f(x)}{\Vert x-x_0\Vert}=0$ such that
$$f(x)=f(x_0)+\mathrm Df(x_0)(x-x_0)+R_f(x).$$
The same goes for a function $g:V\to\mathbb R^k$ with $U\subseteq\mathbb R^m$ open and $y_0\in V$. So if $g$ is differentiable in $y_0:=f(x_0)$, then
$$g(y)=g(y_0)+\mathrm Dg(y_0)(y-y_0)+R_g(y).$$
Insert $y_0=f(x_0)$ and $y=f(x)=f(x_0)+\mathrm Df(x_0)(x-x_0)+R_f(x)$ to get
$$\begin{align*}g\circ f(x)&=g(f(x_0))+\mathrm Dg(f(x_0))[f(x_0)+\mathrm Df(x_0)(x-x_0)+R_f(x)-f(x_0)]+R_g(y)\\
&=g(f(x_0))+\mathrm Dg(f(x_0))[\mathrm Df(x_0)(x-x_0)+R_f(x_0)]+R_g(x_0)\\
&=g(f(x_0))+\underbrace{\mathrm Dg(f(x_0))\mathrm Df(x_0)}_{=\mathrm D(g\circ f)(x_0)}(x-x_0)~+~\underbrace{\mathrm Dg(f(x_0))R_f(x_0)+R_g(y_0)}_{=:R_{g\circ f}}
\end{align*}$$
It is now straightforward to show that $R_{g\circ f}$ has the required property of
$$\lim_{x\to x_0}\frac{R_{g\circ f}(x)}{\Vert x-x_0\Vert}=0,$$
which makes
$$\mathrm D(g\circ f)(x_0)=\mathrm Dg(f(x_0))\mathrm Df(x_0).$$
And that's exactly the multi-variable chain rule.
A: Define $f(1/n) =0, n=1,2,\dots $ and define $f(x)=x^2$ everywhere else. Then $f'(0)=0.$ But in any neighborhood of $0,$ $f$ has infinitely many points of discontinuity–namely at the points $1/n$ that fit into that neighborhood.
